my custom type has a UID field. Even when not empty, the UID is not returned:
I now fixed the implementation to first look in
uid and then
slugs, but that looks like sort of a hack. If I have a UID field in the type, I thought it was guaranteed to always get a UID?
Thanks for reaching out to us.
Slugs are a deprecated feature used before we introduced the UID field. We don't recommend using them and thus don't provide any resources. You can still find them in your document object for anyone with a legacy setup that uses them.
About your UID field:
- Have you filled the UID value in the documentation?
- Have you published the document?
yeah I know that, however if I don't get the values in the correct field, then I have no choice.
Field is filled out:
The API returns null:
Uploading: CleanShot 2022-05-09 at 09.53.55.png...
And apparently there is seems to be missing validation in the configuration of the field? At least when I now try to edit the custom type in the admin UI (normally I always push them via the API) it just doesn't load and completely breaks (just a blank white page) with this error:
If it is not allowed to change the name, then why is the UID field even configurable?
Hey @j.zschiesche, thanks for sharing your use case.
- Are you using Slice Machine
- Have you edited the UID field's API ID in the JSON model? This could cause conflicts in your documents
- If the error persists, could you share with us the URL of your repository?
we are not using slice machine, we use a different stack for connecting to Prismic.
We are using the Content Types API and push our types. But apparently there seems to be some constraints that are reflected in Slice Machine and not in the API itself?
Ok, I see.
It is weird because the UID is the only required field existing in Prismic.
If you add it to a document, then it can't be equal to null because, as you've seen, even if you don't type anything, the field will be autocompleted with the first string it detects.
Can you show us the query for the document in the screenshot? We'd like to see how this looks like in the API.