Skip to content

Commit 753506f

Browse files
committed
fix(renderField): use field.localized
1 parent 96d29a7 commit 753506f

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

Diff for: src/renderers/contentful/renderField.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@ export default function renderField(
66
type: string,
77
localization: boolean = false,
88
): string {
9-
return renderInterfaceProperty(field.id, type, field.required, localization, field.name)
9+
return renderInterfaceProperty(
10+
field.id,
11+
type,
12+
field.required,
13+
field.localized && localization,
14+
field.name,
15+
)
1016
}

Diff for: test/renderers/contentful/renderContentType.test.ts

+18-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ describe("renderContentType()", () => {
1818
localized: false,
1919
type: "Symbol",
2020
},
21+
{
22+
id: "localizedSymbolField",
23+
name: "Localized Symbol Field™",
24+
required: true,
25+
validations: [],
26+
disabled: false,
27+
omitted: false,
28+
localized: true,
29+
type: "Symbol",
30+
},
2131
{
2232
id: "arrayField",
2333
name: "Array field",
@@ -60,6 +70,9 @@ describe("renderContentType()", () => {
6070
/** Symbol Field™ */
6171
symbolField?: string | undefined;
6272
73+
/** Localized Symbol Field™ */
74+
localizedSymbolField: string;
75+
6376
/** Array field */
6477
arrayField: (\\"one\\" | \\"of\\" | \\"the\\" | \\"above\\")[];
6578
}
@@ -112,10 +125,13 @@ describe("renderContentType()", () => {
112125
expect(format(renderContentType(contentType, true))).toMatchInlineSnapshot(`
113126
"export interface IMyContentTypeFields {
114127
/** Symbol Field™ */
115-
symbolField?: LocalizedField<string> | undefined;
128+
symbolField?: string | undefined;
129+
130+
/** Localized Symbol Field™ */
131+
localizedSymbolField: LocalizedField<string>;
116132
117133
/** Array field */
118-
arrayField: LocalizedField<(\\"one\\" | \\"of\\" | \\"the\\" | \\"above\\")[]>;
134+
arrayField: (\\"one\\" | \\"of\\" | \\"the\\" | \\"above\\")[];
119135
}
120136
121137
export interface IMyContentType extends Entry<IMyContentTypeFields> {

0 commit comments

Comments
 (0)