-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Originally the additionalProperties: true would generate a Dictionary parameter for the method signature. Since v7.16.0 it now just generates a generic object parameter.
openapi-generator version
v7.16.0 and up
OpenAPI declaration file content or url
"/api/v1/example": {
"put": {
"operationId": "PutExample",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"examples": [
{
"example_key1": "value1",
"example_key2": true
}
],
"additionalProperties": true
}
}
}
},
"responses": {
"201": {
"description": "Success (Created)"
},
"default": {
"$ref": "#/components/responses/ErrorResponse"
}
}
}
}Generation Details
Command line:
java -jar openapi-generator-cli.jar generate -i swagger.json -g aspnetcore -o ./out -c generator.config.json
generator.config.json:
{
"additionalProperties" : {
"generateBody": false,
"classModifier": "abstract",
"nullableReferenceTypes": true,
"operationResultTask": true,
"aspnetCoreVersion": "8.0",
"buildTarget": "library",
"isLibrary": true,
"useSwashbuckle": false
}
}Steps to reproduce
Using the openapi file + config listed above, the following method signature is generated on 7.16.0 and later:
[HttpPut]
[Route("/api/v1/example")]
[Consumes("application/json")]
[ValidateModelState]
[ProducesResponseType(statusCode: 0, type: typeof(Error))]
public abstract Task<IActionResult> PutExample([FromBody] object body);The "addtionalproperties": true is supposed to generate a Dictionary parameter as was the case in 7.15 and earlier.
[HttpPut]
[Route("/api/v1/example")]
[Consumes("application/json")]
[ValidateModelState]
[ProducesResponseType(statusCode: 0, type: typeof(Error))]
public abstract Task<IActionResult> PutExample([FromBody]Dictionary<string, Object> requestBody);Related issues/PRs
Potentially related?: