diff --git a/examples/vitepress/docs/custom-objects/Event__c.md b/examples/vitepress/docs/custom-objects/Event__c.md index 892379a4..f280e216 100644 --- a/examples/vitepress/docs/custom-objects/Event__c.md +++ b/examples/vitepress/docs/custom-objects/Event__c.md @@ -22,6 +22,7 @@ Represents an event that people can register for. --- ### End Date +**Required** **API Name** @@ -33,6 +34,7 @@ Represents an event that people can register for. --- ### Location +**Required** **API Name** @@ -44,6 +46,7 @@ Represents an event that people can register for. --- ### Start Date +**Required** **API Name** diff --git a/examples/vitepress/docs/custom-objects/Price_Component__c.md b/examples/vitepress/docs/custom-objects/Price_Component__c.md index fa4be586..d82b34c6 100644 --- a/examples/vitepress/docs/custom-objects/Price_Component__c.md +++ b/examples/vitepress/docs/custom-objects/Price_Component__c.md @@ -59,6 +59,7 @@ Use this when the Price Component represents a Flat Price. To represent a Percen --- ### Type +**Required** **API Name** diff --git a/examples/vitepress/docs/custom-objects/Product_Inline_Fields__c.md b/examples/vitepress/docs/custom-objects/Product_Inline_Fields__c.md index 69a485d3..91d94d0c 100644 --- a/examples/vitepress/docs/custom-objects/Product_Inline_Fields__c.md +++ b/examples/vitepress/docs/custom-objects/Product_Inline_Fields__c.md @@ -35,6 +35,7 @@ The date the product got discontinued --- ### Name +**Required** Product name @@ -98,6 +99,7 @@ ReleaseDate --- ### Type +**Required** **API Name** diff --git a/examples/vitepress/docs/custom-objects/Product__c.md b/examples/vitepress/docs/custom-objects/Product__c.md index ba3e70d6..dc74fc31 100644 --- a/examples/vitepress/docs/custom-objects/Product__c.md +++ b/examples/vitepress/docs/custom-objects/Product__c.md @@ -22,6 +22,7 @@ Product that is sold or available for sale. --- ### Event +**Required** **API Name** diff --git a/examples/vitepress/docs/custom-objects/Sales_Order_Line__c.md b/examples/vitepress/docs/custom-objects/Sales_Order_Line__c.md index bc1ac4f7..3539f0f5 100644 --- a/examples/vitepress/docs/custom-objects/Sales_Order_Line__c.md +++ b/examples/vitepress/docs/custom-objects/Sales_Order_Line__c.md @@ -11,6 +11,7 @@ Represents a line item on a sales order. ## Fields ### Amount +**Required** **API Name** @@ -22,6 +23,7 @@ Represents a line item on a sales order. --- ### Product +**Required** **API Name** @@ -55,6 +57,7 @@ Represents a line item on a sales order. --- ### Type +**Required** **API Name** diff --git a/examples/vitepress/force-app/main/default/objects/Product_Inline_Fields__c/Product_Inline_Fields__c.object-meta.xml b/examples/vitepress/force-app/main/default/objects/Product_Inline_Fields__c/Product_Inline_Fields__c.object-meta.xml index b31232e8..54eddcc8 100644 --- a/examples/vitepress/force-app/main/default/objects/Product_Inline_Fields__c/Product_Inline_Fields__c.object-meta.xml +++ b/examples/vitepress/force-app/main/default/objects/Product_Inline_Fields__c/Product_Inline_Fields__c.object-meta.xml @@ -78,7 +78,7 @@ false 128 - false + true Text false diff --git a/src/core/changelog/__test__/processing-changelog.spec.ts b/src/core/changelog/__test__/processing-changelog.spec.ts index b9b207b3..ad8ea5a1 100644 --- a/src/core/changelog/__test__/processing-changelog.spec.ts +++ b/src/core/changelog/__test__/processing-changelog.spec.ts @@ -34,6 +34,7 @@ class CustomFieldMetadataBuilder { name: this.name, description: this.description, parentName: 'MyObject', + required: false, }; } } diff --git a/src/core/markdown/adapters/type-to-renderable.ts b/src/core/markdown/adapters/type-to-renderable.ts index 06edd6c9..46226a0f 100644 --- a/src/core/markdown/adapters/type-to-renderable.ts +++ b/src/core/markdown/adapters/type-to-renderable.ts @@ -281,6 +281,7 @@ function fieldMetadataToRenderable( description: field.description ? [field.description] : [], apiName: getApiName(field.name, config), fieldType: field.type, + required: field.required, pickListValues: field.pickListValues ? { headingLevel: headingLevel + 1, diff --git a/src/core/markdown/templates/custom-object-template.ts b/src/core/markdown/templates/custom-object-template.ts index b182c4cb..16d2f99c 100644 --- a/src/core/markdown/templates/custom-object-template.ts +++ b/src/core/markdown/templates/custom-object-template.ts @@ -10,6 +10,9 @@ export const customObjectTemplate = ` {{ heading fields.headingLevel fields.heading }} {{#each fields.value}} {{ heading headingLevel heading }} +{{#if required}} +**Required** +{{/if}} {{#if description}} {{{renderContent description}}} diff --git a/src/core/reflection/sobject/reflect-custom-field-source.ts b/src/core/reflection/sobject/reflect-custom-field-source.ts index 8e6aa52a..698864aa 100644 --- a/src/core/reflection/sobject/reflect-custom-field-source.ts +++ b/src/core/reflection/sobject/reflect-custom-field-source.ts @@ -17,6 +17,7 @@ export type CustomFieldMetadata = { type?: string | null; parentName: string; pickListValues?: string[]; + required: boolean; }; export function reflectCustomFieldSources( @@ -64,6 +65,7 @@ function toCustomFieldMetadata(parserResult: { CustomField: unknown }): CustomFi parserResult?.CustomField != null && typeof parserResult.CustomField === 'object' ? parserResult.CustomField : {}; const defaultValues = { description: null, + required: false, }; return { diff --git a/src/core/reflection/sobject/reflect-custom-object-sources.ts b/src/core/reflection/sobject/reflect-custom-object-sources.ts index 863dc34e..6f22780d 100644 --- a/src/core/reflection/sobject/reflect-custom-object-sources.ts +++ b/src/core/reflection/sobject/reflect-custom-object-sources.ts @@ -102,6 +102,7 @@ function convertInlineFieldsToCustomFieldMetadata( const description = inlineField.description ? (inlineField.description as string) : null; const label = inlineField.label ? (inlineField.label as string) : name; const type = inlineField.type ? (inlineField.type as string) : null; + const required = inlineField.required ? (inlineField.required as boolean) : false; return { type_name: 'customfield', @@ -110,6 +111,7 @@ function convertInlineFieldsToCustomFieldMetadata( name, parentName, type, + required, pickListValues: getPickListValues(inlineField), }; } diff --git a/src/core/renderables/types.d.ts b/src/core/renderables/types.d.ts index 46814207..f54c5fad 100644 --- a/src/core/renderables/types.d.ts +++ b/src/core/renderables/types.d.ts @@ -192,6 +192,7 @@ export type RenderableCustomField = { pickListValues?: RenderableSection; type: 'field'; fieldType?: string | null; + required: boolean; }; export type Renderable = (RenderableClass | RenderableInterface | RenderableEnum | RenderableCustomObject) & {