-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
feat: add support for json:api content type #1187
Conversation
🦋 Changeset detectedLatest commit: df005f7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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")) {
0cc2966
to
aff8c6c
Compare
Hi @smorimoto, I just realized I had forgotten to include a changeset in the PR. I’ve now added one following the bot’s guidelines. Feel free to review it and merge whenever it works best for you. Thanks again! |
Thanks a lot! |
Co-authored-by: Sora Morimoto <sora@morimoto.io>
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