Skip to content

handle changes in nullability#11

Open
sunshowers wants to merge 3 commits intomainfrom
sunshowers/spr/handle-changes-in-nullability
Open

handle changes in nullability#11
sunshowers wants to merge 3 commits intomainfrom
sunshowers/spr/handle-changes-in-nullability

Conversation

@sunshowers
Copy link
Copy Markdown
Contributor

@sunshowers sunshowers commented Feb 2, 2026

This makes a number of fixes to changes in nullability, found while working on some related code.

We define a notion of effective nullability in get_effective_nullable:

  • for a non-wrapper schema, its nullable value
  • for a wrapper schema, nullable || get_effective_nullable(wrapped)

The effective nullability changing is an incompatible change:

  • for an input type, nullable -> non-nullable is backward incompatible, and non-nullable -> nullable is forward incompatible
  • for an output type, nullable -> non-nullable is forward incompatible, and non-nullable -> nullable is backward incompatible

Also explain in doc comments what backward and forward incompatible (and all the other variants) mean.

Created using spr 1.3.6-beta.1
Comment thread src/schema.rs
Comment on lines +340 to +342
// honest, this seems a bit dubious. But does self.visited.insert even
// need to carry information about whether schemas are equal?)
let nullable_equal = old_schema_data.nullable == new_schema_data.nullable;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is pretty dubious but doesn't change old behavior. Do we even have to track equality in the visited map?

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.

1 participant