Skip to content

Commit 0683043

Browse files
Add flag to output field security metadata
Use the includeFieldSecurityMetadata to cause the field output to show both the compliance category and security classification metadata if set to true.
1 parent ffbb3eb commit 0683043

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

src/cli/commands/markdown.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,9 @@ export const markdownOptions: Record<keyof CliConfigurableMarkdownConfig, Option
7272
describe: 'The title of the reference guide.',
7373
default: markdownDefaults.referenceGuideTitle,
7474
},
75+
includeFieldSecurityMetadata: {
76+
type: 'boolean',
77+
describe: 'Whether to include the compliance category and security classification for fields in the generated files.',
78+
default: markdownDefaults.includeFieldSecurityMetadata,
79+
}
7580
};

src/core/markdown/__test__/test-helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export function generateDocs(bundles: UnparsedSourceBundle[], config?: Partial<M
5656
linkingStrategy: 'relative',
5757
excludeTags: [],
5858
referenceGuideTitle: 'Apex Reference Guide',
59+
includeFieldSecurityMetadata: true,
5960
exclude: [],
6061
...config,
6162
});

src/core/markdown/adapters/__tests__/interface-adapter.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const defaultMarkdownGeneratorConfig: MarkdownGeneratorConfig = {
2020
sortAlphabetically: false,
2121
linkingStrategy: 'relative',
2222
referenceGuideTitle: 'Apex Reference Guide',
23+
includeFieldSecurityMetadata: true,
2324
exclude: [],
2425
excludeTags: [],
2526
};

src/core/markdown/adapters/type-to-renderable.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ function fieldMetadataToRenderable(
357357
apiName: getApiName(field.name, config),
358358
fieldType: field.type,
359359
required: field.required,
360-
complianceCategory: field.complianceCategory,
361-
securityClassification: field.securityClassification,
360+
complianceCategory: renderComplianceCategory(field.complianceCategory, config),
361+
securityClassification: renderComplianceCategory(field.securityClassification, config),
362362
pickListValues: field.pickListValues
363363
? {
364364
headingLevel: headingLevel + 1,
@@ -393,3 +393,11 @@ function getApiName(currentName: string, config: MarkdownGeneratorConfig) {
393393
}
394394
return currentName;
395395
}
396+
397+
function renderComplianceCategory(complianceCategory: string | null, config: MarkdownGeneratorConfig) {
398+
if(config.includeFieldSecurityMetadata) {
399+
return complianceCategory;
400+
} else {
401+
return null;
402+
}
403+
}

src/core/shared/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export type CliConfigurableMarkdownConfig = {
3838
includeMetadata: boolean;
3939
linkingStrategy: LinkingStrategy;
4040
referenceGuideTitle: string;
41+
includeFieldSecurityMetadata: boolean;
4142
};
4243

4344
export type UserDefinedMarkdownConfig = {

src/defaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const markdownDefaults = {
1919
linkingStrategy: 'relative' as const,
2020
referenceGuideTitle: 'Reference Guide',
2121
excludeTags: [],
22+
includeFieldSecurityMetadata: false,
2223
};
2324

2425
export const openApiDefaults = {

0 commit comments

Comments
 (0)