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

Deprecate sizeSpec in favor of subtypeSpec #172

Merged
merged 3 commits into from
Aug 25, 2019
Merged

Conversation

etingof
Copy link
Owner

@etingof etingof commented Aug 25, 2019

This commit deprecates subtypeSpec attributes and keyword argument. It is now recommended to pass ValueSizeConstraint, as well as all other constraints, to subtypeSpec.

By way of the change mentioned above, this commit fixes a design bug in a way of how the items assigned to constructed types are verified. Now if Asn1Type-based object is assigned, its compatibility is verified based on having all tags and constraint objects as the type in field definition. When a bare Python value is assigned, then field type object is cloned and initialized with the bare value (constraints verification would run at this moment).

Added `isInconsistent` property to all constructed types. This property
conceptually replaces `verifySizeSpec` method to serve a more general
purpose e.g. ensuring all required fields are in a good shape. By
default this check invokes subtype constraints verification and is run
by codecs on value de/serialisation.
This commit deprecates `subtypeSpec` attributes and keyword argument.
It is now recommended to pass `ValueSizeConstraint`, as well as all
other constraints, to `subtypeSpec`.

By way of the change mentioned above, this commit fixes a design bug
in a way of how the items assigned to constructed types are verified.
Now if `Asn1Type`-based object is assigned, its compatibility is
verified based on having all tags and constraint objects as the type
in field definition. When a bare Python value is assigned, then field
type object is cloned and initialized with the bare value (constraints
verificaton would run at this moment).
@etingof etingof merged commit 41ce2e5 into master Aug 25, 2019
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