@d10221/graphql-scalar-json5
v0.1.0-8
Published
GraphQL JSON5 scalar type
Downloads
1
Readme
GraphQL JSON5 scalar type
Install
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
Usage
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
Why Consume JSON5 ?
/* GraphQL */ `
# no quote scaping :)
query findStuff {
things(filter: "{$and:[{code:{$regex:'xxx'}},{name:{$eq:'Bob'}}]}") {
... on Stuff {
_id
name
}
}
}`;