Possible to query for content model schemas?

Is there any way to query for the JSON schema for a particular custom type? This would be for purposes of e2e testing to confirm that particular fields and structures are available.

1 Like

Hello Luke and welcome to the community forum!

The best way to see the Schema of your endpoint is by going to the GraphiQL tool: https://your-repo-name.prismic.io/graphql.

There’s also this query that retrieves the Graphql schema:
{ __schema { types { kind name possibleTypes { name } } } }

1 Like

Thanks. Is there any easy way to retrieve exactly what one sees in the custom type’s JSON editor?

I don’t believe this is possible. Is the ‘Docs’ tab not useful for you? There you can see all the types of the GraphQL schema.

What is your use case, what would be the use of retrieving this kind of data in a query?

It would be for quality control and e2e testing on our end. We’d like to be able to have a test that pulls a model and confirms that each document type has the structure it’s supposed to (and the client hasn’t accidentally mucked with it :slight_smile: ).

1 Like

This is not possible at the moment but we’re working on new features that would have a side effect of automatically pulling your custom types. Will post when it’s out :v:

1 Like

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.