-
-
Notifications
You must be signed in to change notification settings - Fork 390
feat: add support for json:api content type #1187
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
base: main
Are you sure you want to change the base?
feat: add support for json:api content type #1187
Conversation
|
a32ed59
to
d7ae545
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the JSON:API media type by introducing a new JSON_API case to the content kind mapping.
- Introduces a JSON_API entry in the CONTENT_KIND constant.
- Adds a conditional check in getContentKind to return JSON_API for the JSON:API media type.
Files not reviewed (19)
- templates/base/http-clients/axios-http-client.ejs: Language not supported
- templates/base/http-clients/fetch-http-client.ejs: Language not supported
- templates/default/procedure-call.ejs: Language not supported
- templates/modular/procedure-call.ejs: Language not supported
- tests/snapshots/extended.test.ts.snap: Language not supported
- tests/snapshots/simple.test.ts.snap: Language not supported
- tests/spec/another-query-params/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/axios/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/axiosSingleHttpClient/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/custom-extensions/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/defaultAsSuccess/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/defaultResponse/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/deprecated/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/dot-path-params/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/enumNamesAsValues/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/enumNotFirstInComponents/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/extractRequestBody/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/extractRequestParams/snapshots/basic.test.ts.snap: Language not supported
- tests/spec/extractResponseBody/snapshots/basic.test.ts.snap: Language not supported
Comments suppressed due to low confidence (1)
src/schema-routes/schema-routes.ts:284
- Consider adding tests to validate the handling of the JSON:API content type in getContentKind.
if (contentTypes.includes("application/vnd.api+json")) {
As stated by the JSON:API specification, all JSON:API requests MUST be sent using the JSON:API media type in the
Content-Type
header (application/vnd.api+json
).Solution proposal
Add a new
JsonApi
case to theContentType
enum for JSON:API media type.When OpenApi media type matches the JSON:API media type, don’t replace it with
application/json
.Closes #1188