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

Global tag URI validity #38

Closed
Thom1729 opened this issue Aug 28, 2019 · 1 comment
Closed

Global tag URI validity #38

Thom1729 opened this issue Aug 28, 2019 · 1 comment

Comments

@Thom1729
Copy link
Collaborator

The spec says the following about global tag prefixes:

If the prefix begins with a character other than “!”, it must to be a valid URI prefix, and should contain at least the scheme and the authority. Shorthands using the associated handle are expanded to globally unique URI tags, and their semantics is consistent across applications. In particular, every documents in every stream must assign the same semantics to the same global tag.

What is a “valid URI prefix”? Is it any string that is the prefix of some valid URI? And what does it mean to “contain at least… the authority”? Typically global URI tags use the Tag URI scheme, which always has an empty authority component. (In tag:yaml.org,2002:bool, the authority is empty and the path is yaml.org,2002:bool.) Should this be interpreted to mean that the prefix should uniquely specify the authority, so that every possible URI beginning with the prefix has the same authority? If so, i think this would be equivalent to requiring that the URI contain at least one character from the path, query, or fragment components.

A few examples:

  • tag: includes the scheme, but no authority. It could be the prefix of a URI with an authority, which would be valid as a URI but invalid as a Tag URI.
  • tag:foo does not include an authority component, but one must presume it to be a valid URI prefix.
  • http://example.com includes an authority component, but it is a prefix of http://example.com.example.com, which has a different authority component.
  • http:/ is, by itself, a valid URI with a scheme, an empty authority component, and a path (/). However, it is a prefix of the URI http://example.com, which has a different authority component.

Also, the spec says that:

The resulting parsed tag is the concatenation of the prefix and the suffix, and must either begin with “!” (a local tag) or be a valid URI (a global tag).

If a processor encounters a global tag that is not a valid URI, should it raise an error? If so, at what point in the loading process should the error be raised?

@Thom1729
Copy link
Collaborator Author

The simplest way to go for 1.2.1 would be to say that a global prefix should contain the scheme, but to say nothing about the authority.

If we really want to keep the authority part, we might say that a global prefix should not be the prefix of any two URIs with different authority components. This would disallow tag:, http://example.com, and http:/, but would allow tag:foo and http://example.com/. I think that this is much too conservative, but I'm not sure what alternative we could unambiguously specify.

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

No branches or pull requests

1 participant