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(): Apply transformSchema to autoSchemaFile #996

Merged
merged 1 commit into from
Jul 9, 2020

Conversation

mattleff
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #993

What is the new behavior?

The transformSchema option is now applied when writing a autoSchemaFile to the filesystem.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@mattleff mattleff marked this pull request as ready for review June 25, 2020 16:35
@sgarner
Copy link

sgarner commented Jun 25, 2020

@mattleff This looks like a good change and I love that you are solving the schema sorting problem 👍

But when applying transformSchema to the schema file, I think it might be good to either make this optional, or pass an argument to the transformSchema function so that we can customise transformation behavior depending on whether it is being applied for runtime or for file generation.

transformSchema can be used to enable Schema Stitching. In that case the result of transformSchema will be a gateway schema that combines the local schema with potentially multiple remote schemas. For my use case, I would prefer that the auto schema file only prints the local schema, and not the stitched gateway schema - which will no longer be the case with this PR.

@mattleff
Copy link
Contributor Author

@sgarner Thanks for your feedback! I've made another PR to provide a sortSchema option: #997. That PR resolves my issue (#993) so I'll let @kamilmysliwiec decide if he wants this change as well.

@kamilmysliwiec
Copy link
Member

But when applying transformSchema to the schema file, I think it might be good to either make this optional, or pass an argument to the transformSchema function so that we can customise transformation behavior depending on whether it is being applied for runtime or for file generation.

To avoid breaking changes, I'd suggest applying transformSchema IF a dedicated flag (option) is enabled. :) Would you be able to align PR to such a requirement?

@mattleff
Copy link
Contributor Author

To avoid breaking changes, I'd suggest applying transformSchema IF a dedicated flag (option) is enabled. :) Would you be able to align PR to such a requirement?

Sure. Does transformAutoFileSchema: boolean sound right?

@kamilmysliwiec
Copy link
Member

@mattleff I like it!

@mattleff
Copy link
Contributor Author

mattleff commented Jul 2, 2020

@kamilmysliwiec This is ready for review again.

@kamilmysliwiec kamilmysliwiec merged commit 5374dc7 into nestjs:master Jul 9, 2020
@kamilmysliwiec
Copy link
Member

Looks great, thank you!

@mattleff mattleff deleted the transform-autoSchemaFile branch July 9, 2020 14:12
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

3 participants