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

URI and URI-reference are overlapping types #511

Closed
alanconway opened this issue Sep 19, 2019 · 5 comments
Closed

URI and URI-reference are overlapping types #511

alanconway opened this issue Sep 19, 2019 · 5 comments
Labels

Comments

@alanconway
Copy link
Contributor

This came up while implementing a Go mapping for the cloudevents type system. Here's the definition of URI and URI-reference:

URI - Absolute uniform resource identifier.
String encoding: Absolute URI as defined in RFC 3986 Section 4.3.
URI-reference - Uniform resource identifier reference.
String encoding: URI-reference as defined in RFC 3986 Section 4.1.

The issue is that all legal values of the URI type are also legal values of the URI-reference type. It is unusual to have a separate type to distinguish absolute URIs from relative-or-absolute URIs. In Go, python and ruby there is a single type (named URI or URL), and it has a test such as u.IsAbs() to distinguish absolute from relative values.

The URI type is only used in one place and there the language is ambiguous:

dataschema
Type: URI
Description: Identifies the schema that data adheres to. Incompatible changes to the schema SHOULD be reflected by a different URI. See Versioning of Attributes in the Primer for more information.
Constraints:
OPTIONAL
If present, MUST be a non-empty URI-reference

Note the conflicting claims that this attribute is of type URI but MUST be a URI-reference (which may be an invalid URI!) Can we drop the URI type and use URI-reference everywhere instead?

@duglin
Copy link
Collaborator

duglin commented Sep 19, 2019 via email

@duglin
Copy link
Collaborator

duglin commented Sep 19, 2019 via email

@duglin
Copy link
Collaborator

duglin commented Sep 20, 2019

For reference, this is the PR that changed it to URI: #475 (comment)

I think it was during a weekly call that someone raised a concern about it being a URI-reference.

duglin pushed a commit to duglin/spec that referenced this issue Sep 20, 2019
- s/0.4-wip/1.0-rc1/
- s/URI-reference/URI/ in scheme section for spec.md - per issue cloudevents#511 since it
was just a typo
- updated Roadmap to say we completed 1.0-rc1 milestone

Signed-off-by: Doug Davis <dug@us.ibm.com>
@duglin
Copy link
Collaborator

duglin commented Sep 20, 2019

@alanconway I fixed the URI-ref -> URI typo as part of #512

@duglin duglin added the v1.0 label Sep 20, 2019
@alanconway
Copy link
Contributor Author

I guess I'll drop this since we allow type-morphing to canonical string and URI < URI-reference < String. I think most programming language mappings and bindings will end up mapping URI and URI-reference to the same native type but that's OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants