Getting this error:
GraphQLError: Names must only contain [_a-zA-Z0-9] but "posts-test_gear_bundles_backpopulated" does not
1. is this check new?
2. Which symbol is a problem: the "_" or the "-"?
From the error, seems like
-
is the issue, but we should be sanitizing the names behind the scenes. Wondering if there is an issue with the sanitization going on
the same error did not happen in previous versions, so something definitely changed. Might be worth checking into that, or mentioning it in a changelog if I didnt miss anything
my solution was to rewrite it all with the _ symbol instead
though honestly, might as well leave that as a standard
Using "-" in fields is a pain anyways as you need to make those strings
Right, but were you just using a slug, and it was auto-generating the graphql names?
That is where I think there
maybe a bug
that specific one was from
https://github.com/TimHal/pcms-backpop
I'm not sure if it ONLY happened for that, or for others as well
didnt specifically test that, I just assumed it would break for everything
oh yeah, I dont think specifying with a
-
should be allowed, not sure that graphql allows that
It (I think) did work in the past though, that's for sure
In the past we used labels to generate the graphQL type names, then we made a breaking change to use slugs and allowed users to specifically set graphQL typenames if they would prefer. BUT it should sanitize the slug correctly, into a graphQL safe type name (which it sounds like it is not doing in some cases, maybe)
Ah right didn't think of that! Maybe that was what broke it then
but yeah it definitely wasn't sanitizing anything there
Which I THINK is good though - for new projects. not so much for existing projects
It'd be a bit confusing if the graphQL name differs from the name you specified automatically
For new projects, most of them should have just worked out of the box, since the slug and label are normally the same (one is hyphenated) but for collections that used custom labels, those would break hence the breaking change. That is why we opened up the ability to set GraphQL names so users could transition their old label generated type name to the new graphql specific property and not have to adjust their frontend
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.