question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSON wrapper object not mapped to proper OpenAPI model

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
sakibulalamcommented, Apr 19, 2020

any progress on this issue?

1reaction
frantumacommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Jackson with JSON: Unrecognized field, not marked as ...
I keep getting this error and "wrapper" returns null . I am not sure what's missing. Can someone help please? org.codehaus.jackson.map.exc.
Read more >
Unrecognized field, not marked as ignorable - JSON Parsing ...
If you look carefully, the "person" field points to a JSON array and not an object, which means it cannot be mapped to...
Read more >
More Jackson Annotations - Baeldung
This article covers some lesser-known JSON processing annotations provided by Jackson.
Read more >
OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
When properly defined via OpenAPI, a consumer can understand and ... Models are defined using the Schema Object, which is a superset of...
Read more >
Jackson JSON Request and Response Mapping in Spring Boot
Jackson JSON ObjectMapper · Convert the incoming JSON Request Body to Java Object of your method @RequestBody argument. Generally used in POST ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found