We are working on a backend with Fastify, declaring schemas with Typebox and generating OpenApi definitions with Fastify Swagger
We are facing some problems with enums or similar during docs generation
Let’s say we declare a typebox enumerator in one of the following ways
export const ProviderType = Type.Union([
Type.Literal("sms"),
Type.Literal("email"),
]);
//OR
enum Providers {
SMS = "sms",
EMAIL = "email",
}
export const ProviderType = Type.Enum(Providers);
When the open api docs are generated we get this
- schema:
anyOf:
- type: string
enum:
- sms
- type: string
enum:
- email
That is not what we expect, but something like
schema:
type: string
enum: [sms, email]
Otherwise, the places where the enum is used are not correctly rendered by the various packages.
Did you already face this problem?