Package io.swagger.codegen
Class DefaultGenerator
- java.lang.Object
-
- io.swagger.codegen.AbstractGenerator
-
- io.swagger.codegen.DefaultGenerator
-
- All Implemented Interfaces:
Generator
- Direct Known Subclasses:
Codegen
public class DefaultGenerator extends AbstractGenerator implements Generator
-
-
Field Summary
Fields Modifier and Type Field Description protected String
basePath
protected String
basePathWithoutHost
protected CodegenConfig
config
protected String
contextPath
protected CodegenIgnoreProcessor
ignoreProcessor
protected Boolean
isGenerateApiDocumentation
protected Boolean
isGenerateApis
protected Boolean
isGenerateApiTests
protected Boolean
isGenerateModelDocumentation
protected Boolean
isGenerateModels
protected Boolean
isGenerateModelTests
protected Boolean
isGenerateSupportingFiles
protected Boolean
isGenerateSwaggerMetadata
protected org.slf4j.Logger
LOGGER
protected ClientOptInput
opts
protected io.swagger.models.Swagger
swagger
-
Constructor Summary
Constructors Constructor Description DefaultGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>
buildSupportFileBundle(List<Object> allOperations, List<Object> allModels)
protected void
configureGeneratorProperties()
protected void
configureSwaggerInfo()
List<File>
generate()
protected void
generateApis(List<File> files, List<Object> allOperations, List<Object> allModels)
protected void
generateModelDocumentation(List<File> files, Map<String,Object> models, String modelName)
protected void
generateModels(List<File> files, List<Object> allModels)
protected void
generateModelTests(List<File> files, Map<String,Object> models, String modelName)
protected static String
generateParameterId(io.swagger.models.parameters.Parameter parameter)
protected void
generateSupportingFiles(List<File> files, Map<String,Object> bundle)
protected Boolean
getGeneratorPropertyDefaultSwitch(String key, Boolean defaultValue)
protected String
getScheme()
Generator
opts(ClientOptInput opts)
protected static void
processMimeTypes(List<String> mimeTypeList, Map<String,Object> operation, String source)
protected Map<String,Object>
processModels(CodegenConfig config, Map<String,io.swagger.models.Model> definitions, Map<String,io.swagger.models.Model> allDefinitions)
protected void
processOperation(String resourcePath, String httpMethod, io.swagger.models.Operation operation, Map<String,List<CodegenOperation>> operations, io.swagger.models.Path path)
protected Map<String,Object>
processOperations(CodegenConfig config, String tag, List<CodegenOperation> ops, List<Object> allModels)
Map<String,List<CodegenOperation>>
processPaths(Map<String,io.swagger.models.Path> paths)
protected File
processTemplateToFile(Map<String,Object> templateData, String templateName, String outputFilename)
void
setGenerateSwaggerMetadata(Boolean generateSwaggerMetadata)
Programmatically disable the output of .swagger-codegen/VERSION, .swagger-codegen-ignore, or other metadata files used by Swagger Codegen.void
setGeneratorPropertyDefault(String key, String value)
Set generator properties otherwise pulled from system properties.-
Methods inherited from class io.swagger.codegen.AbstractGenerator
embeddedTemplateExists, getCPResourcePath, getFullTemplateFile, getTemplateReader, readResourceContents, readTemplate, writeToFile
-
-
-
-
Field Detail
-
LOGGER
protected final org.slf4j.Logger LOGGER
-
config
protected CodegenConfig config
-
opts
protected ClientOptInput opts
-
swagger
protected io.swagger.models.Swagger swagger
-
ignoreProcessor
protected CodegenIgnoreProcessor ignoreProcessor
-
isGenerateApis
protected Boolean isGenerateApis
-
isGenerateModels
protected Boolean isGenerateModels
-
isGenerateSupportingFiles
protected Boolean isGenerateSupportingFiles
-
isGenerateApiTests
protected Boolean isGenerateApiTests
-
isGenerateApiDocumentation
protected Boolean isGenerateApiDocumentation
-
isGenerateModelTests
protected Boolean isGenerateModelTests
-
isGenerateModelDocumentation
protected Boolean isGenerateModelDocumentation
-
isGenerateSwaggerMetadata
protected Boolean isGenerateSwaggerMetadata
-
basePath
protected String basePath
-
basePathWithoutHost
protected String basePathWithoutHost
-
contextPath
protected String contextPath
-
-
Method Detail
-
opts
public Generator opts(ClientOptInput opts)
-
setGenerateSwaggerMetadata
public void setGenerateSwaggerMetadata(Boolean generateSwaggerMetadata)
Programmatically disable the output of .swagger-codegen/VERSION, .swagger-codegen-ignore, or other metadata files used by Swagger Codegen.- Parameters:
generateSwaggerMetadata
- true: enable outputs, false: disable outputs
-
setGeneratorPropertyDefault
public void setGeneratorPropertyDefault(String key, String value)
Set generator properties otherwise pulled from system properties. Useful for running tests in parallel without relying on System.properties.- Parameters:
key
- The system property keyvalue
- The system property value
-
getGeneratorPropertyDefaultSwitch
protected Boolean getGeneratorPropertyDefaultSwitch(String key, Boolean defaultValue)
-
getScheme
protected String getScheme()
-
configureGeneratorProperties
protected void configureGeneratorProperties()
-
configureSwaggerInfo
protected void configureSwaggerInfo()
-
generateModelTests
protected void generateModelTests(List<File> files, Map<String,Object> models, String modelName) throws IOException
- Throws:
IOException
-
generateModelDocumentation
protected void generateModelDocumentation(List<File> files, Map<String,Object> models, String modelName) throws IOException
- Throws:
IOException
-
generateApis
protected void generateApis(List<File> files, List<Object> allOperations, List<Object> allModels)
-
generateSupportingFiles
protected void generateSupportingFiles(List<File> files, Map<String,Object> bundle)
-
buildSupportFileBundle
protected Map<String,Object> buildSupportFileBundle(List<Object> allOperations, List<Object> allModels)
-
processTemplateToFile
protected File processTemplateToFile(Map<String,Object> templateData, String templateName, String outputFilename) throws IOException
- Throws:
IOException
-
processMimeTypes
protected static void processMimeTypes(List<String> mimeTypeList, Map<String,Object> operation, String source)
-
processPaths
public Map<String,List<CodegenOperation>> processPaths(Map<String,io.swagger.models.Path> paths)
-
processOperation
protected void processOperation(String resourcePath, String httpMethod, io.swagger.models.Operation operation, Map<String,List<CodegenOperation>> operations, io.swagger.models.Path path)
-
generateParameterId
protected static String generateParameterId(io.swagger.models.parameters.Parameter parameter)
-
processOperations
protected Map<String,Object> processOperations(CodegenConfig config, String tag, List<CodegenOperation> ops, List<Object> allModels)
-
-