All Projects → birkir → Graphql Mst

birkir / Graphql Mst

Licence: mit
Convert GraphQL to mobx-state-tree models

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Graphql Mst

Graphql Parser
A graphql query language and schema definition language parser and formatter for rust
Stars: ✭ 203 (+822.73%)
Mutual labels:  graphql, parser
To Milliseconds
Convert an object of time properties to milliseconds: `{seconds: 2}` → `2000`
Stars: ✭ 136 (+518.18%)
Mutual labels:  parser, converter
Html2pug
Converts HTML to Pug 🐶
Stars: ✭ 118 (+436.36%)
Mutual labels:  parser, converter
Gelatin
Transform text files to XML, JSON, or YAML
Stars: ✭ 150 (+581.82%)
Mutual labels:  parser, converter
Graphql Go Tools
Tools to write high performance GraphQL applications using Go/Golang.
Stars: ✭ 96 (+336.36%)
Mutual labels:  graphql, parser
Htmr
Simple and lightweight (< 2kB) HTML string to React element conversion library
Stars: ✭ 214 (+872.73%)
Mutual labels:  parser, converter
Prance
Resolving Swagger/OpenAPI 2.0 and 3.0 Parser
Stars: ✭ 133 (+504.55%)
Mutual labels:  parser, converter
Graphql S2s
Add GraphQL Schema support for type inheritance, generic typing, metadata decoration. Transpile the enriched GraphQL string schema into the standard string schema understood by graphql.js and the Apollo server client.
Stars: ✭ 171 (+677.27%)
Mutual labels:  graphql, parser
Length.js
📏 JavaScript library for length units conversion.
Stars: ✭ 292 (+1227.27%)
Mutual labels:  parser, converter
Fuzi
A fast & lightweight XML & HTML parser in Swift with XPath & CSS support
Stars: ✭ 894 (+3963.64%)
Mutual labels:  parser
Rfdmovies Client
🎬instant recommending or finding or downloading movies via the command line
Stars: ✭ 18 (-18.18%)
Mutual labels:  parser
Weapp Bmscore
a weapp to count badminton game score
Stars: ✭ 17 (-22.73%)
Mutual labels:  mobx
Strawberry
A new GraphQL library for Python 🍓
Stars: ✭ 891 (+3950%)
Mutual labels:  graphql
Gatsby Simplefolio
⚡️ A minimal Gatsby portfolio template for Developers
Stars: ✭ 895 (+3968.18%)
Mutual labels:  graphql
Gohn
Hatena Notation (はてな記法) Parser written in Go
Stars: ✭ 17 (-22.73%)
Mutual labels:  parser
Mico
Mico ("Monkey" in catalan). Monkey language implementation done with C++. https://interpreterbook.com/
Stars: ✭ 19 (-13.64%)
Mutual labels:  parser
Diversidad Media
Diversidad Media is a platform to generate more diverse spaces, through Movies, Books, Music, and others. The project is in fast growth and there are many things to do. We are still covering the basics.
Stars: ✭ 17 (-22.73%)
Mutual labels:  graphql
Graphql Java Codegen Maven Plugin
Maven plugin for graphql-java-codegen
Stars: ✭ 17 (-22.73%)
Mutual labels:  graphql
Seconds
Helpers for converting time to seconds.
Stars: ✭ 20 (-9.09%)
Mutual labels:  converter
Chthollylang
A simple implementation of Yet another script language Chtholly
Stars: ✭ 19 (-13.64%)
Mutual labels:  parser

npm downloads npm codecov CircleCI MIT license

graphql-mst

Convert GraphQL Schema to mobx-state-tree models.

See demos in tests folder

Installing

yarn add graphql-mst
# or
npm install graphql-mst

Usage

import { generateFromSchema } from 'graphql-mst';

const schema = `
  type Foo {
    a: String
    b: Int
  }
  type Bar {
    c: [Foo]
  }
`;

const { Foo, Bar } = generateFromSchema(schema);

const foo = Foo.create({
  a: 'Hello',
  b: 10,
});

const bar = Bar.create({
  c: [foo, { a: 'World', b: 20 }],
});

Identifiers

const schema = `
  type Foo {
    userId: ID!
    fooId: ID!
  }
`;

const config = {
  Foo: {
    identifier: 'fooId', // this will be used as identifier for model 'Foo'
  },
};

const { Foo } = generateFromSchema(schema, config);

const lookup = types
  .model({ items: types.map(Foo) })
  .actions(self => ({ add: item => self.items.put(item) }))
  .create({ items: {} });

lookup.put({ userId: 10, fooId: 1 });
lookup.put({ userId: 20, fooId: 2 });

lookup.items.get(1); // { userId: 10, fooId: 1 }
lookup.items.get(2); // { userId: 20, fooId: 2 }

TODO and thoughts

  • Configure map type instead of array type
  • Default values for arguments as types.optional
  • reference types?
  • Date scalar? Custom scalar?
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].