swagger-api / swagger-api/swagger-codegen-generators
[SPRING] - $ref is location dependent?
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
Should the location of the $ref affect the behavior of building classes?
In this first case, the class TransactionRequestSale extends TransactionRequest (as you would expect). The fields Amount and Type are created with getters/setters
TransactionRequestSale:
description: A Sale request.
allOf:
- $ref: '#/components/schemas/TransactionRequest'
- type: object
properties:
Type:
type: string
Amount:
type: integer
but if the $ref is after the type, then TransactionRequest is used instead of the object, rather than extending the class. (ie the TransactionRequestSale class is created, but rather than the Amount and Type fields, it uses the fields from TransactionRequest)
TransactionRequestSale:
description: A Sale request.
allOf:
- type: object
properties:
Type:
type: string
Amount:
type: integer`
- $ref: '#/components/schemas/TransactionRequest
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
The issue names no source files, tests, or entry points; begin by locating the Spring generator handling OpenAPI allOf schemas and reproduce both $ref orderings from the examples. Done means both forms generate TransactionRequestSale with the inherited TransactionRequest members plus the Amount and Type fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- spring
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100