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

Support docstrings #118

Closed
acjay opened this issue Dec 6, 2017 · 9 comments
Closed

Support docstrings #118

acjay opened this issue Dec 6, 2017 · 9 comments
Labels

Comments

@acjay
Copy link

acjay commented Dec 6, 2017

I believe the draft SDL spec now supports docstring-style string descriptions. So this reports as an error, when I'm pretty sure the following should be valid:

"""
Nullable because the field refers to data that may be absent. This is only
required if there is another nullability decorator, otherwise, it is implicit 
that a nullable field is optional.
"""
directive @nullableOptional on FIELD
@jimkyndemeyer
Copy link
Collaborator

This also relates to #121 as only newer GraphQL libraries will support this.

I don't see this mentioned at http://facebook.github.io/graphql/ yet. Do you have any additional info?

@lowsky
Copy link

lowsky commented Jan 3, 2018

I think the spec for comment descriptions
which is already part of graphql/[email protected]
could be found here:
graphql/graphql-js#927

Would be great if it can be fixed in our IDE instead of other tools. How can we support?

@portenez
Copy link

portenez commented Jan 3, 2018

I think it's important to get this fixed because it's standard in graphql with version 0.12. This means, that all other tools support this new syntax.

@jimkyndemeyer
Copy link
Collaborator

It's important to make a clear distinction between the versioned GraphQL specification and the graphql-js reference implementation.

Given the language-agnostic nature of GraphQL, this plugin interacts with endpoints written in a variety of programming languages and frameworks, each supporting potentially different versions of the GraphQL specification.

With breaking changes coming into play, this has introduced the need for #121. I cannot simply upgrade the language service to use [email protected] without breaking compatibility with a large number of existing endpoints.

Going forward, it might make sense to allow plugin users to pick the GraphQL spec version that their endpoint supports. In addition to the released spec versions, a "next" version could be used to point at a language service that is powered by the latest graphql-js, enabling access to RFC features.

For reference, the versions of the GraphQL specification can be found at https://github.com/facebook/graphql/releases

The relevant PR for this change is graphql/graphql-spec#90 and is still not part of a named GraphQL spec version.

@FedericoBiccheddu
Copy link

Bump.

The PR now seems to be merged and descriptions can be very useful when doing an introspection query.

Thanks for the hard work 🙏

@koresar
Copy link

koresar commented Jun 5, 2018

Thanks @jimkyndemeyer for the amazing plugin!

Any updates on this matter? The """ syntax is officially in GraphQL spec draft now:
http://facebook.github.io/graphql/draft/#sec-String-Value
http://facebook.github.io/graphql/draft/#sec-Descriptions

@jimkyndemeyer
Copy link
Collaborator

The 2.0 alpha follows the latest GraphQL language draft spec as of June 2018.

See 2.0.0-alpha-2 if you'd like to try it and help test it.

@blacksmoke26
Copy link

Still in progress?

WebStorm 2019.1 EAP
Build #WS-191.6014.17, built on March 6, 2019
WebStorm EAP User
Expiration date: April 5, 2019
JRE: 1.8.0_202-release-1483-b31 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 8.1 6.3

JS GraphQL: v 2.0.0-alpha-8

image

Still """ triple quote comment """ turns out into a warning?

Thank you for awesome tool 🥇

@jimkyndemeyer
Copy link
Collaborator

@blacksmoke26 The GraphQL grammar only allows the single/triple quote strings to be used as descriptions in type system definitions, hence the expectation that a definition follows immediately after.

Comments are still single line and marked by #.

See https://facebook.github.io/graphql/June2018/#sec-Appendix-Grammar-Summary.Document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants