You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using this toolkit to generate TS JSON schemas returns the path parameters as an array instead of objects for each path.
For example, the yaml file below
...
paths:
/pet/findByStatus:
get:
tags:
- petsummary: Finds Pets by statusdescription: Multiple status values can be provided with comma separated stringsoperationId: findPetsByStatusparameters:
- name: statusin: querydescription: Status values that need to be considered for filterrequired: falseexplode: trueschema:
type: stringdefault: availableenum:
- available
- pending
- sold
...
will generate the output
exportconstPetFindByStatus={get: {tags: ["pet"],summary: "Finds Pets by status",description:
"Multiple status values can be provided with comma separated strings",operationId: "findPetsByStatus",parameters: [{name: "status",in: "query",description: "Status values that need to be considered for filter",required: false,explode: true,schema: {type: "string",default: "available",enum: ["available","pending","sold"],},},],
...
}asconst;
This means the output cannot be used directly in fastify schemas without writing some scripts to extract headers/path/query/cookies based on the open API standard describing parameters
Instead of an array, parameters should return an object in the format
I think this is related to issues discussed in #305 and #318.
FWIW, my solution to this is to write query, header, etc., parameters in schemas then $ref the schemas in paths and pass them to query, etc., in Fastify. For example:
components:
schemas:
ExampleQuery:
description: I can provide a detailed description that shows up in Redocly-generated docs.type: objectrequired:
- param1properties:
param1:
# parameter detailsparam2:
# parameter detailsparameters:
ExampleQueryParameter:
name: exampleQueryin: queryschema:
$ref: '#/components/schemas/ExampleQuery'ExampleHeaderParameter:
in: header# etc.paths:
get:
parameters:
- $ref: '#components/parameters/ExampleQueryParameter - $ref: '#/components/parameters/ExampleHeaderParameter# etc.
// in Fastify schema
parameters: {query: ExampleQuery,headers: ExampleHeader,// etc.}
I haven't used this approach with cookies, but it works for header, path, and query parameters.
Using this toolkit to generate TS JSON schemas returns the path parameters as an array instead of objects for each path.
For example, the yaml file below
will generate the output
This means the output cannot be used directly in fastify schemas without writing some scripts to extract headers/path/query/cookies based on the open API standard describing parameters
Instead of an array, parameters should return an object in the format
The text was updated successfully, but these errors were encountered: