Skip to content

[Strapi V5] Localisations required when not enabled on collection type with GraphQL #21401

@jelmer-visser

Description

@jelmer-visser

Bug Report

We use GraphQL in our Next.js application along with codegen to generate types based on the GraphQL schema and queries. In Strapi v5, we have a collection type where localization is disabled, but in the GraphQL schema, the localizations field is still marked as required.

When I include the localizations field in my query, it triggers the same error on the subsequent localizations field (possibly due to a circular dependency).

System Information

  • Node.js version: 18.20.4
  • NPM version: 10.7.0
  • Strapi version: 5.0.0
  • Database: MySQL
  • Operating System: macOS (darwin-arm64)
  • Project Language: TypeScript

Steps to Reproduce

  1. Enable the GraphQL plugin in Strapi v5.
  2. Create a collection type with localization disabled.

While the following steps might not be necessary to trigger the issue, they reflect our specific setup:

  1. Create a component that uses the collection type as a relation.
  2. Add this component to a Dynamic Zone.
  3. Create a GraphQL query that queries the component in the dynamic zone
  4. Run codegen in Next.js to generate types.ts.
  5. Use the generated type in your application and build the Next.js project.
  6. You will encounter an error stating that localizations is required, despite being disabled.

Expected Behavior

When localization is disabled, the localizations field should not be required in the query.

Screenshots

In the screenshot below, the localizations field is marked as required, even though it is disabled for blogs:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugseverity: highIf it breaks the basic use of the productsource: plugin:graphqlSource is plugin/graphql packagestatus: pending reproductionWaiting for free time to reproduce the issue, or more informationversion: 5Issue is present in Strapi 5

    Type

    No type

    Projects

    Status

    Fixed/Shipped

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions