forked from loafle/openapi-generator-original
add cwiki doc generator
This commit is contained in:
parent
ee7d3b3b81
commit
d07417eeae
@ -0,0 +1,107 @@
|
|||||||
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
|
import org.openapitools.codegen.*;
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.Operation;
|
||||||
|
import io.swagger.v3.oas.models.media.*;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ConfluenceWikiCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
private static final String ALL_OPERATIONS = "";
|
||||||
|
protected String invokerPackage = "io.swagger.client";
|
||||||
|
protected String groupId = "io.swagger";
|
||||||
|
protected String artifactId = "swagger-client";
|
||||||
|
protected String artifactVersion = "1.0.0";
|
||||||
|
|
||||||
|
public ConfluenceWikiCodegen() {
|
||||||
|
super();
|
||||||
|
outputFolder = "docs";
|
||||||
|
embeddedTemplateDir = templateDir = "confluenceWikiDocs";
|
||||||
|
|
||||||
|
defaultIncludes = new HashSet<String>();
|
||||||
|
|
||||||
|
cliOptions.add(new CliOption("appName", "short name of the application"));
|
||||||
|
cliOptions.add(new CliOption("appDescription", "description of the application"));
|
||||||
|
cliOptions.add(new CliOption("infoUrl", "a URL where users can get more information about the application"));
|
||||||
|
cliOptions.add(new CliOption("infoEmail", "an email address to contact for inquiries about the application"));
|
||||||
|
cliOptions.add(new CliOption("licenseInfo", "a short description of the license"));
|
||||||
|
cliOptions.add(new CliOption("licenseUrl", "a URL pointing to the full license"));
|
||||||
|
cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC));
|
||||||
|
cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC));
|
||||||
|
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC));
|
||||||
|
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
|
||||||
|
|
||||||
|
additionalProperties.put("appName", "Swagger Sample");
|
||||||
|
additionalProperties.put("appDescription", "A sample swagger server");
|
||||||
|
additionalProperties.put("infoUrl", "https://helloreverb.com");
|
||||||
|
additionalProperties.put("infoEmail", "hello@helloreverb.com");
|
||||||
|
additionalProperties.put("licenseInfo", "All rights reserved");
|
||||||
|
additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html");
|
||||||
|
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
|
||||||
|
additionalProperties.put(CodegenConstants.GROUP_ID, groupId);
|
||||||
|
additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId);
|
||||||
|
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("index.mustache", "", "confluence-markup.txt"));
|
||||||
|
reservedWords = new HashSet<String>();
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>();
|
||||||
|
importMapping = new HashMap<String, String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.DOCUMENTATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "cwiki";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates confluence wiki markup.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Schema p) {
|
||||||
|
if (p instanceof ArraySchema) {
|
||||||
|
ArraySchema ap = (ArraySchema) p;
|
||||||
|
Schema inner = ap.getItems();
|
||||||
|
return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]";
|
||||||
|
} else if (p instanceof MapSchema) {
|
||||||
|
MapSchema mp = (MapSchema) p;
|
||||||
|
Schema inner = (Schema) mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getSchemaType(p) + "[String, " + getTypeDeclaration(inner) + "]";
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||||
|
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||||
|
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||||
|
for (CodegenOperation op : operationList) {
|
||||||
|
op.httpMethod = op.httpMethod.toLowerCase();
|
||||||
|
}
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeQuotationMark(String input) {
|
||||||
|
// just return the original string
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeUnsafeCharacters(String input) {
|
||||||
|
// just return the original string
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ org.openapitools.codegen.languages.Apache2ConfigCodegen
|
|||||||
org.openapitools.codegen.languages.AkkaScalaClientCodegen
|
org.openapitools.codegen.languages.AkkaScalaClientCodegen
|
||||||
org.openapitools.codegen.languages.BashClientCodegen
|
org.openapitools.codegen.languages.BashClientCodegen
|
||||||
org.openapitools.codegen.languages.ClojureClientCodegen
|
org.openapitools.codegen.languages.ClojureClientCodegen
|
||||||
|
org.openapitools.codegen.languages.ConfluenceWikiCodegen
|
||||||
org.openapitools.codegen.languages.DartClientCodegen
|
org.openapitools.codegen.languages.DartClientCodegen
|
||||||
org.openapitools.codegen.languages.ElixirClientCodegen
|
org.openapitools.codegen.languages.ElixirClientCodegen
|
||||||
org.openapitools.codegen.languages.HaskellServantCodegen
|
org.openapitools.codegen.languages.HaskellServantCodegen
|
||||||
|
Loading…
x
Reference in New Issue
Block a user