Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Strict yaml validation? #34

Closed
ahmetb opened this issue Aug 21, 2015 · 12 comments · Fixed by #99
Closed

Strict yaml validation? #34

ahmetb opened this issue Aug 21, 2015 · 12 comments · Fixed by #99

Comments

@ahmetb
Copy link

ahmetb commented Aug 21, 2015

I have mistakes in my docker-compose.yml file such as mistyped keys (fooooocommand):

consul:
  fooooocommand: -server -node master2 -advertise 10.0.0.6 -join 10.0.0.4 -join 10.0.0.5
  image: progrium/consul
  ports:
  - 8300:8300

libcompose seems to be ignoring them, however docker-compose does strict validation and errors out. We probably need the same behavior here.

@thaJeztah
Copy link
Member

This PR was just merged in compose, and performs validation of the docker-compose.yml; docker/compose#1808, could be useful when implementing the same in libcompose.

@ahmetb
Copy link
Author

ahmetb commented Aug 21, 2015

Yes, jsonschema is most certainly a legit solution here as well and it has some good golang libs too.

@ibuildthecloud
Copy link
Contributor

That's a great idea if we can share schema files. I'll look for a Json schema validator in go, hopefully we don't have to write one.

@ibuildthecloud
Copy link
Contributor

But generally yes I agree with this issue. We should be stricter because I mistype things myself all the time.

@ibuildthecloud
Copy link
Contributor

Okay, found this https://github.com/xeipuuv/gojsonschema. It's on github, it has a common name, so I think that means its production ready :)

@thaJeztah
Copy link
Member

Okay, found this https://github.com/xeipuuv/gojsonschema. It's on github, it has a common name, so I think that means its production ready :)

It doesn't have tags or releases yet, so we may want to check that with the author of that project.

@ahmetb
Copy link
Author

ahmetb commented Sep 10, 2015

it'll probably just work :) why don't we give it a shot? anyone?

@ibuildthecloud
Copy link
Contributor

I'm all for it, worst case scenario is doesn't work. We got nothing to loose :)

@bfirsh
Copy link
Contributor

bfirsh commented Sep 23, 2015

See also: docker/compose#2089

@joshwget
Copy link
Contributor

Working on a PR for this, I think xeipuuv/gojsonschema will be sufficient. I've ran into a few small bugs(xeipuuv/gojsonschema#72, xeipuuv/gojsonschema#73, xeipuuv/gojsonschema#74), but I think I can include some band-aids to get around them until they're fixed.

@dnephin
Copy link
Contributor

dnephin commented Sep 28, 2015

@joshwget I just want to make sure that you saw the above message. We want to use the same schema from compose (see the linked issue docker/compose#2089). I wouldn't recommend creating a new schema. For now copying it into the repo, or curling it as part of a build step will have to do. We'll make it available in a more permanent way soon enough.

@joshwget
Copy link
Contributor

@dnephin I did see it, thanks! I'm currently developing with that schema.

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

Successfully merging a pull request may close this issue.

7 participants