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

Allow output of schema.json from ApolloCodegenLib #2155

Closed
bdrelling opened this issue Feb 10, 2022 · 3 comments · Fixed by #2160
Closed

Allow output of schema.json from ApolloCodegenLib #2155

bdrelling opened this issue Feb 10, 2022 · 3 comments · Fixed by #2160
Assignees

Comments

@bdrelling
Copy link

Feature request

Allow output of schema.json instead of schema.graphqls via ApolloCodegenLib usage.

Motivation

Attempting to follow the Swift scripting guide. We use schema.json explicitly, but the output only works as schema.graphqls.

Proposed solution

That the tool allows selection between graphqls or json output. If it currently does, I cannot figure out how via docs or code exploration. The guide seems to imply schema.json can be used.

Outstanding Questions

  • Does this already exist? If so, how can it be achieved?
@calvincestari
Copy link
Member

Thanks for raising this discrepancy @bdrelling - is the issue that you actually need json output or that the guide is incorrect

The guide is easy enough to fix but we specifically selected SDL output because it is vastly more human-readable than the json output. If json output is what you need I'm interested in learning more of your use-case to understand that need better.

@bdrelling
Copy link
Author

I'n not sure if the guide is incorrect, it mentions schema.json all over the place, so it's not immediately obvious what the preference is from Apollo's side. Many of our workflows currently use the schema.json today because we had issues with SDL exporting via the apollo-cli, which we are no longer directly using.

We're fine using the SDL / graphqls output, and it works for us in our use case when following the Swift scripting guide, but we previously used a schema.json. I think if it's simple, providing the option for users makes a lot of sense.

In terms of readability, that is something we discussed on my team as well--I think many of us find the JSON much more readable, but it could just be because we're not used to seeing the SDL output.

@calvincestari
Copy link
Member

I'n not sure if the guide is incorrect, it mentions schema.json all over the place, so it's not immediately obvious what the preference is from Apollo's side.

Fair comment, by "incorrect" I mean that the guide isn't matching what the code does which I take to be the source of truth. I'll get the docs updated to match.

Many of our workflows currently use the schema.json today because we had issues with SDL exporting via the apollo-cli, which we are no longer directly using.

With the merging of #1935 apollo-cli is no longer used for schema downloading, and the 1.0 branches don't use apollo-cli at all, #2003 removed it completely.

I think if it's simple, providing the option for users makes a lot of sense.

In terms of readability, that is something we discussed on my team as well--I think many of us find the JSON much more readable, but it could just be because we're not used to seeing the SDL output.

I've created #2159 where we can track the final decision to add a config option for json output.

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 a pull request may close this issue.

2 participants