yarn add @d10221/graphql-type-json5
yarn add graphql # peer dependency
yarn add json5 # peer dependency
... or ...
npm i @d10221/graphql-type-json5
npm i graphql # peer dependency
npm i json5 # peer dependency
import JSON5 from "../";
import { makeExecutableSchema } from "graphql-tools";
const schema = makeExecutableSchema({
typeDefs: /* GraphQL */ `
scalar JSON5
type Query {
value(params: JSON5): JSON5
}
`,
resolvers: {
JSON5,
Query: {
value(parent, args, context, info) {
return args.params;
},
},
},
});
See tests
/* GraphQL */ `
# no quote scaping :)
query findStuff {
things(filter: "{$and:[{code:{$regex:'xxx'}},{name:{$eq:'Bob'}}]}") {
... on Stuff {
_id
name
}
}
}`;