New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
partial typebox schema missmatch #1613
Comments
Thanks for reporting! Any chance you can share the OpenAPI specification that is generated? That would make it so much easier to reproduce and fix the issue. 🙏 |
I hope u are asking about this. If not, correct me pls. I will provide exactly what u want to get. But as u can see its not the problem of scalar visualisation of docs. Its the problem of openAPI. The first screenshot is schema. The second one is Example Value. My codeconst ScheduleSchema = t.Object({
start_date: t.String({ pattern: '^\\d{4}-\\d{2}-\\d{2}$' }),
end_date: t.Optional(t.String({ pattern: '^\\d{4}-\\d{2}-\\d{2}$' })),
repeat: t.Partial(
t.Object({
repeatDays: t.Array(t.Number({ integer: true, minimum: 1, maximum: 7 },), {minItems: 1, maxItems: 7, description: 'all numbers should be Ascending order cause it can influnce on repeat_at time'}),
daysHash: t.String({format: 'hex', pattern: '^[0-9a-f]{1,2}$'}),
repeat_at: t.Array(t.Array(t.Array(t.String({format: 'time'}))), {minItems: 1, maxItems: 7}),
price: t.Array(t.Array(t.Integer({minimum: 0, maximum: 9999999})), {minItems: 1, maxItems: 7})
}),
t.Array(
t.Object({
start_time: t.String({ pattern: '^\\d{2}:\\d{2}:\\d{2}$' }),
end_time: t.Optional(t.String({ pattern: '^\\d{2}:\\d{2}:\\d{2}$' })),
price: t.Number({ integer: true, minimum: 0, maximum: 9999999 }),
discount: t.Union([
t.Object({
discount: t.Number({ integer: true, minimum: 0, maximum: 100 }),
type: t.String({pattern: '^persent$', default: 0, description: 'some int as persent discount'})
}),
t.Object({
discount: t.Number({ integer: true, minimum: 0, maximum: 9999999 }),
type: t.String({pattern: '^price$', default: 0, description: 'some int as price discount'})
}),
])
})
)
),
});
export const ActivityParamsSchema = t.Object({
...
schedule: t.Array(ScheduleSchema, {description: 'can contain as schedule as time_slots at same time'}),
...
}); |
I delete all other endpoints for security reasons. |
What happens?
screenShot of the problem
repeat
is a part ofScheduleSchema
value andScheduleSchema
is a part ofschedule: t.Array(ScheduleSchema)
Got missmatch schema. Partial doesnt work ? something very strange i see in documentation. But in code snippets with request there is values that user can take.
I dont see
daysHash
,repeat_at
,price
values from the first partial part.And i dont see any of the values from the second possible partial part.
What did you expect to happen?
Would like to see some values here
How can we reproduce the issue?
schema above
Swagger/OpenAPI Example
No response
The text was updated successfully, but these errors were encountered: