-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
cli: fix bug when exporting metadata to remote_schemas.yaml #8921
Conversation
Beep boop! 🤖 Hey @kmtym1998, thanks for your PR! One of my human friends will review this PR and get back to you as soon as possible. Stay awesome! 😎 |
Hi @kmtym1998, thanks for your PR! Sorry for not reviewing this last week, I was a bit busy. I'll take a look at this sometime this week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kmtym1998 thank you for taking the time to submit this PR! ❤️ It looks good to me!
@scriptonist I have gone through the changes, can you please glance through this as well and then we can merge this.
LGTM @m-Bilal |
GITHUB_PR_NUMBER: 8921 GITHUB_PR_URL: #8921 PR-URL: hasura/graphql-engine-mono#5744 Co-authored-by: Ryohei KOMATSUYAMA <[email protected]> GitOrigin-RevId: cc0948b62c3caccfb2c814433bb1a84508e3c37e
Beep boop! 🤖 Awesome work @kmtym1998! Your changes were merged successfully. All of us at Hasura ❤️ what you did. Thanks again 🤗 |
Description
FormatSchemaDocument
to format remote schema permission instead ofFormatSchema
becauseFormatSchema
dropsschema {}
clauseremote_schemas.yaml
FYI : formatter library code useing on hasura-cli: https://github.com/vektah/gqlparser/blob/v2.4.3/formatter/formatter.go
Changelog
Component : cli
Type: bugfix
Product: community-edition
Short Changelog
fix bug when exporting metadata to
remote_schemas.yaml
(#8579)Long Changelog
Related Issues
#8579
Solution and Design
When I click the
save permissions
button on hasura console, schema string containingschema
clause is sent to the endpoint/apis/migrate
, so I have determined that it is not a bug in console, but in cli that exports metadata.I found cli format GraphQL schema using
vektah/gqlparser/v2/formatter
before exporting metadata toremote_schemas.yaml
.vektah/gqlparser/v2/formatter
has two methods to format gql schema (FormatSchema
,FormatSchemaDocument
).FormatSchema
missesschema
clause ifschema.query
isQuery
. I confirmed the same behavior in case ofMutation
andSubscription
(related issue). Since this does not happen withFormatSchemaDocument
, I decided to use the method.Differences in two methods behavior can be seen on my fork. Code is here.
Steps to test and verify
remote_schemas.yaml
and check ifschema {}
clause exists on the roleServer checklist
Catalog upgrade
Does this PR change Hasura Catalog version?
Metadata
Does this PR add a new Metadata feature?
run_sql
auto manages the new metadata through schema diffing?run_sql
auto manages the definitions of metadata on renaming?export_metadata
/replace_metadata
supports the new metadata added?GraphQL
Breaking changes
No Breaking changes
There are breaking changes:
Metadata API
Existing
query
types:args
payload which is not backward compatibleJSON
schemaGraphQL API
Schema Generation:
NamedType
Schema Resolve:-
null
value for any input fieldsLogging
JSON
schema has changedtype
names have changed