Skip to content

Commit

Permalink
fix(schema): option for page schema exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
julrich committed Sep 24, 2024
1 parent d9aff4f commit 38509dd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/commands/schema/dereference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const dereference = new Command('dereference')
chalkTemplate`relative path from project root to your cms specific components directory, default {bold ./src/components}`
)
.option(
'--load-page-schema',
chalkTemplate`load default page schema, default {bold true}`
'--no-default-page-schema',
chalkTemplate`disable load of default page schema, default {bold false}`
)
.option(
'--rc-only',
Expand All @@ -35,7 +35,7 @@ const dereference = new Command('dereference')
runTask(
options.componentsPath,
options.cmsPath,
options.loadPageSchema,
options.defaultPageSchema,
options.rcOnly,
options.revert,
options.cleanup,
Expand Down
4 changes: 2 additions & 2 deletions src/tasks/schema/dereference-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const {
const run = async (
componentsPath: string = 'src/components',
cmsPath: string,
loadPageSchema: boolean = true,
defaultPageSchema: boolean = true,
rcOnly: boolean,
isRevert: boolean,
shouldCleanup: boolean,
Expand All @@ -57,7 +57,7 @@ const run = async (
globs.push(`${callingPath}/${cmsPath}/**/*.schema.json`);
}
const customSchemaPaths = await fg(globs);
const dereffed = await schemaDereferenceSchemas(globs, loadPageSchema);
const dereffed = await schemaDereferenceSchemas(globs, defaultPageSchema);

logger.info(
chalkTemplate`dereffed {bold ${
Expand Down
4 changes: 2 additions & 2 deletions src/util/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export default (logger: winston.Logger): SchemaUtil => {

const dereferenceSchemas = async (
schemaGlobs: string[],
loadPageSchema = true
defaultPageSchema = true
) => {
const ajv = getSchemaRegistry();
const schemaIds = await processSchemaGlobs(schemaGlobs, ajv, {
loadPageSchema,
loadPageSchema: defaultPageSchema,
});
const customSchemaIds = getCustomSchemaIds(schemaIds);

Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ interface SchemaUtil {
) => Promise<Record<string, string>>;
dereferenceSchemas: (
schemaGlobs: string[],
loadPageSchema: boolean
defaultPageSchema: boolean
) => Promise<Record<string, JSONSchema.Interface>>;
toStoryblok: (
schemaGlobs: string[],
Expand Down

0 comments on commit 38509dd

Please sign in to comment.