Skip to content

Commit cefe2a5

Browse files
fix(cli): Exclude translatable fields from top-level input type | #4373 (#4505)
Co-authored-by: Michael Bromley <michaelbromley@users.noreply.github.com>
1 parent fb2b861 commit cefe2a5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

packages/cli/src/commands/add/api-extension/add-api-extension.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,12 @@ function createCrudApiExtension(project: Project, plugin: VendurePluginRef, serv
606606
if (serviceRef.features.create) {
607607
writer.writeLine(` input Create${entityRef.name}Input {`);
608608
for (const { name, type, nullable } of entityRef.getProps()) {
609+
if (
610+
entityRef.isTranslatable() &&
611+
type.getText().includes('LocaleString')
612+
) {
613+
continue;
614+
}
609615
const graphQlType = getGraphQLType(type);
610616
if (graphQlType) {
611617
writer.writeLine(` ${name}: ${graphQlType}${nullable ? '' : '!'}`);
@@ -624,6 +630,12 @@ function createCrudApiExtension(project: Project, plugin: VendurePluginRef, serv
624630
writer.writeLine(` input Update${entityRef.name}Input {`);
625631
writer.writeLine(` id: ID!`);
626632
for (const { name, type } of entityRef.getProps()) {
633+
if (
634+
entityRef.isTranslatable() &&
635+
type.getText().includes('LocaleString')
636+
) {
637+
continue;
638+
}
627639
const graphQlType = getGraphQLType(type);
628640
if (graphQlType) {
629641
writer.writeLine(` ${name}: ${graphQlType}`);

0 commit comments

Comments
 (0)