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

Rework interfaces and implementations #631

Merged
merged 4 commits into from
Jun 6, 2024
Merged

Conversation

milessabin
Copy link
Member

@milessabin milessabin commented Jun 5, 2024

  • Object type fields mapped at the interface level and interface type fields which are implemented or overridden at the object type level are now explicitly represented internally. This allows both more efficient lookup of inherited field mappings and correct lookup of overriden field mappings.
  • Field mapping lookup is now more effectively indexed in TypeMappings. This might give a noticeable performance improvement for ValueMapping. Now that this indexing in centralised in TypeMappings, the per-ObjectMapping field indices have been removed. If this proves problematic for applications it could be reinstated.
  • Schema validation now enforces the uniqueness of interfaces in implements clauses.
  • Schema validation now enforces that object and interface types must directly implement all transitively implemented interfaces. The allInterfaces method on InterfaceType has been deprecated because with the preceding validation change it is equivalent to interfaces.
  • The Mapping-specific logic of mkCursorForField has been extracted to mkCursorForMappedField allowing simpler mapping-specific implementations.
  • Previously introspection did not report interfaces implemented by interfaces.
  • Added Schema#implementations which returns the implementing object types of an interface.
  • The unsafe TypeMappings constructor has been deprecated and renamed to unchecked.
  • TypeMappings#unsafe has been renamed to unchecked and hidden
  • The implementations of hasField, nullableHasField, hasPath and hasListPath in Cursor had incorrect semantics and appear to be unused, so rather than fix them, they have been removed.
  • Various tests have been updated to conform to the newly implemented validation rules and changes to field mapping lookup.

+ Object type fields mapped at the interface level and interface type
  fields which are implemented or overridden at the object type level
  are now explicitly represented internally. This allows both more
  efficient lookup of inherited field mappings and correct lookup of
  overriden field mappings.
+ Field mapping lookup is now more effectively indexed TypeMappings.
  This might give a noticeable performance improvement for ValueMapping.
  Now that this indexing in centralised in TypeMappings, the
  per-ObjectMapping field indices have been removed. If this proves
  problematic for applications it could be reinstated.
+ Schema validation now enforces the uniqueness of interfaces in
  implements clauses.
+ Schema validation now enforces that object and interface types must
  directly implement all transitively implemented interfaces. The
  allInterfaces method on InterfaceType has been deprecated because with
  the preceeding validation change it would equivalent to interfaces.
+ The Mapping specific logic of mkCursorForField has been extracted to
  mkCursorForMappedField allowing simpler mapping-specific
  implementations.
+ Previously introspection did not report interfaces implemented by
  interfaces.
+ Added Schema#implementations which returns the implementing Object
  types of an interface.
+ The unsafe TypeMappings constructor has been deprecated and renamed to
  unchecked.
+ TypeMappings#unsafe has been renamed to unchecked and hidden
+ The implementations of hasField, nullableHasField, hasPath and
  hasListPath in Cursor had incorrect semantics and appear to be unused,
  so rather than fix them, they have been removed.
+ Various tests have been updated to conform to the newly implemented
  validation rules and changes to field mapping lookup.
Copy link
Member

@tpolecat tpolecat left a comment

Choose a reason for hiding this comment

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

Checks out with our big app. so good to go. Thanks for this, it's a big improvement! 👍🏻

@milessabin milessabin merged commit 379bb72 into main Jun 6, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants