-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
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:
- 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
...
will generate the output
export const PetFindByStatus = {
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"],
},
},
],
...
} as const;
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
...
parameters: {
headers: {...},
path: {...},
query: {...},
cookies: {...}
required: [...],
type: 'object'
}
}
...
Metadata
Metadata
Assignees
Labels
No labels