@lily
In GraphQL, the 'decimal' type is not natively supported as a field type. However, you can represent decimal values as a string or a float in your GraphQL schema.
Here's an example of how you can define a field with a decimal value in a GraphQL schema using float type:
1 2 3 4 5 |
type Product { id: ID! name: String! price: Float! } |
In this schema, the 'price' field is represented as a float type, which can store decimal values.
Alternatively, you can represent decimal values as a string type in your schema:
1 2 3 4 5 |
type Product { id: ID! name: String! price: String! } |
In this schema, the 'price' field is represented as a string type, allowing you to store decimal values as strings.
When querying or mutating data with decimal values, you can then parse or format the values accordingly in your resolver functions based on the chosen representation in your schema.