-
Notifications
You must be signed in to change notification settings - Fork 191
Conversation
@joshwget for the purpose of review can you separate into two commits, one for Godeps and the other for your code changes. Thanks. |
06fbbeb
to
a34464b
Compare
@ibuildthecloud Good idea. Updated! |
@joshwget needs a rebase and a change (no more |
cdb63e6
to
9afb4f8
Compare
@vdemeester No problem! It should be up to date now. |
I don't understand this. Are you using that it doesn't support |
) | ||
|
||
var fieldsSchemaLoader gojsonschema.JSONLoader | ||
var serviceSchemaLoader gojsonschema.JSONLoader |
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.
I don't think these need to be package level vars, they're only used in one function (plus a setup function, which could be made to return these instead).
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.
@joshwget I think you can go one of two ways with this. Either call setupSchemaLoaders()
from init()
such that it's done once, or call setupSchemaLoaders()
every time and not cache at the package level. Currently this code will suffer from (albeit unlikely) race conditions. I would prefer you call it from init()
. From a server context I'd rather initialize this structure once.
Can you confirm that gojsonschema.JSONLoader can be used concurrently across goroutines?
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.
I hadn't actually considered this. I'll call it in init()
.
There's an issue about thread safety, but it hasn't received any response yet. The issue is about something different, but it's actually better to cache that than a JSONLoader.
This is how you would specify a reference, but I don't think these still work when you inline the schemas in |
Ah, I see what you mean, thanks. |
@dnephin @ibuildthecloud @vdemeester Updated to use I updated the schemas to the latest from Compose at the same time, which required a few changes to how validation is done. Rather than a single I'm still unsure whether |
811cda0
to
65e7cbc
Compare
@dnephin @ibuildthecloud @vdemeester Rebased and updated to the latest schema, as well as a few other minor changes |
Looks good. I have to review it more in depth though 😛. I wonder if the validate mechanism ( I'm working on Needs a rebase again 😅. |
Signed-off-by: Josh Curl <hello@joshcurl.com>
65e7cbc
to
20ad9f1
Compare
Rebased! I really like the idea of a |
@joshwget Hum, you're right about the interpolation, could go to I'm not found of the LGTM 🐮 |
As an alternative to |
@joshwget I would prefer that 😄 |
Signed-off-by: Josh Curl <hello@joshcurl.com>
20ad9f1
to
7b7ca41
Compare
I definitely prefer that approach as well. Updated to remove |
@joshwget let's merge this and iterate over it 😝 |
Fixes #34. This makes use of xeipuuv/gojsonschema and gives error messages that match those in Compose for the most part.
This also reuses the same schemas as in Compose, with one small caveat. I removed the following line from service_schema.json:
This code always checks against fields_schema anyways, so the reference here would just add redundant validation. There's also no way in gojsonschema to handle references when schemas are provided as strings.
There are a few instances of awkward workarounds and manual parsing of the schema due to limitations in gojsonschema. These can be cleaned up once those issues are fixed.
Signed-off-by: Josh Curl hello@joshcurl.com