Single type document not listed in GraphQL

I once made single type schema, made document of it and it was successfully listed in GraphQL explorer using query like

{ main(uid: “main”, lang: “ru”) { fields } }

After that I made some changes in another, Multi-doc model: added boolean field “main” into images slice.

After this step I cannot query previous Single-type doc using previous query and now it available using only

{ allMains { edges { nodes { fields } } } }

Even after destroying all single-typed docs and models and creating them from scratch with another api name, I still unable to point them directly in GraphQL, only using array-like queries.

What I do wrong?



Welcome to the community!

So when it comes to querying single types in GraphQL you still need to add a UID field and add a UID, then based off your screenshots your query should look like this:

  Mainpage(uid:"your-uid", lang:"ru"){

Try this and let me know if it works.


I think what he is trying to say is that the graphql API is not generated as explained in the docs. I just had the same problem. Only the “all” queries are available in my Graphql API.

Also thought I was doing something wrong as this looks like something more people should be noticing.

Screenshot 2020-08-19 at 11.09.05

Looking around… I found out that this happens when your documents do not have a uid field in the data model. So after adding a uid field to my data model it generated the “single” queries.