Open perhallgren opened 1 day ago
{"obj":"A"}
But it produces
{"obj":{"Int32":null,"String":"A"}}
When an anyOf model is a required property, JSON marshalling is incorrect.
anyOf
docker run --rm openapitools/openapi-generator-cli:latest version 7.10.0-SNAPSHOT
openapi: 3.0.0 info: version: 1.0.0 title: FooBar Service paths: {} components: schemas: Bad: type: object description: bad required: - obj properties: obj: $ref: '#/components/schemas/Obj' Obj: anyOf: - type: string - type: integer example: a description: obj
I'm running
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:latest generate \ --input-spec /local/go-json-marshal.yaml \ --generator-name go \ --additional-properties "withGoMod=false" \ --package-name gen \ --output /local/gen
Run this gist
Looks like the same issue: https://github.com/OpenAPITools/openapi-generator/issues/14028
Bug Report Checklist
But it produces
Description
When an
anyOf
model is a required property, JSON marshalling is incorrect.openapi-generator version
OpenAPI declaration file content or url
Generation Details
I'm running
Steps to reproduce
Run this gist
Related issues/PRs
Suggest a fix