Skip to content

Incorrectly generated GraphQL inputs for translatable entity inputsΒ #4373

@gabriellbui

Description

@gabriellbui

Describe the bug

When scaffolding a translatable entity using npx vendure add, the generated gql input types in api-extensions.ts (CreateEntityInput and UpdateEntityInput) incorrectly include translatable fields at the top level in addition to inside the EntityTranslationInput. This causes duplicate form fields in the dashboard detail page and "No translation found" errors when creating/updating entities.

To Reproduce

  1. Run npx vendure add and select "New entity"
  2. Choose the "translatable" option
  3. Add translatable fields (e.g. title, content)
  4. Observe the generated api-extensions.ts file
  5. CreateEntityInput and UpdateEntityInput has the translatable fields on the top level as well

Expected behavior

Translatable fields should only appear in the EntityTranslationInput

Expected generated inputs

  input CreateEntityInput {
    code: String!
    translations: [EntityTranslationInput!]!
  }

  input UpdateEntityInput {
    id: ID!
    code: String
    translations: [EntityTranslationInput!]
  }

Actual behavior
The CLI generates translatable fields at both the top level and inside the translation input:

  input CreateEntityInput {
    title: String!          # should not be here
    content: String!        # should not be here
    code: String!
    translations: [EntityTranslationInput!]!
  }

  input UpdateEntityInput {
    id: ID!
    title: String           # should not be here
    content: String         # should not be here
    code: String
    translations: [EntityTranslationInput!]
  }

Environment (please complete the following information):

  • @vendure/core version: ^3.0.0
  • Nodejs version: v24.13.0
  • Database: postgres
  • Operating System: macOS

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions