Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type System Definition Language #182

Merged
merged 4 commits into from
Jul 8, 2018
Merged

Type System Definition Language #182

merged 4 commits into from
Jul 8, 2018

Conversation

jlouis
Copy link
Owner

@jlouis jlouis commented Jul 1, 2018

This pull request handles the new type system definition language. The work is going to be split over several changes:

  • Alter the grammar and scanner to accept the new token types.
  • Alter the injection code to handle the new format.
  • Change all the specifications in tests to follow the new format.
  • Go over the README.md file, and be quite aggresive with deletion as most information is in the tutorial.
  • Rewrite the tutorial to follow the new format.
  • Probably look into upgrading to Cowboy 2.0 in the tutorial as well.

@jlouis
Copy link
Owner Author

jlouis commented Jul 1, 2018

  • Next step: Remove the annotations from the schema definitions. Then fix all the compiler errors which occur due to this change.

Once done, we should have everything as directives-only in the system.

@jlouis
Copy link
Owner Author

jlouis commented Jul 1, 2018

Won't pass yet. There are still lots of stuff to do here before it'll work.

This patch changes the parser to it follow the Type Definition
Language in the GraphQL spec, but it doesn't yet implement the notion
of extending a schema.

Major changes:

* There are no more annotations. Everything is now given as directives
  if this is what you desire to do.
* Descriptions are optional first class citizens of the grammar and
  can be added to any kind of term in the grammar, more or less.
* Change the grammar to be closer to the specifications layout. This
  is a bit more involved in the parser, but it makes it easier to
  follow along in the specification.
* Remove '+' as a valid symbol in the scanner
* NonTerminal cleanup and ordering
* Change the internal schema we parse:
  - Add directives
  - Add description
  - Remove annotations (which are now handled by directives)
* Handle the preprocessor as well
* Adapt all the test cases to use the new format
An enum value is usually given as a binary value by the parser. But we
factored this through the name/1 function. And the type spec was wrong
on #p_enum_value.id. Fixing this untangles some calls and makes the
dialyzer check pass.
@jlouis
Copy link
Owner Author

jlouis commented Jul 7, 2018

Turned out to be far easier than I imagined. The above patches implements the type definition language and changes annotations to be directives in the system. This makes the engine compliant with the specification in this area as well.

This works a bit toward supporting the schema {..} directive. We
accept the grammar and we inject it into the system as the root
schema.
More simplification of the graphql module. You can now load and parse
a schema without injecting a root yourself. It is part of the GraphQL
specification now.
@jlouis jlouis merged commit a925183 into develop Jul 8, 2018
@jlouis jlouis deleted the jl/typedef-lang branch July 8, 2018 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant