swagger-api / swagger-api/swagger-codegen

How to deal with 'Any' type object. swagger generated code has issues while parsing POST request with content in 'Any{}' type body

Open
#10,117 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

[JAVA] Bug generating generic type object. it is defined as Any{} in open api sepc.

I generated a spring boot server using a TMF open api spec. There is a section where a gnereic type of object can be sent, it is defined as Any{} dataType . The Codegen for this has some missing annotations I believe. The Json body sent in a post request is not being mapped on to it. Can you please tell what sort of custom deserializer works good for a generic object type.

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TMF OpenAPI specification and the generated Spring Boot server, focusing on the POST request body defined as Any{} and how its JSON is mapped. Compare the generated model and endpoint handling to identify the missing annotations or deserialization behavior; done means the generic JSON body is correctly mapped in the generated server.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.