Skip to content

Commit

Permalink
feat(ts): support readonly schema (#730)
Browse files Browse the repository at this point in the history
* feat(ts): suppoert readonly schema

* tests(tsd): add readonly route schema tests
  • Loading branch information
SkeLLLa authored Jun 18, 2023
1 parent 3618eb0 commit 75761d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
13 changes: 13 additions & 0 deletions test/types/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 75761d5

Please sign in to comment.