swagger-api / swagger-api/swagger-codegen
No Type defined for Additional Property class Schema
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The type "ProblemDetails" is missing from the generated code: the generate command outputs an error 08:21:14.615 [Thread-1] ERROR i.s.c.v.g.DefaultCodegenConfig - No Type defined for Additional Property class Schema and the struct ProblemDetails is not generated.
Thus, the generated code does not compile because, instead of using the type ProblemDetails, the code is using var v map[string]Object (which is undeclared).
The type ProblemDetails is automatically generated by swagger from an ASP.NET API with the following property: "additionalProperties": {}.
When updating the json to "additionalProperties": false, the problem is solved and the ProblemDetails type is correctly generated.
Is there a config or an option to fix this? Updating the json manually is not convenient
Swagger-codegen version
Docker image swaggerapi/swagger-codegen-cli-v3
Swagger declaration file content or url
https://gist.github.com/arnaud-tincelin/ac345ad7942ca81ce674c45a91ed6419
Command line used for generation
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3 generate -i https://gist.githubusercontent.com/arnaud-tincelin/ac345ad7942ca81ce674c45a91ed6419/raw/c0e105cd688c97d8c02851d9e866a6dc8b9169a4/json -l go -o /local/pkg/swagger
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the docker generate command with the linked gist and inspect how the Go generator handles "additionalProperties": {}. Done means the generated ProblemDetails type is present and the output compiles without the undeclared Object map type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, openapi
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100