mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-21 09:57:10 +00:00
Add new option to customize inline model naming convention (#12562)
* temp fix
* add support to customize inline schema naming convention
* Revert "temp fix"
This reverts commit e3bca56bfb.
* minor fix, add tests
* update description
This commit is contained in:
@@ -304,6 +304,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "inlineSchemaNameMappings", property = "openapi.generator.maven.plugin.inlineSchemaNameMappings")
|
||||
private List<String> inlineSchemaNameMappings;
|
||||
|
||||
/**
|
||||
* A map of inline scheme naming convention and the value
|
||||
*/
|
||||
@Parameter(name = "inlineSchemaNameDefaults", property = "openapi.generator.maven.plugin.inlineSchemaNameDefaults")
|
||||
private List<String> inlineSchemaNameDefaults;
|
||||
|
||||
/**
|
||||
* A map of swagger spec types and the generated code types to use for them
|
||||
*/
|
||||
@@ -666,11 +672,17 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
}
|
||||
|
||||
// Retained for backwards-compatibility with configOptions -> inline-schema-name-mappings
|
||||
if (importMappings == null && configOptions.containsKey("inline-schema-name-mappings")) {
|
||||
if (inlineSchemaNameMappings == null && configOptions.containsKey("inline-schema-name-mappings")) {
|
||||
applyInlineSchemaNameMappingsKvp(configOptions.get("inline-schema-name-mappings").toString(),
|
||||
configurator);
|
||||
}
|
||||
|
||||
// Retained for backwards-compatibility with configOptions -> inline-schema-name-defaults
|
||||
if (inlineSchemaNameDefaults == null && configOptions.containsKey("inline-schema-name-defaults")) {
|
||||
applyInlineSchemaNameDefaultsKvp(configOptions.get("inline-schema-name-defaults").toString(),
|
||||
configurator);
|
||||
}
|
||||
|
||||
// Retained for backwards-compatibility with configOptions -> type-mappings
|
||||
if (typeMappings == null && configOptions.containsKey("type-mappings")) {
|
||||
applyTypeMappingsKvp(configOptions.get("type-mappings").toString(), configurator);
|
||||
@@ -714,6 +726,11 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
applyInlineSchemaNameMappingsKvpList(inlineSchemaNameMappings, configurator);
|
||||
}
|
||||
|
||||
// Apply Inline Schema Name Defaults
|
||||
if (inlineSchemaNameDefaults != null && (configOptions == null || !configOptions.containsKey("inline-schema-name-defaults"))) {
|
||||
applyInlineSchemaNameDefaultsKvpList(inlineSchemaNameDefaults, configurator);
|
||||
}
|
||||
|
||||
// Apply Type Mappings
|
||||
if (typeMappings != null && (configOptions == null || !configOptions.containsKey("type-mappings"))) {
|
||||
applyTypeMappingsKvpList(typeMappings, configurator);
|
||||
|
||||
Reference in New Issue
Block a user