diff --git a/index.d.ts b/index.d.ts index a48a2ba6..cdf4665d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -34,13 +34,13 @@ declare module 'fastify' { interface FastifySchema { hide?: boolean; deprecated?: boolean; - tags?: string[]; + tags?: readonly string[]; description?: string; summary?: string; - consumes?: string[]; - produces?: string[]; + consumes?: readonly string[]; + produces?: readonly string[]; externalDocs?: OpenAPIV2.ExternalDocumentationObject | OpenAPIV3.ExternalDocumentationObject; - security?: Array<{ [securityLabel: string]: string[] }>; + security?: ReadonlyArray<{ [securityLabel: string]: readonly string[] }>; /** * OpenAPI operation unique identifier */ diff --git a/test/types/types.test.ts b/test/types/types.test.ts index 25c2a82c..67cf4a03 100644 --- a/test/types/types.test.ts +++ b/test/types/types.test.ts @@ -111,6 +111,19 @@ app.get('/public/route', { } }, (req, reply) => {}); +app.get('/public/readonly-schema-route', { + schema: { + description: 'returns 200 OK', + tags: ['foo'], + summary: 'qwerty', + security: [], + response: { 200: {} } + }, + links: { + 200: {'some-route': { operationId: 'opeId'}} + } + } as const, (req, reply) => {}); + app .register(fastifySwagger, { swagger: {