Skip to content

Commit c4cbb92

Browse files
committed
fix: move processing of cms hidden fields
1 parent e49d092 commit c4cbb92

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@kickstartds/jsonschema-utils",
5+
"comment": "move hiding of cms fields in processing",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@kickstartds/jsonschema-utils"
10+
}

tools/jsonschema-utils/src/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,6 @@ export async function processSchemas(
702702
if (shouldInlineReferences) inlineReferences(sortedSchemas, typeResolution);
703703
if (additionalProperties && additionalProperties !== 'keep')
704704
processAdditionalProperties(sortedSchemas, additionalProperties);
705-
if (shouldHideCmsFields) hideCmsFields(sortedSchemas);
706705

707706
// 2. add all schemas to ajv for the following processing steps
708707
sortedSchemas.forEach((schema) => {
@@ -722,12 +721,13 @@ export async function processSchemas(
722721
});
723722

724723
// 4. process new schemas, resulting from adding the distinct
725-
// `anyOf`s in the step before
724+
// `anyOf`s in the step before, hide CMS fields marked as hidden
726725
if (typeResolution) addTypeInterfaces(schemaAnyOfs);
727726
if (shouldAddExlicitAnyOfs && shouldMergeAllOf)
728727
schemaAnyOfs.forEach((schemaAnyOf) => {
729728
reduceSchemaAllOfs(schemaAnyOf, ajv, shouldReplaceExamples);
730729
});
730+
if (shouldHideCmsFields) hideCmsFields(sortedSchemas);
731731

732732
// 5. return list of processed schema `$id`s.
733733
// Accessing the full schemas works through `ajv`

0 commit comments

Comments
 (0)