barnacle
Barnacle is a very simple GraphQL helper for Typescript. It exposes several decorators which allow you to automatically build GraphQL type definitions from Typescript classes.
Warning
Barnacle is in very early stages - each version should be stable for use in production, but breaking API changes are likely to occur semi-regularly between versions. This will be the case until v0.2.0 is released, at which point the API will be stable based on the minor version. (When v1.0.0 is released, the API will be stable based on the major version - but that's a long way away.)
Usage
Make sure you have the reflect-metadata
package installed (npm i reflect-metadata
),
then do npm i barnaclejs
.
;; console.logbarnacle.toSchemaUser; /* should output:type User { id: Int! lastIP: String phoneNumbers: [String]! getEmail(actual: Boolean!): String!}*/