Type generation
You can use the Content Cloud CLI to auto-generate typings for the content API. Our auto-generated clients are the fastest and easiest way to get started and they’re available for both the REST API and the GraphQL API.
Typing is useful for:
Catching bugs and errors caused by wrongly handled data types, like forgetting to check for null and undefined properties or assuming a different type than is given.
Autocomplete of fields when querying content and using the response.
Making it easier to refactor integration code when you make changes to the schema with automated validation.
Using AI tools for frontend code generation without type hallucinations and immediate validation for correctness.
Typing is currently available for generating TypeScript clients and the GraphQL schema. If you require other languages, please reach out to our support team.
Using the CLI
You can find detailed setup and usage instructions at the package README here.
Limitations
REST
While the select parameter is taken into consideration for the return type of the .contentCollection() method, the
embedandincludeparameters don’t change the typing of the result.
GraphQL
Not all native GraphQL functionality is available for the client. For example:
No support for named properties.
No support for batched queries.
No support for nested, dynamic properties.
No support for ambiguous fields that require using “...on XY { … }”
These features will be added in future versions of the GraphQL client.
You can use the GraphQL explorer in the Content Sync app to write custom GraphQL queries for your application.