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

schema: Add descriptor tests and fix mediaType pattern #448

Merged
merged 2 commits into from
Jan 31, 2017

Conversation

wking
Copy link
Contributor

@wking wking commented Nov 5, 2016

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.

@@ -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}$"
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@xiekeyang xiekeyang left a 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).

@wking
Copy link
Contributor Author

wking commented Nov 6, 2016

On Sat, Nov 05, 2016 at 10:03:13PM -0700, xiekeyang wrote:

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…

+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].
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

@wking wking Jan 25, 2017

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

@wking That's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wking That's fine.

Done with 119ef5215dbdf5.

@wking
Copy link
Contributor Author

wking commented Jan 25, 2017

Rebased onto master with 9e597ab119ef52 now that #444 has landed.

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]>
@stevvooe
Copy link
Contributor

stevvooe commented Jan 25, 2017

LGTM

Approved with PullApprove

@wking
Copy link
Contributor Author

wking commented Jan 26, 2017 via email

@wking
Copy link
Contributor Author

wking commented Jan 26, 2017 via email

@stevvooe
Copy link
Contributor

@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]>
@wking
Copy link
Contributor Author

wking commented Jan 26, 2017 via email

@vbatts
Copy link
Member

vbatts commented Jan 31, 2017

LGTM

Approved with PullApprove

1 similar comment
@stevvooe
Copy link
Contributor

stevvooe commented Jan 31, 2017

LGTM

Approved with PullApprove

@stevvooe stevvooe merged commit 5fccf47 into opencontainers:master Jan 31, 2017
@wking wking deleted the descriptor-tests branch February 3, 2017 05:32
dattgoswami9lk5g added a commit to dattgoswami9lk5g/bremlinr that referenced this pull request Jun 6, 2022
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]>
7c00d pushed a commit to 7c00d/J1nHyeockKim that referenced this pull request Jun 6, 2022
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]>
7c00d added a commit to 7c00d/J1nHyeockKim that referenced this pull request Jun 6, 2022
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]>
laventuraw added a commit to laventuraw/Kihara-tony0 that referenced this pull request Jun 6, 2022
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]>
tomalopbsr0tt added a commit to tomalopbsr0tt/fabiojosej that referenced this pull request Oct 6, 2022
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]>
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

Successfully merging this pull request may close these issues.

4 participants