OpenAPITools / OpenAPITools/openapi-generator
[REQ] Support reconstitute.js
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
When an API is generated using Swashbuckle.AspNetCore.Swagger 6.3.0 with the default JSON serializer, you have the option to support circular references by adding this configuration to the code:
services.AddJsonOptions(c => {
c.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.Preserve;
});
This will generate JSON output that contains extra parameters $id, $ref, and $values to help with circular references. These fields break the javascript JSON parser generated with openapi-generator. For example:
[
{
'$id': '1',
locationId: 1,
tenantId: 1,
tenant: null,
buildings: { '$id': '2', '$values': [Array] },
}
]
(The buildings member is a simple array, but it has $id and $values in the raw data).
Describe the solution you'd like
It would be nice to have an option to enable this feature, so the parser can handle these APIs.
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 by reproducing the generated JavaScript parser failure with the Swashbuckle.AspNetCore.Swagger 6.3.0 JSON containing $id, $ref, and $values. Trace the openapi-generator JavaScript output and identify how an opt-in setting should represent these fields; done means generated clients can parse the circular-reference response without breaking existing JSON behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100