Skip to content

Commit dd054ea

Browse files
committed
fix: extend inherited schema
1 parent c5603fa commit dd054ea

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"micromatch": "^4.0.8",
8787
"minimark": "^0.2.0",
8888
"minimatch": "^10.0.3",
89-
"nuxt-component-meta": "https://pkg.pr.new/nuxt-component-meta@6b22580",
89+
"nuxt-component-meta": "https://pkg.pr.new/nuxt-component-meta@e3eb2c4",
9090
"nypm": "^0.6.1",
9191
"ohash": "^2.0.11",
9292
"pathe": "^2.0.3",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/schema/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,19 @@ export function replaceComponentSchemas<T = Draft07Definition | Draft07Definitio
127127
}
128128

129129
const meta = getComponentMeta(path, { rootDir: nuxt.options.rootDir, cache: true })
130-
return propsToJsonSchema(meta.props) as T
130+
const schema = propsToJsonSchema(meta.props) as T
131+
132+
return {
133+
...schema,
134+
required: [...((schema as Draft07DefinitionProperty).required || []), ...(property as Draft07DefinitionProperty).required || []],
135+
properties: {
136+
...(schema as Draft07DefinitionProperty).properties,
137+
...(property as Draft07DefinitionProperty).properties,
138+
},
139+
additionalProperties: (schema as Draft07DefinitionProperty).additionalProperties
140+
|| (property as Draft07DefinitionProperty).additionalProperties
141+
|| false,
142+
}
131143
}
132144

133145
// Look for `$content.inherit` properties in nested objects

0 commit comments

Comments
 (0)