Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON wrapper object not mapped to proper OpenAPI model #2884

Open
lwielek opened this issue Jul 20, 2018 · 7 comments
Open

JSON wrapper object not mapped to proper OpenAPI model #2884

lwielek opened this issue Jul 20, 2018 · 7 comments

Comments

@lwielek
Copy link

lwielek commented Jul 20, 2018

When a class is annotated with

@com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.WRAPPER_OBJECT)

it is being serialized as an object, rather than a simple string.
The OpenAPI model for such a class is represented as a simple value.

See example attached to issue #2862.

Serialized:

{"ExampleSubType":"VALUE1"}

Model:

Example:
  type: object
ExampleSubType:
  type: string
  allOf:
  - $ref: '#/components/schemas/Example'
  enum:
  - VALUE1
  - VALUE2
@jbraga
Copy link

jbraga commented Aug 15, 2019

I need this too :(
@lwielek, have you found a workaround?

@lwielek
Copy link
Author

lwielek commented Aug 19, 2019

@jbraga
no, my workaround was not to use wrapper object annotations ...

@sakibulalam
Copy link

any progress on this issue?

@matejuh
Copy link

matejuh commented Mar 4, 2021

This is quite painful bug which blogs us to use specification generated from code. This test:

is invalid.
It should be: employee.getProperties().get("employee").getProperties();

@dazraf
Copy link

dazraf commented Apr 8, 2021

Is there anyone reading this, or has development on swagger stopped?

@frantuma
Copy link
Member

frantuma commented Apr 9, 2021

@dazraf there is indeed somebody reading, and nope, development has not stopped; as always contributions are more than welcome though..

That said a partial implementation has been implemented in #3921, available in latest snapshot and next release.

@dazraf
Copy link

dazraf commented Jun 3, 2021

Thank you @frantuma!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants