-
Notifications
You must be signed in to change notification settings - Fork 676
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
examples: validate markdown examples #41
Conversation
|
||
var specsByMediaType = map[string]string{ | ||
"application/vnd.oci.image.manifest.v1+json": "schema/image-manifest-schema.json", | ||
"application/vnd.oci.image.manifest.list.v1+json": "schema/manifest-list-schema.json", |
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.
Probably better to have a pattern like “remove the application/vnd.oci.
prefix and replace +
with .
” to get filenames from media types.
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.
eh? I don't follow.
@stevvooe it does make me think the schema files could be named more aligned with the mime type
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.
@vbatts Why not name the files exactly the same as the mime type?
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.
gosh. I must be dyslexic.
This is what I was thinking
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.
On Fri, Apr 22, 2016 at 07:26:53AM -0700, Brandon Philips:
“Why not name the files exactly the same as the mime type?”
Reasons why I like:
$ echo application/vnd.oci.image.manifest.v1+json |
sed 's|application/vnd.oci.||;s|[+]|.|'
image.manifest.v1.json
more are:
- application/stuff is a filename on Windows and a path into a
subdirectory on POSIX. - vnd.oci. is noise in this repo (although that noise isn't a
terrible problem if you want to keep it). - +json is an odd file extension (although again, you can keep it if
you 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.
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.
WFM for now
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.
@stevvooe It would be good to stay consistent. For example image-manifest-schema and image-manifest-list-schema. manifest-list is missing image-.
#bikeshed
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.
@philips I noticed that. I'm also not sure about the image-
prefix.
Let's fix it up in another PR.
(sidenote: international emoji for bikeshed is 🚲 🏠)
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.
ack
On Thu, Apr 21, 2016 at 05:39:16PM -0700, Stephen Day wrote:
The drawback to this approach (vs. stand-alone files will all embedded |
@wking if it gets annoying we can reconsider. |
@stevvooe Shall we just merge this as is? |
@philips I've been out with a surgery for a few days. I'll take a clean up pass over this and we can go forward with it. |
@stevvooe Oh! Well, I hope you have a speedy recovery! If you want one of us can take it over and merge it in. Let us know! |
@stevvooe Shall I just merge this as-is then do follow-up PRs? |
@philips I'm putting the changes in right now. |
To ensure that examples in the specification match up with the json schemas, we propose a validation approach that will extract the fenced code blocks from the markdown document and validate them. Examples are marked with specification mediatypes which are then validated against the respective json shema doc. From here, we can propose that all examples be part of the specification. Each act of clarification would be represented within the specification and validated against the schema. The tool can be run from the root repository directory with the following command: ```console $ go run examples.go < manifest.md ok application/vnd.oci.image.manifest.list.v1+json ok application/vnd.oci.image.manifest.v1+json ``` This changeset should be followeb by the following tasks: 1. Integrate with top-level Makefile. 2. Move tools (validate.go, examples.go) to `cmd/` directory. 3. Run validation as part of travis CI testsuite. Note that there seems to be a bug in the schema validator when using recursive references. We can investigate this after this PR is merged. Signed-off-by: Stephen J Day <stephen.day@docker.com>
We can work out the hierarchy more carefully and likely merge these, but these tools have been moved into cmd/, per Go best practices. Signed-off-by: Stephen J Day <stephen.day@docker.com>
8b8e367
to
48c6221
Compare
Changes:
Follow up items:
Caveats:
Recommendation:
|
LGTM @s-urbaniak is looking at merging validation tools via #43 |
cool cool. @stevvooe is there value in keeping these as two commits? |
@vbatts I separated the implementation and the Makefile move. |
LGTM |
To ensure that examples in the specification match up with the json
schemas, we propose a validation approach that will extract the fenced
code blocks from the markdown document and validate them. Examples are
marked with specification mediatypes which are then validated against
the respective json shema doc.
From here, we can propose that all examples be part of the
specification. Each act of clarification would be represented within the
specification and validated against the schema.
The tool can be run from the root repository directory with the
following command:
This is a work in progress to validate the concept. The following needs
to be addressed before merging:
cmd/
directory.Closes #34, requires #40
Signed-off-by: Stephen J Day stephen.day@docker.com