Open hannojg opened 2 years ago
In my case pathParameters is empty []
because it does not contains param
or path
because it's a Dto
const pathParameters = Object.values(queryArg).filter((def) => def.origin === 'param' && def.param.in === 'path');
{
createShareDto: {
origin: 'body',
name: 'createShareDto',
originalName: 'createShareDto',
type: NodeObject {
pos: -1,
end: -1,
flags: 8,
modifierFlagsCache: 0,
transformFlags: 1,
parent: undefined,
kind: 177,
typeName: [IdentifierObject],
typeArguments: undefined
},
required: true,
body: { required: true, content: [Object] }
}
}
It seems to has been fixed. I advise to pass you json/yml file in the swagger editor in order to strongly validate your structure.
Error: path parameter organization_id does not seem to be defined in '/api/brands/{organization_id}/locations'!
{"/api/brands/{organization_id}/locations": {
"get": {
"operationId": "creator_check_in_ninja_api_brand_locations_list_locations",
"summary": "List Locations",
"parameters": [
{
"in": "query",
"name": "organization_id",
"schema": {
"format": "uuid4",
"title": "Organization Id",
"type": "string"
},
"required": true
}
],
"responses": {},
"description": "List locations of the brand.",
"tags": [
"Brand Locations"
],
"security": [
{
"JWTAuth": []
}
]
},
"post": {
"operationId": "creator_check_in_ninja_api_brand_locations_create_location",
"summary": "Create Location",
"parameters": [
{
"in": "query",
"name": "organization_id",
"schema": {
"format": "uuid4",
"title": "Organization Id",
"type": "string"
},
"required": true
}
],
"responses": {},
"description": "Create a new location for the brand. Brand manager permission level required.",
"tags": [
"Brand Locations"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BrandLocationSchemaIn"
}
}
},
"required": true
},
"security": [
{
"JWTAuth": []
}
]
}
}}
Error: path parameter organization_id does not seem to be defined in '/api/brands/{organization_id}/locations'!
{"/api/brands/{organization_id}/locations": { "get": { "operationId": "creator_check_in_ninja_api_brand_locations_list_locations", "summary": "List Locations", "parameters": [ { "in": "query", "name": "organization_id", "schema": { "format": "uuid4", "title": "Organization Id", "type": "string" }, "required": true } ], "responses": {}, "description": "List locations of the brand.", "tags": [ "Brand Locations" ], "security": [ { "JWTAuth": [] } ] }, "post": { "operationId": "creator_check_in_ninja_api_brand_locations_create_location", "summary": "Create Location", "parameters": [ { "in": "query", "name": "organization_id", "schema": { "format": "uuid4", "title": "Organization Id", "type": "string" }, "required": true } ], "responses": {}, "description": "Create a new location for the brand. Brand manager permission level required.", "tags": [ "Brand Locations" ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandLocationSchemaIn" } } }, "required": true }, "security": [ { "JWTAuth": [] } ] } }}
same error for me, have you managed to get around it?
Issue
I just tried to convert an openapi schema to RTK query, and stumbled upon the following error:
The schema is a bit weird, but unfortunately, its generation is outside of my control. Look at how the parameter
name
for delete and get is in a different case:The solution
The error happens as this comparison fails https://github.com/reduxjs/redux-toolkit/blob/2fbf0b5e8403e31209eee9801af0256bdfc78dfb/packages/rtk-query-codegen-openapi/src/generate.ts#L414
In the example of the spec above it compares
'ID' === 'id'
, which fails. However, when comparing usingname
instead oforiginalName
everything works, asname
has the parameter in the correct case.I am not sure whether using
name
fororiginalName
is legitim though.