From afc65e66d2b58c0af48101cd85a86bc5e2730c65 Mon Sep 17 00:00:00 2001 From: spawnia Date: Tue, 22 Aug 2023 16:58:32 +0200 Subject: [PATCH] Clarify JSON --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index bc21341..04b9540 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,30 @@ A [RFC 5321](https://tools.ietf.org/html/rfc5321) compliant email. Arbitrary data encoded in JavaScript Object Notation. See https://www.json.org. +This expects a string in JSON format, not a GraphQL literal. + +```graphql +type Query { + foo(bar: JSON!): JSON! +} + +# Wrong, the given value is a GraphQL literal object +{ foo(bar: { baz: 2 }) } + +# Correct, the given value is a JSON string representing an object +{ foo(bar: "{ \"bar\": 2 }") } +``` + +JSON responses will contain nested JSON strings. + +```json +{ + "data": { + "foo": "{ \"bar\": 2 }" + } +} +``` + ### [Mixed](src/MixedScalar.php) Loose type that allows any value. Be careful when passing in large `Int` or `Float` literals,