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

Change also_known_as type to OrderedSet #632

Merged
merged 2 commits into from
Jan 27, 2022
Merged

Conversation

cycraig
Copy link
Contributor

@cycraig cycraig commented Jan 27, 2022

Description of change

Changes the CoreDocument::also_known_as field from Vec<Url> to OrderedSet<Url> to comply with the DID specification: https://www.w3.org/TR/did-core/#also-known-as

The alsoKnownAs property is OPTIONAL. If present, the value MUST be a set where each item in the set is a URI conforming to [RFC3986].

where "set" is defined to be an OrderedSet: https://infra.spec.whatwg.org/#ordered-set .

Besides the API changes, this may break DID Documents which have duplicate entries in their alsoKnownAs section.
This also adds IotaDocument::also_known_as_mut() since previously there was no safe way to update the field from IotaDocument without going through the unsafe core_document_mut.

Changed

  • Change CoreDocument::also_known_as field from Vec<Url> to OrderedSet<Url>.
  • Change CoreDocument::also_known_as() method return from &[Url] to &OrderedSet<Url>.
  • Change CoreDocument::aslo_known_as_mut() method return from &mut Vec<Url> to &mut OrderedSet<Url>.
  • Change IotaDocument::also_known_as() method return from &[Url] to &OrderedSet<Url>.

Added

  • Add IotaDocument::also_known_as_mut() method.

Type of change

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Unit tests and examples pass locally.

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@cycraig cycraig added Wasm Related to Wasm bindings. Becomes part of the Wasm changelog Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Rust Related to the core Rust code. Becomes part of the Rust changelog. labels Jan 27, 2022
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@cycraig cycraig merged commit bf62a9a into dev Jan 27, 2022
@cycraig cycraig deleted the feat/also-known-as-set branch January 27, 2022 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Rust Related to the core Rust code. Becomes part of the Rust changelog. Wasm Related to Wasm bindings. Becomes part of the Wasm changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants