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

Add validation to check schema definitions are compatible with the bundled ones #5444

Merged
merged 12 commits into from Dec 12, 2023

Conversation

BoD
Copy link
Contributor

@BoD BoD commented Dec 6, 2023

Make sure the definitions are "semantically equal".

Copy link

netlify bot commented Dec 6, 2023

Deploy Preview for apollo-android-docs canceled.

Name Link
🔨 Latest commit b0a6291
🔍 Latest deploy log https://app.netlify.com/sites/apollo-android-docs/deploys/657733ea81eea80008a458c6

@BoD BoD force-pushed the fix-npe-when-catch-not-imported branch from b671798 to c503433 Compare December 11, 2023 12:36
BoD and others added 2 commits December 11, 2023 15:53
…pollo3/ast/internal/SchemaValidationScope.kt

Co-authored-by: Martin Bonnin <martin@mbonnin.net>
Comment on lines 138 to 139
private fun GQLDirective.isDefinedAndMatchesOriginalName(schema: Schema, originalName: String): Boolean {
return schema.directiveDefinitions.get(name) != null && schema.originalDirectiveName(name) == originalName
Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies for nitpicking this but I'd rather have the codegen crash than silently ignore missing directive definitions.
All directive usage of @catch must be validated at that point so if we don't have a directive definition, it's a programming error that I'd rather catch (no pun intended) early

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why I had the impression it would still NPE without this, but it's not the case - just removed it 👍

@martinbonnin
Copy link
Contributor

Can you update the title/description of this PR ?

@BoD BoD changed the title Avoid an NPE when a non-imported @catch directive is applied Add validation to check schema definitions are compatible with the bundled ones Dec 11, 2023
@martinbonnin martinbonnin merged commit 367714a into main Dec 12, 2023
9 checks passed
@martinbonnin martinbonnin deleted the fix-npe-when-catch-not-imported branch December 12, 2023 09:11
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