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?
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?
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?
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.
There aren't any additional constraints in Slice Machine. It works in the same way as the Legacy Builder. UID fields must be filled in each document of the Type that has it. Otherwise the UI doesn't allow you to publish the document.