diff --git a/README.md b/README.md index 2d340f6b..8583679c 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f | `--linkingStrategy` | N/A | The strategy to use when linking to other classes. Possible values are `relative`, `no-link`, and `none` | `relative` | No | | `--customObjectsGroupName` | N/A | The name under which custom objects will be grouped in the Reference Guide | `Custom Objects` | No | | `--triggersGroupName` | N/A | The name under which triggers will be grouped in the Reference Guide | `Triggers` | No | +| `--includeFieldSecurityMetadata` | N/A | Whether to include the compliance category and security classification for fields in the generated files. | `false` | No | +| `--includeInlineHelpTextMetadata` | N/A | Whether to include the inline help text for fields in the generated files. | `false` | No | ##### Linking Strategy diff --git a/examples/markdown/docs/custom-objects/Event__c.md b/examples/markdown/docs/custom-objects/Event__c.md index 4ab294bc..f8037055 100644 --- a/examples/markdown/docs/custom-objects/Event__c.md +++ b/examples/markdown/docs/custom-objects/Event__c.md @@ -45,7 +45,7 @@ Represents an event that people can register for. Used to store the U.S. social security number in 9 digit format. -**Compliance Category** +**Compliance Group** PII **Security Classification** diff --git a/examples/markdown/force-app/objects/Event__c/fields/Social_Security_Number__c.field-meta.xml b/examples/markdown/force-app/objects/Event__c/fields/Social_Security_Number__c.field-meta.xml index 6cd99937..b463d465 100644 --- a/examples/markdown/force-app/objects/Event__c/fields/Social_Security_Number__c.field-meta.xml +++ b/examples/markdown/force-app/objects/Event__c/fields/Social_Security_Number__c.field-meta.xml @@ -3,10 +3,11 @@ Social_Security_Number__c false + You indicated the approval for storage of your social security number. Used to store the U.S. social security number in 9 digit format. 9 false Text - PII + PII Internal diff --git a/src/cli/commands/markdown.ts b/src/cli/commands/markdown.ts index d92cefff..e52c1cdd 100644 --- a/src/cli/commands/markdown.ts +++ b/src/cli/commands/markdown.ts @@ -76,5 +76,9 @@ export const markdownOptions: RecordUrl A Photo URL field Internal - PII + PII + An image in either one of the following formats: JPEG, SVG, or PNG. For best results the image should be under 1MB in size. `; describe('when parsing custom field metadata', () => { @@ -123,7 +124,7 @@ describe('when parsing custom field metadata', () => { assertEither(result, (data) => expect(data[0].type.securityClassification).toBe('Internal')); }); - test('the resulting type contains the correct compliance category', async () => { + test('the resulting type contains the correct compliance group', async () => { const unparsed: UnparsedCustomFieldBundle = { type: 'customfield', name: 'PhotoUrl__c', @@ -134,7 +135,21 @@ describe('when parsing custom field metadata', () => { const result = await reflectCustomFieldSources([unparsed])(); - assertEither(result, (data) => expect(data[0].type.complianceCategory).toBe('PII')); + assertEither(result, (data) => expect(data[0].type.complianceGroup).toBe('PII')); + }); + + test('the resulting type contains the correct inline help text', async () => { + const unparsed: UnparsedCustomFieldBundle = { + type: 'customfield', + name: 'PhotoUrl__c', + parentName: 'MyFirstObject__c', + filePath: 'src/field/PhotoUrl__c.field-meta.xml', + content: customFieldContent, + }; + + const result = await reflectCustomFieldSources([unparsed])(); + + assertEither(result, (data) => expect(data[0].type.inlineHelpText).toBe('An image in either one of the following formats: JPEG, SVG, or PNG. For best results the image should be under 1MB in size.')); }); test('can parse picklist values when there are multiple picklist values available', async () => { diff --git a/src/core/reflection/sobject/reflect-custom-field-source.ts b/src/core/reflection/sobject/reflect-custom-field-source.ts index c16c9296..dadda80e 100644 --- a/src/core/reflection/sobject/reflect-custom-field-source.ts +++ b/src/core/reflection/sobject/reflect-custom-field-source.ts @@ -19,7 +19,8 @@ export type CustomFieldMetadata = { pickListValues?: string[]; required: boolean; securityClassification: string | null; - complianceCategory: string | null; + complianceGroup: string | null; + inlineHelpText: string | null; }; export function reflectCustomFieldSources( @@ -69,7 +70,8 @@ function toCustomFieldMetadata(parserResult: { CustomField: unknown }): CustomFi description: null, required: false, securityClassification: null, - complianceCategory: null, + complianceGroup: null, + inlineHelpText: null, }; return { diff --git a/src/core/reflection/sobject/reflect-custom-object-sources.ts b/src/core/reflection/sobject/reflect-custom-object-sources.ts index 7f274651..c0b3094c 100644 --- a/src/core/reflection/sobject/reflect-custom-object-sources.ts +++ b/src/core/reflection/sobject/reflect-custom-object-sources.ts @@ -110,7 +110,8 @@ function convertInlineFieldsToCustomFieldMetadata( const type = inlineField.type ? (inlineField.type as string) : null; const required = inlineField.required ? (inlineField.required as boolean) : false; const securityClassification = inlineField.securityClassification ? (inlineField.securityClassification as string) : null; - const complianceCategory = inlineField.complianceCategory ? (inlineField.complianceCategory as string) : null; + const complianceGroup = inlineField.complianceGroup ? (inlineField.complianceGroup as string) : null; + const inlineHelpText = inlineField.inlineHelpText ? (inlineField.inlineHelpText as string) : null; return { type_name: 'customfield', @@ -121,7 +122,8 @@ function convertInlineFieldsToCustomFieldMetadata( type, required, securityClassification, - complianceCategory, + complianceGroup, + inlineHelpText, pickListValues: getPickListValues(inlineField), }; } diff --git a/src/core/renderables/types.d.ts b/src/core/renderables/types.d.ts index 9067c9c0..cca160b3 100644 --- a/src/core/renderables/types.d.ts +++ b/src/core/renderables/types.d.ts @@ -202,8 +202,9 @@ export type RenderableCustomField = { type: 'field'; fieldType?: string | null; required: boolean; - complianceCategory: string | null; + complianceGroup: string | null; securityClassification: string | null; + inlineHelpText: string | null; }; export type RenderableCustomMetadata = { diff --git a/src/core/shared/types.d.ts b/src/core/shared/types.d.ts index 5df8281e..5ff3823c 100644 --- a/src/core/shared/types.d.ts +++ b/src/core/shared/types.d.ts @@ -39,6 +39,7 @@ export type CliConfigurableMarkdownConfig = { linkingStrategy: LinkingStrategy; referenceGuideTitle: string; includeFieldSecurityMetadata: boolean; + includeInlineHelpTextMetadata: boolean; }; export type UserDefinedMarkdownConfig = { diff --git a/src/defaults.ts b/src/defaults.ts index 780991c9..9ec41252 100644 --- a/src/defaults.ts +++ b/src/defaults.ts @@ -20,6 +20,7 @@ export const markdownDefaults = { referenceGuideTitle: 'Reference Guide', excludeTags: [], includeFieldSecurityMetadata: false, + includeInlineHelpTextMetadata: false, }; export const openApiDefaults = {