Skip to content

Commit 24ea3e6

Browse files
authored
Merge pull request #317 from yassinrais/main
feat: prioritize vendor schema mapping over standard fallback
2 parents 71afc31 + 70d31cd commit 24ea3e6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/openapi.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,19 +531,19 @@ export const unwrapSchema = (
531531
const vendor = schema['~standard'].vendor
532532

533533
try {
534-
// @ts-ignore
535-
if (schema['~standard']?.jsonSchema?.[io])
536-
// @ts-ignore
537-
return schema['~standard']?.jsonSchema?.[io]?.({
538-
target: "draft-2020-12"
539-
})
540-
541534
if (
542535
mapJsonSchema?.[vendor] &&
543536
typeof mapJsonSchema[vendor] === 'function'
544537
)
545538
return enumToOpenApi(mapJsonSchema[vendor](schema))
546539

540+
// @ts-ignore
541+
if (schema['~standard']?.jsonSchema?.[io])
542+
// @ts-ignore
543+
return enumToOpenApi(schema['~standard'].jsonSchema[io]({
544+
target: 'draft-2020-12'
545+
}))
546+
547547
switch (vendor) {
548548
case 'zod':
549549
if (warned.zod4 || warned.zod3) break

0 commit comments

Comments
 (0)