forked from loafle/openapi-generator-original
Add model name mapping feature to C# codegen (#16209)
* add model name mapping feature to C# codegen * rename file * update samples * update doc
This commit is contained in:
@@ -177,6 +177,11 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
|
||||
*/
|
||||
val parameterNameMappings = project.objects.mapProperty<String, String>()
|
||||
|
||||
/**
|
||||
* Specifies mappings between a model name and the new name
|
||||
*/
|
||||
val modelNameMappings = project.objects.mapProperty<String, String>()
|
||||
|
||||
/**
|
||||
* Specifies mappings (rules) in OpenAPI normalizer
|
||||
*/
|
||||
|
||||
@@ -286,6 +286,13 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
@Input
|
||||
val parameterNameMappings = project.objects.mapProperty<String, String>()
|
||||
|
||||
/**
|
||||
* Specifies mappings between the model name and the new name
|
||||
*/
|
||||
@Optional
|
||||
@Input
|
||||
val modelNameMappings = project.objects.mapProperty<String, String>()
|
||||
|
||||
/**
|
||||
* Specifies mappings (rules) in OpenAPI normalizer
|
||||
*/
|
||||
@@ -833,6 +840,12 @@ open class GenerateTask @Inject constructor(private val objectFactory: ObjectFac
|
||||
}
|
||||
}
|
||||
|
||||
if (modelNameMappings.isPresent) {
|
||||
modelNameMappings.get().forEach { entry ->
|
||||
configurator.addModelNameMapping(entry.key, entry.value)
|
||||
}
|
||||
}
|
||||
|
||||
if (openapiNormalizer.isPresent) {
|
||||
openapiNormalizer.get().forEach { entry ->
|
||||
configurator.addOpenAPINormalizer(entry.key, entry.value)
|
||||
|
||||
Reference in New Issue
Block a user