Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript generator assumes all responses are JSON #167

Closed
ColinEberhardt opened this issue Feb 10, 2023 · 2 comments
Closed

TypeScript generator assumes all responses are JSON #167

ColinEberhardt opened this issue Feb 10, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ColinEberhardt
Copy link
Collaborator

See: https://github.com/ScottLogic/openapi-forge-typescript/blob/main/template/fetch.ts#L8

This is probably true for the JS generator also

@ColinEberhardt ColinEberhardt added TypeScript bug Something isn't working labels Feb 10, 2023
@ColinEberhardt
Copy link
Collaborator Author

Looking at the spec, despite the media type specifying application/json, primitive values are indeed acceptable https://swagger.io/specification/#schema-object

@ColinEberhardt
Copy link
Collaborator Author

After further exploration, this is not a bug. Strings, when returned from the API, should be quoted, making them valid JSON. For example "hello" is valid JSON.

The Petstore example API server has a bug relating to this. I've raised a PR:

swagger-api/swagger-petstore#95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant