public abstract class JavaMicronautAbstractCodegen extends AbstractJavaCodegen implements BeanValidationFeatures, OptionalFeatures
| Modifier and Type | Class and Description |
|---|---|
static class |
JavaMicronautAbstractCodegen.SERIALIZATION_LIBRARY_TYPE |
DocumentationProviderFeatures.AnnotationLibrary, DocumentationProviderFeatures.DocumentationProviderADDITIONAL_ENUM_TYPE_ANNOTATIONS, ADDITIONAL_MODEL_TYPE_ANNOTATIONS, ADDITIONAL_ONE_OF_TYPE_ANNOTATIONS, additionalEnumTypeAnnotations, additionalModelTypeAnnotations, additionalOneOfTypeAnnotations, annotationLibrary, apiDocPath, artifactDescription, artifactId, artifactUrl, artifactVersion, BOOLEAN_GETTER_PREFIX, booleanGetterPrefix, CAMEL_CASE_DOLLAR_SIGN, camelCaseDollarSign, CONTAINER_DEFAULT_TO_NULL, containerDefaultToNull, DATE_LIBRARY, dateLibrary, DEFAULT_LIBRARY, DEFAULT_TEST_FOLDER, developerEmail, developerName, developerOrganization, developerOrganizationUrl, DISABLE_HTML_ESCAPING, disableHtmlEscaping, DISCRIMINATOR_CASE_SENSITIVE, discriminatorCaseSensitive, documentationProvider, FULL_JAVA_UTIL, fullJavaUtil, groupId, IGNORE_ANYOF_IN_ENUM, ignoreAnyOfInEnum, IMPLICIT_HEADERS, IMPLICIT_HEADERS_REGEX, implicitHeaders, implicitHeadersRegex, invokerPackage, JACKSON, javaUtilPrefix, JAVAX_PACKAGE, licenseName, licenseUrl, modelDocPath, OPENAPI_NULLABLE, openApiNullable, outputTestFolder, parentArtifactId, parentGroupId, parentOverridden, parentVersion, projectFolder, projectTestFolder, scmConnection, scmDeveloperConnection, scmUrl, serializableModel, serializeBigDecimalAsString, sourceFolder, SUPPORT_ASYNC, SUPPORT_JAVA6, supportAsync, supportJava6, TEST_OUTPUT, testFolder, USE_JAKARTA_EE, useJakartaEe, WITH_XML, withXmladditionalProperties, addOneOfInterfaceImports, addOneOfInterfaces, addSchemaImportsFromV3SpecLocations, addSuffixToDuplicateOperationNicknames, allowUnicodeIdentifiers, apiDocTemplateFiles, apiNamePrefix, apiNameSuffix, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, DefaultFeatureSet, defaultIncludes, disallowAdditionalPropertiesIfNotPresent, docExtension, embeddedTemplateDir, enableMinimalUpdate, enablePostProcessFile, ensureUniqueParams, enumUnknownDefaultCase, enumUnknownDefaultCaseName, falseSchema, filesMetadataFilename, fileSuffix, generatorMetadata, gitHost, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, importBaseType, importContainerType, importMapping, inlineSchemaNameDefault, inlineSchemaNameMapping, inputSpec, instantiationTypes, JSON_MIME_PATTERN, JSON_VENDOR_MIME_PATTERN, languageSpecificPrimitives, legacyDiscriminatorBehavior, library, loadDeepObjectIntoItems, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, openAPI, openapiNormalizer, outputFolder, prependFormOrBodyParameters, releaseNote, removeEnumValuePrefix, removeOperationIdPrefix, removeOperationIdPrefixCount, removeOperationIdPrefixDelimiter, reservedWords, reservedWordsMappings, schemaMapping, serverVariables, skipOperationExample, skipOverwrite, sortModelPropertiesByRequiredFlag, sortParamsByRequiredFlag, specialCharReplacements, strictSpecBehavior, supportedLibraries, supportingFiles, supportsAdditionalPropertiesWithComposedSchema, supportsInheritance, supportsMixins, supportsMultipleInheritance, templateDir, testPackage, trueSchema, typeAliases, typeMapping, useOneOfInterfaces, vendorExtensions, versionMetadataFilenameUSE_BEANVALIDATIONUSE_OPTIONALANNOTATION_LIBRARY, DOCUMENTATION_PROVIDER| Constructor and Description |
|---|
JavaMicronautAbstractCodegen() |
| Modifier and Type | Method and Description |
|---|---|
protected com.google.common.collect.ImmutableMap.Builder<String,com.samskivert.mustache.Mustache.Lambda> |
addMustacheLambdas()
Preset map builder with commonly used Mustache lambdas.
|
void |
addOperationToGroup(String tag,
String resourcePath,
io.swagger.v3.oas.models.Operation operation,
CodegenOperation co,
Map<String,List<CodegenOperation>> operations)
Add operation to group
|
String |
apiTestFileFolder() |
String |
escapeTextGroovy(String text) |
CodegenModel |
fromModel(String name,
io.swagger.v3.oas.models.media.Schema model)
Convert OAS Model object to Codegen Model object.
|
String |
getExampleValue(String defaultValue,
String example,
String dataType,
Boolean isModel,
List<Object> allowableValues,
String itemsType,
String itemsExample,
List<CodegenProperty> requiredVars,
boolean groovy,
boolean isProperty) |
protected String |
getParameterExampleValue(CodegenParameter p,
boolean groovy) |
protected String |
getPropertyExampleValue(CodegenProperty p,
boolean groovy) |
boolean |
isUseBeanValidation() |
boolean |
isUseOptional() |
boolean |
isVisitable() |
String |
modelTestFileFolder() |
Map<String,ModelsMap> |
postProcessAllModels(Map<String,ModelsMap> objs) |
OperationsMap |
postProcessOperationsWithModels(OperationsMap objs,
List<ModelMap> allModels) |
void |
processOpts() |
String |
sanitizeTag(String tag)
Sanitize tag
|
void |
setParameterExampleValue(CodegenParameter p)
Return the example value of the parameter.
|
void |
setSerializationLibrary(String serializationLibrary) |
void |
setUseBeanValidation(boolean useBeanValidation) |
void |
setUseOptional(boolean useOptional) |
void |
setVisitable(boolean visitable) |
String |
toApiTestFilename(String name)
Return the file name of the Api Test
|
String |
toApiVarName(String name)
Return the variable name in the Api
|
String |
toModelTestFilename(String name)
Return the capitalized file name of the model test
|
addAdditionPropertiesToCodeGenModel, addImports, addImportsToOneOfInterface, apiDocFileFolder, apiFileFolder, applyJakartaPackage, applyJavaxPackage, escapeQuotationMark, escapeReservedWord, escapeUnsafeCharacters, findByName, fromOperation, getAdditionalModelTypeAnnotations, getAdditionalOneOfTypeAnnotations, getAlias, getAnnotationLibrary, getArtifactDescription, getArtifactId, getArtifactUrl, getArtifactVersion, getBooleanGetterPrefix, getDateLibrary, getDeveloperEmail, getDeveloperName, getDeveloperOrganization, getDeveloperOrganizationUrl, getDocumentationProvider, getGroupId, getInvokerPackage, getLicenseName, getLicenseUrl, getOutputTestFolder, getSchemaType, getScmConnection, getScmDeveloperConnection, getScmUrl, getSerializableModel, getSourceFolder, getSupportedVendorExtensions, getterAndSetterCapitalize, getTestFolder, getTypeDeclaration, handleImplicitHeaders, isAddNullableImports, isOpenApiNullable, modelDocFileFolder, modelFileFolder, needToImport, postProcessFile, postProcessModelProperty, postProcessModels, preprocessOpenAPI, setAdditionalEnumTypeAnnotations, setAdditionalModelTypeAnnotations, setAdditionalOneOfTypeAnnotations, setAnnotationLibrary, setArtifactDescription, setArtifactId, setArtifactUrl, setArtifactVersion, setBooleanGetterPrefix, setCamelCaseDollarSign, setContainerDefaultToNull, setDateLibrary, setDeveloperEmail, setDeveloperName, setDeveloperOrganization, setDeveloperOrganizationUrl, setDisableHtmlEscaping, setDiscriminatorCaseSensitive, setDocumentationProvider, setFullJavaUtil, setGroupId, setIgnoreAnyOfInEnum, setImplicitHeaders, setImplicitHeadersRegex, setInvokerPackage, setLicenseName, setLicenseUrl, setOpenApiNullable, setOutputDir, setOutputTestFolder, setParameterExampleValue, setParameterExampleValue, setParentArtifactId, setParentGroupId, setParentOverridden, setParentVersion, setScmConnection, setScmDeveloperConnection, setScmUrl, setSerializableModel, setSerializeBigDecimalAsString, setSourceFolder, setSupportAsync, setSupportJava6, setTestFolder, setUseJakartaEe, setWithXml, toApiDocFilename, toApiFilename, toArrayDefaultValue, toBooleanGetter, toDefaultParameterValue, toDefaultValue, toEnumName, toEnumValue, toEnumVarName, toExampleValue, toModelDocFilename, toModelFilename, toModelName, toOperationId, toParamName, toRegularExpression, toVarNameaddBodyModelSchema, addHeaders, addImport, addImport, addImport, addImports, addImports, addImports, addImportsForPropertyType, additionalProperties, addOneOfInterfaceModel, addOneOfNameExtension, addOption, addParentContainer, addProperties, addRegularExpressionDelimiter, addRequiredVarsMap, addSwitch, addVars, addVars, addVarsRequiredVarsAdditionalProps, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFilename, apiTestTemplateFiles, buildEnumVars, buildLibraryCliOption, cliOptions, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, createDiscriminator, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, escapeText, escapeTextWhileAllowingNewLines, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fromCallback, fromFormProperty, fromParameter, fromProperty, fromProperty, fromProperty, fromRequestBody, fromRequestBodyToFormParameters, fromResponse, fromSecurity, fromServers, fromServerVariables, generateExamplePath, generateJSONSpecFile, generateYAMLSpecFile, generatorLanguage, generatorLanguageVersion, getAdditionalProperties, getAdditionalPropertiesName, getAddSuffixToDuplicateOperationNicknames, getAllModels, getAllOfDescendants, getAllowUnicodeIdentifiers, getApiNamePrefix, getApiNameSuffix, getCollectionFormat, getCollectionFormat, getConsumesInfo, getContent, getContentType, getDisallowAdditionalPropertiesIfNotPresent, getDocExtension, getEnsureUniqueParams, getEnumDefaultValue, getEnumUnknownDefaultCase, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHelp, getHttpUserAgent, getIgnoreFilePathOverride, getInnerEnumAllowableValues, getInputSpec, getItemsName, getLegacyDiscriminatorBehavior, getLibrary, getModelNamePrefix, getModelNameSuffix, getModelNameToSchemaCache, getMostInnerItems, getName, getOneOfAnyOfDescendants, getOrGenerateOperationId, getOutputDir, getParameterDataType, getPrependFormOrBodyParameters, getProducesInfo, getReleaseNote, getRemoveOperationIdPrefixCount, getRemoveOperationIdPrefixDelimiter, getSchemaAdditionalProperties, getSchemaFromBooleanOrSchema, getSchemaItems, getSingleSchemaType, getSortModelPropertiesByRequiredFlag, getSortParamsByRequiredFlag, getSymbolName, getTag, getTemplatingEngine, getTypeDeclaration, getUseInlineModelResolver, getUseOneOfInterfaces, getUseOpenAPINormalizer, getVersionMetadataFilename, handleMethodResponse, handleMethodResponse, handleSpecialCharacters, hasBodyParameter, hasFormParameter, importMapping, initializeSpecialCharacterMapping, inlineSchemaNameDefault, inlineSchemaNameMapping, instantiationTypes, isAnyTypeSchema, isDataTypeBinary, isDataTypeFile, isDataTypeString, isEnableMinimalUpdate, isEnablePostProcessFile, isFreeFormObject, isHideGenerationTimestamp, isJsonMimeType, isJsonVendorMimeType, isLibrary, isParameterNameUnique, isPropertyInnerMostEnum, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isReservedWord, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, languageSpecificPrimitives, lowerCamelCase, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestTemplateFiles, modifyFeatureSet, openapiNormalizer, outputFolder, postProcess, postProcessModelsEnum, postProcessParameter, postProcessSupportingFileData, processCompiler, processOpenAPI, processTemplatingEngine, processTestExampleData, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, removeOption, removeSelfReferenceImports, reservedWords, reservedWordsMappings, sanitizeName, sanitizeName, sanitizeName, schemaMapping, serverVariableOverrides, setAddProps, setAllowUnicodeIdentifiers, setApiNamePrefix, setApiNameSuffix, setApiPackage, setCircularReferences, setDisallowAdditionalPropertiesIfNotPresent, setDocExtension, setEnableMinimalUpdate, setEnablePostProcessFile, setEnsureUniqueParams, setEnumUnknownDefaultCase, setFilesMetadataFilename, setGitHost, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLegacyDiscriminatorBehavior, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOpenAPI, setParameterBooleanFlagWithCodegenProperty, setParameterEncodingValues, setParameterNullable, setPrependFormOrBodyParameters, setReleaseNote, setRemoveEnumValuePrefix, setRemoveOperationIdPrefix, setRemoveOperationIdPrefixCount, setRemoveOperationIdPrefixDelimiter, setReservedWordsLowerCase, setSkipOperationExample, setSkipOverwrite, setSortModelPropertiesByRequiredFlag, setSortParamsByRequiredFlag, setStrictSpecBehavior, setTemplateDir, setTemplatingEngine, setUseOneOfInterfaces, setVersionMetadataFilename, shouldAddImport, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toAllOfName, toAnyOfName, toApiImport, toApiName, toArrayModelParamName, toDefaultValue, toDefaultValueWithParam, toEnumDefaultValue, toExamples, toGetter, toInstantiationType, toMediaTypeSchemaName, toModelImport, toModelImportMap, toOneOfName, toSetter, toTestCaseName, typeMapping, unaliasPropertySchema, unaliasSchema, updateAllModels, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updateEnumVarsWithExtensions, updateModelForAnyType, updateModelForComposedSchema, updateModelForInteger, updateModelForNumber, updateModelForObject, updateModelForString, updateOption, updateParameterForString, updatePropertyForAnyType, updatePropertyForArray, updatePropertyForInteger, updatePropertyForMap, updatePropertyForMap, updatePropertyForNumber, updatePropertyForObject, updatePropertyForString, updateRequestBodyForArray, updateRequestBodyForMap, updateRequestBodyForObject, updateRequestBodyForPrimitiveType, updateRequestBodyForString, vendorExtensions, writePropertyBackclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadditionalProperties, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFilename, apiTestTemplateFiles, cliOptions, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, escapeText, escapeTextWhileAllowingNewLines, fileSuffix, fromSecurity, fromServers, fromServerVariables, generateExamplePath, generatorLanguage, generatorLanguageVersion, getAddSuffixToDuplicateOperationNicknames, getDocExtension, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHelp, getHttpUserAgent, getIgnoreFilePathOverride, getInputSpec, getLibrary, getName, getOutputDir, getReleaseNote, getTag, getTemplatingEngine, getTypeDeclaration, getUseInlineModelResolver, getUseOpenAPINormalizer, getVersionMetadataFilename, importMapping, inlineSchemaNameDefault, inlineSchemaNameMapping, instantiationTypes, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, languageSpecificPrimitives, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestTemplateFiles, openapiNormalizer, outputFolder, postProcess, postProcessParameter, postProcessSupportingFileData, processCompiler, processOpenAPI, processTemplatingEngine, reservedWords, reservedWordsMappings, sanitizeName, schemaMapping, serverVariableOverrides, setDocExtension, setEnableMinimalUpdate, setEnablePostProcessFile, setGitHost, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLibrary, setOpenAPI, setReleaseNote, setRemoveEnumValuePrefix, setRemoveOperationIdPrefix, setSkipOperationExample, setSkipOverwrite, setStrictSpecBehavior, setTemplatingEngine, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toApiImport, toApiName, toGetter, toModelImport, toModelImportMap, toSetter, typeMapping, unaliasSchema, updateAllModels, vendorExtensionsdefaultDocumentationProvider, supportedAnnotationLibraries, supportedDocumentationProviderpublic static final String OPT_TITLE
public static final String OPT_BUILD
public static final String OPT_BUILD_GRADLE
public static final String OPT_BUILD_MAVEN
public static final String OPT_BUILD_ALL
public static final String OPT_TEST
public static final String OPT_TEST_JUNIT
public static final String OPT_TEST_SPOCK
public static final String OPT_REQUIRED_PROPERTIES_IN_CONSTRUCTOR
public static final String OPT_MICRONAUT_VERSION
public static final String OPT_USE_AUTH
public static final String OPT_VISITABLE
public static final String OPT_DATE_LIBRARY_JAVA8
public static final String OPT_DATE_LIBRARY_JAVA8_LOCAL_DATETIME
public static final String OPT_DATE_FORMAT
public static final String OPT_DATETIME_FORMAT
public static final String OPT_REACTIVE
public static final String OPT_WRAP_IN_HTTP_RESPONSE
public static final String OPT_APPLICATION_NAME
public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS
public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_1
public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2
public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS_TRUE
public static final String OPT_GENERATE_SWAGGER_ANNOTATIONS_FALSE
public static final String OPT_GENERATE_OPERATION_ONLY_FOR_FIRST_TAG
protected final org.slf4j.Logger LOGGER
protected String title
protected boolean useBeanValidation
protected boolean useOptional
protected boolean visitable
protected String buildTool
protected String testTool
protected boolean requiredPropertiesInConstructor
protected String micronautVersion
protected boolean reactive
protected boolean wrapInHttpResponse
protected String appName
protected String generateSwaggerAnnotations
protected boolean generateOperationOnlyForFirstTag
protected String serializationLibrary
public static final String CONTENT_TYPE_APPLICATION_FORM_URLENCODED
public static final String CONTENT_TYPE_APPLICATION_JSON
public static final String CONTENT_TYPE_MULTIPART_FORM_DATA
public static final String CONTENT_TYPE_ANY
public static final String DATE_FORMAT
public static final String DATETIME_FORMAT
public static final String OFFSET_DATETIME_FORMAT
public void processOpts()
processOpts in interface CodegenConfigprocessOpts in class AbstractJavaCodegenpublic String apiTestFileFolder()
apiTestFileFolder in interface CodegenConfigapiTestFileFolder in class AbstractJavaCodegenpublic String modelTestFileFolder()
modelTestFileFolder in interface CodegenConfigmodelTestFileFolder in class AbstractJavaCodegenpublic String toApiTestFilename(String name)
DefaultCodegentoApiTestFilename in interface CodegenConfigtoApiTestFilename in class AbstractJavaCodegenname - the file name of the Apipublic String toModelTestFilename(String name)
DefaultCodegentoModelTestFilename in interface CodegenConfigtoModelTestFilename in class AbstractJavaCodegenname - the model namepublic void setUseBeanValidation(boolean useBeanValidation)
setUseBeanValidation in interface BeanValidationFeaturespublic void setUseOptional(boolean useOptional)
setUseOptional in interface OptionalFeaturespublic void setVisitable(boolean visitable)
public String toApiVarName(String name)
DefaultCodegentoApiVarName in interface CodegenConfigtoApiVarName in class DefaultCodegenname - the variable name of the Apipublic boolean isUseBeanValidation()
public boolean isUseOptional()
public boolean isVisitable()
public String sanitizeTag(String tag)
DefaultCodegensanitizeTag in interface CodegenConfigsanitizeTag in class AbstractJavaCodegentag - Tagpublic void addOperationToGroup(String tag, String resourcePath, io.swagger.v3.oas.models.Operation operation, CodegenOperation co, Map<String,List<CodegenOperation>> operations)
DefaultCodegenaddOperationToGroup in interface CodegenConfigaddOperationToGroup in class DefaultCodegentag - name of the tagresourcePath - path of the resourceoperation - OAS Operation objectco - Codegen Operation objectoperations - map of Codegen operationspublic OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels)
postProcessOperationsWithModels in interface CodegenConfigpostProcessOperationsWithModels in class AbstractJavaCodegenpublic CodegenModel fromModel(String name, io.swagger.v3.oas.models.media.Schema model)
DefaultCodegenfromModel in interface CodegenConfigfromModel in class AbstractJavaCodegenname - the name of the modelmodel - OAS Model objectpublic Map<String,ModelsMap> postProcessAllModels(Map<String,ModelsMap> objs)
postProcessAllModels in interface CodegenConfigpostProcessAllModels in class AbstractJavaCodegenpublic void setParameterExampleValue(CodegenParameter p)
DefaultCodegensetParameterExampleValue in class AbstractJavaCodegenp - Codegen parameterprotected String getParameterExampleValue(CodegenParameter p, boolean groovy)
protected String getPropertyExampleValue(CodegenProperty p, boolean groovy)
public String getExampleValue(String defaultValue, String example, String dataType, Boolean isModel, List<Object> allowableValues, String itemsType, String itemsExample, List<CodegenProperty> requiredVars, boolean groovy, boolean isProperty)
protected com.google.common.collect.ImmutableMap.Builder<String,com.samskivert.mustache.Mustache.Lambda> addMustacheLambdas()
DefaultCodegenaddMustacheLambdas in class DefaultCodegenpublic void setSerializationLibrary(String serializationLibrary)
Copyright © 2023. All rights reserved.