Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.languages;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.openapitools.codegen.model.ModelMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
public class PlantumlDocumentationCodegen extends DefaultCodegen implements CodegenConfig {
public static final String ALL_OF_SUFFIX = "AllOf";
final Logger LOGGER = LoggerFactory.getLogger(PlantumlDocumentationCodegen.class);
@Override
public CodegenType getTag() {
return CodegenType.DOCUMENTATION;
}
@Override
public String getName() {
return "plantuml";
}
@Override
public String getHelp() {
return "Generates a plantuml documentation.";
}
public PlantumlDocumentationCodegen() {
super();
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.BETA)
.build();
outputFolder = "generated-code" + File.separator + "plantuml";
embeddedTemplateDir = templateDir = "plantuml";
supportingFiles.add(new SupportingFile("schemas.mustache", "", "schemas.plantuml"));
}
@SuppressWarnings("unchecked")
@Override
public Map postProcessSupportingFileData(Map objs) {
List models = (List) objs.get("models");
List codegenModelList = models.stream()
.map(ModelMap::getModel)
.collect(Collectors.toList());
List inlineAllOfCodegenModelList = codegenModelList.stream()
.filter(codegenModel -> codegenModel.getClassname().endsWith(ALL_OF_SUFFIX))
.collect(Collectors.toList());
List nonInlineAllOfCodegenModelList = codegenModelList.stream()
.filter(codegenModel -> !codegenModel.getClassname().endsWith(ALL_OF_SUFFIX))
.collect(Collectors.toList());
List subtypeCodegenModelList = codegenModelList.stream()
.filter(codegenModel -> !codegenModel.allOf.isEmpty())
.collect(Collectors.toList());
List