reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.64k stars 1.15k forks source link

@rtk-query/codegen ignores application/vnd.api+json content #3721

Open Onurfesci opened 12 months ago

Onurfesci commented 12 months ago

If I have a JSON:API OpenAPI spec that has application/vnd.api+json content type in the response, it is ignored by the codegen and the resulting response type is unknown.

For example:

"200" : {
  "content" : {
    "application/vnd.api+json" : {
      "schema" : {
        "$ref" : "#/components/schemas/UserProfile"
      }
    }
  },
  "description" : "Result of performing a successful operation"
},

results in:

export type GetUserProfileApiResponse = unknown;

Could application/vnd.api+json be parsed as a valid content type?

Onurfesci commented 12 months ago

Dug through the code and seems that adding 'application/vnd.api+json' to contentTypes in

@rtk-query/oazapfts-patched -> src -> codegen -> generate.ts

would solve this.