Open brunodantas opened 1 year ago
oh that's a cool suggestion! how would this work? would you pass the old SDL and figure the breaking changes from there?
Yes, that sounds great for a CLI command. The same command could also have two SDLs as input and call the graphql-core function from there.
So something like this:
strawberry find-breaking-changes old-schema.graphql
strawberry find-breaking-changes old-schema.graphql current-schema.graphql
we could do the same for find dangerous changes 🤔 or combine the two commands into one, I need to think about the naming
maybe strawberry audit
could be a good one, I was thinking about strawberry lint
but that wouldn't make a lot of sense when passing an old schema
happy to take any suggestion :)
There's this tool that does this kind of stuff... kamilkisiela/graphql-inspector: 🕵️♀️ Validate schema, get schema change notifications, validate operations, find breaking changes, look for similar types, schema coverage
We can maybe take inspiration from them and call it strawberry inspect
.
In their CLI they call the specific command diff
:
Diff and Validate GraphQL Schemas – GraphQL Inspector
Yet another option: Apollo also has a schema check feature: https://www.apollographql.com/docs/rover/commands/graphs/#graph-check
Oh and I was gonna call it something like schema_check in my project 🙃
Oh and I was gonna call it something like schema_check in my project 🙃
ah!
to add more ideas, we could allow using pyproject.toml to specify the options, but that could come later, for now we could allow this:
strawberry check path.to.schema
strawberry check --previous-schema something.graphql path.to.schema # breaking maybe enabled by default
strawberry check --breaking --dangerous --previous-schema something.graphql path.to.schema
what do you think?
Looking at the command strawberry export-schema
, I feel like this needs to be called strawberry check-schema
haha
Other than that, LGTM
Is the input SDL or a Strawberry schema? Or both?
path.to.schema
makes it look like it's module only
module, would you prefer to pass the sdl? why? 😊
I'm planning to compare the current schema (module) with the old SDL schema that's in a file being version-controlled (for clarity in schema changes). So it's a use case with mixed representation kinds.
But I would prefer both module and SDL inputs for flexibility, if possible 😁
Feature Request Type
Description
It would be nice to have builtin strawberry utilities that perform schema check functionality like graphql-core's find_breaking_changes and find_dangerous_changes.
Note: this functionality is currently achievable by using the Strawberry export tool into GraphQL SDL and then running the graph-ql core function.
Upvote & Fund