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

Implement smarter is_subtype logic #741

Merged
merged 1 commit into from
Sep 25, 2023
Merged

Implement smarter is_subtype logic #741

merged 1 commit into from
Sep 25, 2023

Conversation

GlassOfWhiskey
Copy link
Contributor

Thic commit improves the is_subtype method to correctly handle a larger number of cases. In particular, it now deals with complex type definitions (i.e., those using record and array data structures) by correctly identifying when nested and recursive type definitions come with inheritance bounds.

@GlassOfWhiskey GlassOfWhiskey force-pushed the adjust-is-subtype branch 4 times, most recently from 65e1611 to 559c3d7 Compare September 24, 2023 13:52
@codecov
Copy link

codecov bot commented Sep 24, 2023

Codecov Report

Merging #741 (fef7256) into main (cfde2e6) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #741      +/-   ##
==========================================
+ Coverage   83.47%   83.50%   +0.02%     
==========================================
  Files          22       22              
  Lines        4502     4510       +8     
  Branches     1207     1212       +5     
==========================================
+ Hits         3758     3766       +8     
  Misses        482      482              
  Partials      262      262              
Files Changed Coverage Δ
schema_salad/avro/schema.py 70.55% <100.00%> (+0.61%) ⬆️
schema_salad/schema.py 78.32% <100.00%> (+0.06%) ⬆️

Thic commit improves the `is_subtype` method to correctly handle a
larger number of cases. In particular, it now deals with complex type
definitions  (i.e., those using `record` and `array` data structures) by
correctly identifying when nested and recursive type definitions come
with inheritance bounds.
@mr-c mr-c force-pushed the adjust-is-subtype branch 3 times, most recently from 3777960 to fef7256 Compare September 25, 2023 12:21
Copy link
Member

@tetron tetron left a comment

Choose a reason for hiding this comment

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

This LGTM

Notes from meeting:

  • Should update Schema Salad specification v1.2 to indicate the old behavior (can only subtype simple classes) and describe the new behavior in Schema Salad spec v1.3
  • SpecializeTo should be is_subtype of SpecializeFrom if it isn't checked already, maybe another thing to add for Schema Salad v1.3 spec

@mergify mergify bot merged commit f098da4 into main Sep 25, 2023
74 checks passed
@mergify mergify bot deleted the adjust-is-subtype branch September 25, 2023 15:52
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.

2 participants