forked from loafle/openapi-generator-original
Add OpenAPI Normalizer (#14172)
* add x-parent support * add docstring * add openapi normalizer rule to use ref as parent in allof * add openapi normalizer with 1 rule * revise wordings * fix javadoc warnings * better test * fix docstring * minor update * minor improvements * fix typo
This commit is contained in:
@@ -315,6 +315,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "inlineSchemaNameDefaults", property = "openapi.generator.maven.plugin.inlineSchemaNameDefaults")
|
||||
private List<String> inlineSchemaNameDefaults;
|
||||
|
||||
/**
|
||||
* A set of rules for OpenAPI normalizer
|
||||
*/
|
||||
@Parameter(name = "openapiNormalizer", property = "openapi.generator.maven.plugin.openapiNormalizer")
|
||||
private List<String> openapiNormalizer;
|
||||
|
||||
/**
|
||||
* A map of swagger spec types and the generated code types to use for them
|
||||
*/
|
||||
@@ -700,6 +706,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator);
|
||||
}
|
||||
|
||||
// Retained for backwards-compatibility with configOptions -> openapi-normalizer
|
||||
if (openapiNormalizer == null && configOptions.containsKey("openapi-normalizer")) {
|
||||
applyOpenAPINormalizerKvp(configOptions.get("openapi-normalizer").toString(),
|
||||
configurator);
|
||||
}
|
||||
|
||||
// Retained for backwards-compatibility with configOptions -> type-mappings
|
||||
if (typeMappings == null && configOptions.containsKey("type-mappings")) {
|
||||
applyTypeMappingsKvp(configOptions.get("type-mappings").toString(), configurator);
|
||||
@@ -753,6 +765,11 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
applyInlineSchemaNameDefaultsKvpList(inlineSchemaNameDefaults, configurator);
|
||||
}
|
||||
|
||||
// Apply OpenAPI normalizer rules
|
||||
if (openapiNormalizer != null && (configOptions == null || !configOptions.containsKey("openapi-normalizer"))) {
|
||||
applyOpenAPINormalizerKvpList(openapiNormalizer, configurator);
|
||||
}
|
||||
|
||||
// Apply Type Mappings
|
||||
if (typeMappings != null && (configOptions == null || !configOptions.containsKey("type-mappings"))) {
|
||||
applyTypeMappingsKvpList(typeMappings, configurator);
|
||||
|
||||
Reference in New Issue
Block a user