Arr description missing from generated schema
kristeaac opened this issue · 1 comments
kristeaac commented
The description I'm defining for an Arr is missing from the generated schema.
I'm defining my request body like this:
static schema = {
operationId: `make-${ShutTheBoxGame.id}-move`,
tags: TAGS,
summary: 'Make a move in a game of Shut The Box.',
parameters: IdParams,
requestBody: {
gameId: new Uuid({
description: 'The ID of the game.',
required: true,
}),
numbersToFlip: new Arr(
new Num(),
{
description: 'An array of numbers the player wants to put down. Not required for a new game. If specified, gameId must be specified as well.',
required: true,
}),
},
responses: Responses,
}
Note the description
defined for numbersToFlip
above in the params. This does not appear in the resulting schema:
{
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"gameId": {
"type": "string",
"description": "The ID of the game.",
"format": "uuid",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
},
"numbersToFlip": {
"type": "array",
"items": {
"type": "number"
}
}
},
"required": [
"gameId",
"numbersToFlip"
]
}
}
}
}
Is this expected behavior? Am I defining the description correctly? If I'm reading the source right, perhaps getValue
in the Arr
class needs to merge in the value from its parent BaseParameters
? https://github.com/cloudflare/itty-router-openapi/blob/main/src/parameters.ts#L72