Introspection

Introspection query

The introspected schema is provided in JSON schema format, which offers a structured representation of the API's data model and operations. To streamline integration with TypeScript, the introspection-cli tool automates the conversion of this JSON schema into TypeScript interfaces. This ensures that developers can easily incorporate the API schema into their TypeScript projects, leveraging type safety and code completion features.

For those who prefer more control or have specific requirements, the tool also offers the flexibility to use the raw output of the schema directly. By specifying the lang="raw" option in the CLI, developers can obtain the JSON schema without any additional transformations. Alternatively, developers can choose to fetch the schema themselves and process it according to their needs.

This versatility empowers developers to tailor their integration approach based on their preferences and project requirements, ensuring a seamless and efficient workflow when working with the introspected schema in TypeScript projects.

const ptsqJSONSchema = await fetch('https://example.com/ptsq/introspection');

CLI

instrospection-cli --url="http://localhost:4000/ptsq" --out="schema.generated.ts"

raw introspection

instrospection-cli --url="http://localhost:4000/ptsq" --out="schema.generated.ts" --lang="raw"