-
Notifications
You must be signed in to change notification settings - Fork 694
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
schema: Add descriptor tests and fix mediaType pattern #448
Conversation
@@ -4,7 +4,7 @@ | |||
"mediaType": { | |||
"id": "https://opencontainers.org/schema/image/mediaType", | |||
"type": "string", | |||
"pattern": "^[a-z]+/[0-9a-zA-Z.+]+$" | |||
"pattern": "^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126}$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://tools.ietf.org/html/rfc6838#section-4.2 declare that:
Note that this syntax is somewhat more restrictive than what is
allowed by the ABNF in Section 5.1 of [RFC2045] or Section 4.2 of
[RFC4288]. Also note that while this syntax allows names of up to
127 characters, implementation limits may make such long names
problematic. For this reason, and SHOULD
be limited to 64 characters.
If we SHOULD limit the length to 64? After all, schema package is provided to customer for their implementation. We should eliminate problematic risk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We previously didn't limit the length at all ;). I'd rather go with the most generous interpretation of the current RFC (which I think matches what I have here :p) and leave it to consumers to add additional checks if they like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit test cases about descriptor
looks good and enough. meanwhile, we should also keep test cases in manifest
and manifest list
files cover important definitions for descriptor, because we have been aware that they use different schema branch sometime(more checking will be done after this PR landed).
On Sat, Nov 05, 2016 at 10:03:13PM -0700, xiekeyang wrote:
+1 for exactly this reason. |
@@ -19,7 +19,8 @@ The following fields contain the primary properties that constitute a Descriptor | |||
|
|||
- **`mediaType`** *string* | |||
|
|||
This REQUIRED property contains the MIME type of the referenced content. | |||
This REQUIRED property contains the media type of the referenced content. | |||
Values MUST comply with [RFC 6838][rfc6838]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restrict this MUST
to the format in the rfc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there a particular normative portion of RFC 6838 that you feel does not apply to mediaType
values? For example, the vendor tree semantics are outside of the naming requirements section, and I think both of those apply to mediaType
values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reference 4.2 directly. Most of the rest of the specification is related to registration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the rest of the specification is related to registration
Doesn't all the registration stuff still apply? For example §3.2 has:
While public exposure and review of media types to be registered in the vendor tree are not required, using the [email protected] mailing list for review is encouraged, to improve the quality of those specifications.
so I think our unregistered vendor types are fine. And I don't think our spec should allow unregistered standards-tree types (violating [§3.1]) or other RFC-violating media types, even if they happen to match the §4.2 syntax.
If you'd like to draw attention to §4.2 in particular, I'd be fine with:
Values MUST comply with RFC 6838, including the naming requirements in its §4.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wking That's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9e597ab
to
119ef52
Compare
Restore the MUST which was removed from the 15f9f74 version of this commit. My personal preference would be to just say: Values MUST comply with [RFC 6838][rfc6838]. But Stephen wanted a direct reference to 4.2 as well [1]. [1]: opencontainers#448 (comment) Signed-off-by: W. Trevor King <[email protected]>
119ef52
to
15dbdf5
Compare
This PR currently fails Travis [1], but the problem is unrelated
(#530).
[1]: https://travis-ci.org/opencontainers/image-spec/builds/195291380#L361
|
15dbdf5
to
070cd2a
Compare
On Wed, Jan 25, 2017 at 04:25:28PM -0800, W. Trevor King wrote:
This PR currently fails Travis [1], but the problem is unrelated
(#530).
|
@opencontainers/image-spec-maintainers PTAL |
Working these up turned up a few bugs in the old schema, which we've fixed in the earlier commits in this series. Signed-off-by: W. Trevor King <[email protected]>
070cd2a
to
be553fb
Compare
1 similar comment
Restore the MUST which was removed from the 15f9f741 version of this commit. My personal preference would be to just say: Values MUST comply with [RFC 6838][rfc6838]. But Stephen wanted a direct reference to 4.2 as well [1]. [1]: opencontainers/image-spec#448 (comment) Signed-off-by: W. Trevor King <[email protected]>
Restore the MUST which was removed from the 15f9f741 version of this commit. My personal preference would be to just say: Values MUST comply with [RFC 6838][rfc6838]. But Stephen wanted a direct reference to 4.2 as well [1]. [1]: opencontainers/image-spec#448 (comment) Signed-off-by: W. Trevor King <[email protected]>
Restore the MUST which was removed from the 15f9f741 version of this commit. My personal preference would be to just say: Values MUST comply with [RFC 6838][rfc6838]. But Stephen wanted a direct reference to 4.2 as well [1]. [1]: opencontainers/image-spec#448 (comment) Signed-off-by: W. Trevor King <[email protected]>
Restore the MUST which was removed from the 15f9f741 version of this commit. My personal preference would be to just say: Values MUST comply with [RFC 6838][rfc6838]. But Stephen wanted a direct reference to 4.2 as well [1]. [1]: opencontainers/image-spec#448 (comment) Signed-off-by: W. Trevor King <[email protected]>
Restore the MUST which was removed from the 15f9f741 version of this commit. My personal preference would be to just say: Values MUST comply with [RFC 6838][rfc6838]. But Stephen wanted a direct reference to 4.2 as well [1]. [1]: opencontainers/image-spec#448 (comment) Signed-off-by: W. Trevor King <[email protected]>
Cherry-picking the $ref fix from #444, since there was a lot going on
in that PR around the manifest list. Fixing those things is good, but
I thought it would help review to have something that just focused on
descriptor bugs.
CC @xiekeyang.