forked from loafle/openapi-generator-original
Add schema mappings (#12600)
* add option schema mappings * add schema mapping support, update tests * minor fix * update other generators, tests
This commit is contained in:
@@ -298,6 +298,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "importMappings", property = "openapi.generator.maven.plugin.importMappings")
|
||||
private List<String> importMappings;
|
||||
|
||||
/**
|
||||
* A map of scheme and the new one
|
||||
*/
|
||||
@Parameter(name = "schemaMappings", property = "openapi.generator.maven.plugin.schemaMappings")
|
||||
private List<String> schemaMappings;
|
||||
|
||||
/**
|
||||
* A map of inline scheme names and the new names
|
||||
*/
|
||||
@@ -671,6 +677,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator);
|
||||
}
|
||||
|
||||
// Retained for backwards-compatibility with configOptions -> schema-mappings
|
||||
if (schemaMappings == null && configOptions.containsKey("schema-mappings")) {
|
||||
applySchemaMappingsKvp(configOptions.get("schema-mappings").toString(),
|
||||
configurator);
|
||||
}
|
||||
|
||||
// Retained for backwards-compatibility with configOptions -> inline-schema-name-mappings
|
||||
if (inlineSchemaNameMappings == null && configOptions.containsKey("inline-schema-name-mappings")) {
|
||||
applyInlineSchemaNameMappingsKvp(configOptions.get("inline-schema-name-mappings").toString(),
|
||||
@@ -721,6 +733,11 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
applyImportMappingsKvpList(importMappings, configurator);
|
||||
}
|
||||
|
||||
// Apply Schema Mappings
|
||||
if (schemaMappings != null && (configOptions == null || !configOptions.containsKey("schema-mappings"))) {
|
||||
applySchemaMappingsKvpList(schemaMappings, configurator);
|
||||
}
|
||||
|
||||
// Apply Inline Schema Name Mappings
|
||||
if (inlineSchemaNameMappings != null && (configOptions == null || !configOptions.containsKey("inline-schema-name-mappings"))) {
|
||||
applyInlineSchemaNameMappingsKvpList(inlineSchemaNameMappings, configurator);
|
||||
|
||||
Reference in New Issue
Block a user