Skip to content

Commit aa60bec

Browse files
authored
Merge pull request #213 from cesarParra/custom-object-mark-if-required
Marking required fields when generating custom field documentation
2 parents 2f49b65 + c810b28 commit aa60bec

File tree

12 files changed

+21
-1
lines changed

12 files changed

+21
-1
lines changed

examples/vitepress/docs/custom-objects/Event__c.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Represents an event that people can register for.
2222

2323
---
2424
### End Date
25+
**Required**
2526

2627
**API Name**
2728

@@ -33,6 +34,7 @@ Represents an event that people can register for.
3334

3435
---
3536
### Location
37+
**Required**
3638

3739
**API Name**
3840

@@ -44,6 +46,7 @@ Represents an event that people can register for.
4446

4547
---
4648
### Start Date
49+
**Required**
4750

4851
**API Name**
4952

examples/vitepress/docs/custom-objects/Price_Component__c.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Use this when the Price Component represents a Flat Price. To represent a Percen
5959

6060
---
6161
### Type
62+
**Required**
6263

6364
**API Name**
6465

examples/vitepress/docs/custom-objects/Product_Inline_Fields__c.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The date the product got discontinued
3535

3636
---
3737
### Name
38+
**Required**
3839

3940
Product name
4041

@@ -98,6 +99,7 @@ ReleaseDate
9899

99100
---
100101
### Type
102+
**Required**
101103

102104
**API Name**
103105

examples/vitepress/docs/custom-objects/Product__c.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Product that is sold or available for sale.
2222

2323
---
2424
### Event
25+
**Required**
2526

2627
**API Name**
2728

examples/vitepress/docs/custom-objects/Sales_Order_Line__c.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Represents a line item on a sales order.
1111

1212
## Fields
1313
### Amount
14+
**Required**
1415

1516
**API Name**
1617

@@ -22,6 +23,7 @@ Represents a line item on a sales order.
2223

2324
---
2425
### Product
26+
**Required**
2527

2628
**API Name**
2729

@@ -55,6 +57,7 @@ Represents a line item on a sales order.
5557

5658
---
5759
### Type
60+
**Required**
5861

5962
**API Name**
6063

examples/vitepress/force-app/main/default/objects/Product_Inline_Fields__c/Product_Inline_Fields__c.object-meta.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<isSortingDisabled>false</isSortingDisabled>
7979
<label>Name</label>
8080
<length>128</length>
81-
<required>false</required>
81+
<required>true</required>
8282
<type>Text</type>
8383
<unique>false</unique>
8484
</fields>

src/core/changelog/__test__/processing-changelog.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class CustomFieldMetadataBuilder {
3434
name: this.name,
3535
description: this.description,
3636
parentName: 'MyObject',
37+
required: false,
3738
};
3839
}
3940
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ function fieldMetadataToRenderable(
281281
description: field.description ? [field.description] : [],
282282
apiName: getApiName(field.name, config),
283283
fieldType: field.type,
284+
required: field.required,
284285
pickListValues: field.pickListValues
285286
? {
286287
headingLevel: headingLevel + 1,

src/core/markdown/templates/custom-object-template.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export const customObjectTemplate = `
1010
{{ heading fields.headingLevel fields.heading }}
1111
{{#each fields.value}}
1212
{{ heading headingLevel heading }}
13+
{{#if required}}
14+
**Required**
15+
{{/if}}
1316
1417
{{#if description}}
1518
{{{renderContent description}}}

src/core/reflection/sobject/reflect-custom-field-source.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type CustomFieldMetadata = {
1717
type?: string | null;
1818
parentName: string;
1919
pickListValues?: string[];
20+
required: boolean;
2021
};
2122

2223
export function reflectCustomFieldSources(
@@ -64,6 +65,7 @@ function toCustomFieldMetadata(parserResult: { CustomField: unknown }): CustomFi
6465
parserResult?.CustomField != null && typeof parserResult.CustomField === 'object' ? parserResult.CustomField : {};
6566
const defaultValues = {
6667
description: null,
68+
required: false,
6769
};
6870

6971
return {

0 commit comments

Comments
 (0)