Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 873b768

Browse files
committed
fix(inherit): issue with property definition in arrays
1 parent 0a34742 commit 873b768

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/types/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface Draft07Definition {
1515

1616
export interface Draft07DefinitionProperty {
1717
type?: string // missing type means any
18+
items?: Draft07DefinitionProperty
1819
properties?: Record<string, Draft07DefinitionProperty>
1920
required?: string[]
2021
default?: unknown

src/utils/schema/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ export function detectSchemaVendor(schema: ContentStandardSchemaV1) {
106106
}
107107

108108
export function replaceComponentSchemas<T = Draft07Definition | Draft07DefinitionProperty>(property: T): T {
109+
if ((property as Draft07DefinitionProperty).type === 'array') {
110+
(property as Draft07DefinitionProperty).items = replaceComponentSchemas((property as Draft07DefinitionProperty).items as Draft07DefinitionProperty) as Draft07DefinitionProperty
111+
}
112+
109113
if ((property as Draft07DefinitionProperty).type !== 'object') {
110114
return property
111115
}

0 commit comments

Comments
 (0)