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 #399

Closed
fxamacker opened this issue May 1, 2023 · 0 comments · Fixed by #400
Closed

Deprecate Valid() and add Wellformed() to replace it #399

fxamacker opened this issue May 1, 2023 · 0 comments · Fixed by #400
Assignees
Labels
enhancement New feature or request

Comments

@fxamacker
Copy link
Owner

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

Although the old docs for Valid() correctly said it checks for well-formedness, Valid() is not an appropriate function name because it can lead to confusion.

Proposed Solution

  • Add Wellformed() as a replacement for Valid().
  • For now, deprecate Valid() and make it call Wellformed(). This makes Valid() behave the same in v2.5.0 as prior releases.

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.

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

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 a pull request may close this issue.

1 participant