swagger-api / swagger-api/swagger-core
java.lang.Object converted to json object (map) type
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
Duplicate of issue: https://github.com/swagger-api/swagger-core/issues/3834, which was closed without proper resolution.
The issue referenced, still exists with version 2.2.32:
The actual behavior:
- Swagger model converter maps
java.lang.Objecttotype: objectpublic class Foo { private Object bar; public static void main(String[] args) throws Exception { ResolvedSchema schema = ModelConverters.getInstance() .resolveAsResolvedSchema( new AnnotatedType(Foo.class)); String value = Json.mapper().writerWithDefaultPrettyPrinter().writeValueAsString(schema.schema); System.out.println(value); } }prints:
{ "type" : "object" }
I used the version 2.2.32 and still got same result.
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 with the Foo reproduction using ModelConverters.getInstance().resolveAsResolvedSchema(new AnnotatedType(Foo.class)) and inspect the generated schema through Json.mapper(). Check the existing issue 3834 for prior context, then identify the converter behavior and add or update coverage for java.lang.Object. Done means the schema output matches the intended OpenAPI representation rather than the reported result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100