int128 / gradle-swagger-generator-plugin

Gradle plugin for OpenAPI YAML validation, code generation and API document publishing
Apache License 2.0
304 stars 66 forks source link

oneOf Polymorphism Broken #333

Open cjllanwarne opened 2 years ago

cjllanwarne commented 2 years ago

Describe the bug

To Reproduce:

Generate the oneOf example given in the openapi docs here: https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/

Expected Behavior:

The example inputs should work.

Actual Behavior:

An error is thrown in the service:

Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Could not resolve subtype of [simple type, class [...].PetsBody]: missing type id property 'type'; nested exception is com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve subtype of [simple type, class [...].PetsBody]: missing type id property 'type'<EOL> at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 4, column: 1]]

Environment

Plugin version: 2.19.2 Swagger Codegen version: 2.19.2 Gradle version: Java version: 17 OS:

ianthetechie commented 1 week ago

I just hit this as well :/