GraphQL to JSON Schema
Turn a GraphQL type into a JSON Schema from your AI assistant.
You have a GraphQL type. You need a JSON Schema. Use this when a record from a GraphQL API must be checked as JSON. The output keeps the field names, the allowed values and the required fields. The page shows the recorded output and lists what did not carry over.
What you get
A JSON Schema with seven properties. Six are required and status keeps its four allowed values. This is the answer CoreModels gave on 3 December 2026 for the file below.
order.schema.json
{
"type": "object",
"properties": {
"orderId": {
"type": "string"
},
"customerId": {
"type": "string"
},
"status": {
"enum": [
"PLACED",
"SHIPPED",
"DELIVERED",
"RETURNED"
]
},
"totalAmount": {
"type": "number"
},
"currency": {
"type": "string"
},
"placedAt": {
"type": "string"
},
"discountCode": {
"type": "string"
}
},
"required": [
"orderId",
"customerId",
"status",
"totalAmount",
"currency",
"placedAt"
]
}
What you need
- A CoreModels account with one project. Every plan starts with a 14-day free trial; a card is required to start.
- The tool uses the project only to check your access. It writes nothing.
- An assistant that speaks MCP, such as Claude Code, Claude Desktop or Cursor.
- A GraphQL SDL file with one flat record.
Run it
1. Connect your assistant
In Claude Code, run this command. Then sign in when it asks.
claude mcp add --transport http coremodels https://go.coremodels.io/mcp
Cursor, Claude Desktop and other clients: connect guide.
2. Save the file as order.graphql
Use your own file, or start with this one.
order.graphql
"""A purchase order placed by a customer."""
type Order {
"""Order number printed on the receipt."""
orderId: ID!
"""The customer who placed the order."""
customerId: String!
"""Where the order is now."""
status: OrderStatus!
"""Order total, tax included."""
totalAmount: Decimal!
"""ISO 4217 currency code."""
currency: String!
"""When the customer placed the order."""
placedAt: DateTime!
"""Code used at checkout, if any."""
discountCode: String
}
"""Where the order is now."""
enum OrderStatus {
PLACED
SHIPPED
DELIVERED
RETURNED
}
scalar DateTime
scalar Decimal
3. Ask for the conversion
Use the CoreModels transform_schema tool to convert order.graphql from graphql to jsonschema. Pass the whole file as sourceSchema and again as targetHintSchema. Use any project from list_projects. Save the result as order.schema.json, then list every entry in lossiness.
Your assistant calls transform_schema with these arguments. The file goes in twice: once as the source, once as the hint the mapping matches against. Without the hint the tool refuses the call.
transform_schema
{
"graphProjectId": "<your project id>",
"sourceFormat": "graphql",
"sourceSchema": "<contents of order.graphql>",
"targetFormat": "jsonschema",
"targetHintFormat": "graphql",
"targetHintSchema": "<contents of order.graphql>"
}
What did not carry over
- We tested one flat record. Nested records and lists are not tested on this page.
CoreModels reported these changes with the answer:
Order.totalAmount: Custom scalar 'Decimal' is approximated (decimal precision semantics are not modelled); the verbatim name is preserved.
We compared the two files ourselves and also found:
- Descriptions. Each field has a description in the input. The output has none.
- The time type.
placedAtis a date and time in the input and a plain string in the output. - The
Decimalname. The tool reports that it is preserved, buttotalAmountis a plainnumberin this output. - The
IDtype.orderIdbecomes a plain string.
Compare your own files too. A different file can lose other things.
Check it yourself
Validate the file against its own JSON Schema dialect.
pip install check-jsonschema
check-jsonschema --check-metaschema order.schema.json
14-day free trial. Builder $49/mo after the trial. Cancel any time.