Prerequisites
🚀 Feature Proposal
I would like to define my typebox schema and have it so fastify both understands this schema and this library can produce valid openapi json schema.
A key requirement to clean openapi json schema is the ability to define our models and reference them throughout the specification.
For example I have:
export const RefreshResponseApiModelSchema = Type.Object(
{
accessToken: Type.String(),
refreshToken: Type.String(),
},
{ $id: 'RefreshResponseApiModel' },
);
export type RefreshResponseApiModel = Static<typeof RefreshResponseApiModelSchema>;
and have tried to register these with fastify during initialisation:
export function addSchemas(app: FastifyInstance) {
// other schema
app.addSchema(RefreshResponseApiModelSchema);
}
They add correctly but the resulting documentation is not correct, I can see the schema is added as below and never referenced by the methods that use these schema:
"def-3": {
"type": "object",
"properties": {
"accessToken": {
"type": "string"
},
"refreshToken": {
"type": "string"
}
},
"required": [
"accessToken",
"refreshToken"
],
"title": "RefreshResponseApiModel"
}
I've read through the docs and tickets but can't see this expressed anywhere.
Motivation
To have an openapi documentation with generated schema that can be used by other tools e.g. codegen to generate correct model types with proper naming.
Example
No response
Prerequisites
🚀 Feature Proposal
I would like to define my typebox schema and have it so fastify both understands this schema and this library can produce valid openapi json schema.
A key requirement to clean openapi json schema is the ability to define our models and reference them throughout the specification.
For example I have:
and have tried to register these with fastify during initialisation:
They add correctly but the resulting documentation is not correct, I can see the schema is added as below and never referenced by the methods that use these schema:
I've read through the docs and tickets but can't see this expressed anywhere.
Motivation
To have an openapi documentation with generated schema that can be used by other tools e.g. codegen to generate correct model types with proper naming.
Example
No response