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

feat(cli): add generate schema command #120

Merged
merged 2 commits into from
Mar 8, 2024
Merged

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Mar 8, 2024

Summary

Add generate-schema command which takes a URL | path to a JSON file and outputs a graphql schema. Example:

  • gql-tada generate-schema https://example.com --header 'authorization: bearer token'
  • gql-tada generate-schema ./introspection.json

Copy link

changeset-bot bot commented Mar 8, 2024

🦋 Changeset detected

Latest commit: 6e6e3e5

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@JoviDeCroock JoviDeCroock requested a review from kitten March 8, 2024 08:43
.option('--header', 'Pass a header to be used when fetching the introspection.')
.example("generate-schema https://example.com --header 'Authorization: Bearer token'")
.example('generate-schema ./introspection.json')
.action(async (target, destination, options) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably makes sense to read the destination from the tsconfig.json (similar to:

await ensureTadaIntrospection(foundPlugin.schema, foundPlugin.tadaOutputLocation!);
)

Both commands could later on allow for an override option (e.g. -o --output, I guess. But we have the benefit of knowing where that schema should end up

@JoviDeCroock JoviDeCroock requested a review from kitten March 8, 2024 09:24
@JoviDeCroock JoviDeCroock merged commit 2427fe0 into main Mar 8, 2024
2 checks passed
@JoviDeCroock JoviDeCroock deleted the generate-schema-command branch March 8, 2024 09:49
@github-actions github-actions bot mentioned this pull request Mar 7, 2024
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.

None yet

2 participants