Why labels used instead of slugs for typescript and graphql?

default discord avatar
10 months ago
1 3

That was unexpected - declared tone of configs, wrote tone of graphql queries in nextjs pages using generated types and decided its time for cleanup ui in CMS - and boom - everything broken as i changed labels 🤪

I even checked - you have Settings in group One and Settings in group Two - it will make Settings and Settings1 instead of used slugs.

  • discord user avatar
    Payload Team
    9 months ago

    These changes were released in v1.2.

  • discord user avatar
    Payload Team
    10 months ago

    This is about to improve actually - very shortly. At first we did this because labels generally aligned more closely to naming conventions of GraphQL types but I agree, it’s not expected. Keep an eye out for more here shortly

  • discord user avatar
    Payload Team
    10 months ago

    You're absolutely right @itspers,

    I've made this change and included it in the PR for i18n. #1326
    This is a breaking change and will be documented in the release notes, but know that if you were relying on the labels for globals and collections for the GraphQL schema names, you will have to make a small change to your config or the client code calling GraphQL.

    Going forward, slugs will be responsible for graphQL schema names by default. If you wish to override the names Payload derives from the slug, you can be explicit using the new properties on Collections and Globals to do so.

    Collections new object for GraphQL is:

      graphQL?: {
        singularName?: string
        pluralName?: string

    and globals has a new property for graphQLName?: string.

    The change is still open for review if you have any comments.

Open the post
Continue the discussion in GitHub
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.