Comments (4)
Yes, I agree we should be doing something about this. It should be fairly easy to produce a better error message by detecting this explicitly.
from graphql-erlang.
Rough debugging plan:
- Figure out which part of the code the problem occurs in: parser? The canonicalizer itself?
- Handle this gracefully, either by ignoring the annotation, or by failing whenever there are an excess of unknown annotations.
The latter is up for discussion: both semantics are pretty nice: ignoring means you can extend it with stuff in advance. But then again, it also means you don't get an error report, and then you might be confused later on, when the expected behavior isn't there (why is my descriptions not showing up in my API introspection?)
from graphql-erlang.
Better fix for this one: In #161 descriptions are optional (block-) strings on types. So we have somethng like
"Geolocated coordinates"
type Geo {
"The latitude of the geolocation"
latitude: Float!
"The longitude of the geolocation"
longitude: Float!
}
Which completely solves this problem going forward. Also annotations such as +description
will go away since we can just add them as directives to the server. Instead of e.g., +private
you can write:
"The Foo object"
type Foo {
"The private geo position of the Foo object"
geo: Geo! @private
}
This naturally reuses the directive notion and internally it also makes a lot of sense since annotations and directives share a lot of the same code path, but they are really the same kind of thing.
from graphql-erlang.
The initial (concrete) fix for this has been merged and documentation are now docstrings as per the Jun2018 specification.
As for directives, we plan to support them as per the Jun2018 spec as well. You would write something like the following to implement the old behavior:
directive @ description (text: String) on
| SCHEMA
| SCALAR
| OBJECT
| FIELD_DEFINITION
| ARGUMENT_DEFINITION
| INTERFACE
| UNION
| ENUM
| ENUM_VALUE
| INPUT_OBJECT
| INPUT_FIELD_DEFINITION
Which is then entered into the type checker. This will have the type checker detect an error if you use capitalized Text
in lieu of text
. GraphQL is case sensitive in general, so this follows the basic rules of the game.
NOTE: The example is somewhat degenerate insofar it implements a feature which has been added to the specification. But it shows how a programmer is able to extend the schema with their own ruleset.
from graphql-erlang.
Related Issues (20)
- Jun2018 clarify: Improve the Input Object input coercion subsection with more examples (#388) HOT 1
- Jun2018 clarify: Generalize validation of value literals, changing the names of validation rules but not changing the validity of documents (#389) HOT 1
- Jun2018 clarify: Fix ExecuteSelectionSet algorithm where fieldType may not be defined, but will never be null (#433) HOT 1
- Jun2018 clarify: Make it clear that field result coercion should throw errors before data loss (#434) HOT 2
- Jun2018 clarify: Clarify list coercion rules, especially with respect to null values, including examples (#436, #440) HOT 1
- Move this project to Erlang 21.x
- Jun2018 Spec: Null value support (2.9.5) HOT 2
- Jun2018 spec: Handle type extensions HOT 1
- Jun 2018 spec: Handle the new Schema definition HOT 5
- Replace scalar `input/2` and `output/2` with a `scalar/3` function HOT 2
- Add support for a @deprecated directive
- Errornous handling of nulls in inlined field arguments HOT 2
- Translate GraphQL qureries to SQL HOT 2
- Questions about graphql:sync/3 HOT 1
- Handle application failure of graphql:map/2
- bug in graphql:type_check_params/3? HOT 2
- GraphQL with Yaws HOT 1
- Failing Hex package compilation HOT 6
- GraphQL parsing fails on 'subscription' field
- Introspection produces `Bool` instead of `Boolean`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-erlang.