OpenAPITools / OpenAPITools/openapi-generator

[BUG] Code gen for inline response schemata

Open
#9,947 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

The swagger docs mention being able to Describing Responses inline .. https://swagger.io/docs/specification/describing-responses/ (ie no refs).

However when I tried this then the spring code gen created no model objects to represent the return value.
It does create an api/ dir but the the apis all ended up as returning "ResponseEntity" and the annotation on the interface are all Object.class.

Is it a fact that the code gen tooling does not support inline response schemata and I must always place this in the components/* section and use ref ?

I'm reporting as a I was expecting this to do something useful which at present it does not.

I will give more of a workup if someone thinks this ought to work.

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 linked Swagger documentation and create a minimal Spring code-generation case using an inline response schema. Inspect the generated api/ interfaces, ResponseEntity return types, and Object.class annotations, then compare them with generation from a referenced component schema. Done means determining whether inline response schemas should produce concrete model and return types, with a reproducible result.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.