Skip to content

Schema element descriptions can be set through comments#88

Merged
vladar merged 4 commits intowebonyx:masterfrom
ir-regular:schema-description-in-comments
Feb 7, 2017
Merged

Schema element descriptions can be set through comments#88
vladar merged 4 commits intowebonyx:masterfrom
ir-regular:schema-description-in-comments

Conversation

@ir-regular
Copy link
Copy Markdown
Contributor

Reason for change:

GraphQL schema shorthand parsing currently doesn't allow for adding descriptions to the type system.

Solution description:

Following the Javascript implementations, comment blocks immediately preceding a definition will be treated as a description.

Some examples:

# This is a description of MyType type
type FriendlyType {
  # This is a field description
  friendlyField: String
}

# This is a floating comment, and is therefore not treated as a description of UnfriendlyType

type UnfriendlyType {
  unfriendlyField: String # not a description, just an aside
}

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.05%) to 92.988% when pulling 060dc51 on jane-olszewska:schema-description-in-comments into c18cd16 on webonyx:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 93.064% when pulling 008fd20 on jane-olszewska:schema-description-in-comments into c18cd16 on webonyx:master.

@vladar vladar merged commit c2f0749 into webonyx:master Feb 7, 2017
@vladar
Copy link
Copy Markdown
Member

vladar commented Feb 7, 2017

Awesome! Thanks.

@ir-regular ir-regular deleted the schema-description-in-comments branch February 9, 2017 14:28
@Torsten85
Copy link
Copy Markdown
Contributor

Am I missing something or do comments disappear when calling AST::fromArray? Calling AST::toArray correctly writes the comments in the returned array.

@vladar
Copy link
Copy Markdown
Member

vladar commented Jan 17, 2018

Looks like it's the same as #201

@Torsten85
Copy link
Copy Markdown
Contributor

You are right! I'll keep an eye on that issue. Thank you!

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.

4 participants