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 Valid() and add Wellformed() to replace it #400

Merged
merged 1 commit into from
May 1, 2023

Conversation

fxamacker
Copy link
Owner

Valid() is deprecated and only calls WellFormed(), so it will behave the same way between current v2.4 and upcoming v2.5 release.

Projects should begin replacing calls to Valid() with calls to WellFormed().

Although the old docs for Valid() correctly said it checks for well-formedness, this refactor was done because Valid() is not an appropriate function name.

RFC 8949 distinctly defines what is "Valid" and what is "Well-formed".

Wellformed() checks whether data is a well-formed encoded CBOR data item and that it complies with additional restrictions such as MaxNestedLevels, MaxArrayElements, MaxMapPairs, etc. If there are any remaining bytes after the encoded CBOR data item, then ExtraneousDataError is returned.

While at it, also updated comments to more closely match terminology used in RFC 8949.

Closes #399

Valid() is deprecated and only calls WellFormed(), so it will
behave the same way between current v2.4 and upcoming v2.5 release.

Projects should begin replacing calls to Valid() with calls to WellFormed().

Although the old docs for Valid() correctly said it checks for well-formedness,
this refactor was done because Valid() is not an appropriate function name.

RFC 8949 distinctly defines what is "Valid" and what is "Well-formed".

Wellformed() checks whether data is a well-formed encoded CBOR data item and
that it complies with additional restrictions such as MaxNestedLevels,
MaxArrayElements, MaxMapPairs, etc.  If there are any remaining bytes
after the encoded CBOR data item, then ExtraneousDataError is returned.
@fxamacker fxamacker self-assigned this May 1, 2023
@fxamacker fxamacker added the enhancement New feature or request label May 1, 2023
Copy link
Contributor

@x448 x448 left a comment

Choose a reason for hiding this comment

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

LGTM!

@fxamacker fxamacker merged commit 3343ed2 into master May 1, 2023
@fxamacker fxamacker added this to the v2.5.0 milestone May 7, 2023
@fxamacker fxamacker deleted the fxamacker/add-wellformed-function branch June 18, 2023 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate Valid() and add Wellformed() to replace it
2 participants