Bad interaction between additionalProperties and $ref
See original GitHub issueDescription
Compiling the following spec into a TypeScript-Fetch client results in invalid code. Specifically, the generated code contains
export interface GenericMap extends null<String, number> {
}
which the TypeScript compiler rejects.
Swagger-codegen version
I tested it on swagger-codegen 2.2.1 (latest stable), 2.3.0 (7aebcfa) and master (d11d0f8).
Swagger declaration file content or url
...
definitions:
GenericMap:
additionalProperties:
type: integer
Container:
type: object
properties:
works:
type: object
additionalProperties:
type: string
breaks:
$ref: "#/definitions/GenericMap"
Command line used for generation
swagger-codegen generate -i test.yaml -l typescript-fetch
Steps to reproduce
Compile a swagger API containing the definitions mentioned above into a typescript-fetch client.
Further data
This was originally reported as https://github.com/swagger-api/swagger-codegen/issues/4839 @wing328 suggested to report the issue here as it is likely related to some problems with the resolution of the reference.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
"additionalProperties" and "allOf", here we go again!
The syntax I've been playng with is basically a "$patch" next to "$ref": ... to referenced types and preserves that relationship in the...
Read more >oneOf and anyOf validations violate additionalProperties ...
I believe I have identified an issue that causes anyOf and oneOf cases to fail due to the application of additonalProperties: false in...
Read more >Swagger Resolver error, Could not resolve reference
I'm setting up a new asp.net core 3.1 project, exposing a RESTful API in FHIR format, which is a format extending JSON. I'd...
Read more >Google Visualization API Reference | Charts
If null is specified, all additional properties of the column will be removed. ... If you want to interact with the chart, and...
Read more >CWS/7/5 Annex (in English) - WIPO
Processing of Intellectual Property Information using JSON ... It should also noted that earlier drafts of JSON schema may not be completely compatible....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Has anyone found a solution for this? I’m having the same issue with the typescript-axios vs.
Tried it on v3.0.34 and the problem still occurs