-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allows references that point to parent definitions #39
Conversation
* Introduces a `resolvedSet` structure to mark references that have been (or are currently being) resolved, to avoid infinite loops. * Resolves references eagerly before child elements are resolved. This is more in line with [the spec], which states that elements with `$ref` should be replaced entirely with the representation that they point to. [the spec]: https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.28
3541090
to
302a2fa
Compare
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.
A few talking point, but looks fine.
Thank you very much!
.travis.yml
Outdated
install: go get code.google.com/p/go.tools/cmd/cover | ||
- 1.7 | ||
- 1.8 | ||
install: go get golang.org/x/tools/cmd/cover |
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.
You should able to drop this line entirely, cover no longer requires to be installed.
gen.go
Outdated
@@ -18,13 +18,23 @@ func init() { | |||
templates = template.Must(bundle.Parse(templates)) | |||
} | |||
|
|||
// resolvedSet stores a set of pointers to objects that have already been | |||
// resolved to prevent infinite loops. | |||
type resolvedSet map[interface{}]bool |
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.
Should this be exported, considering it's used in an exported function later?
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.
Yes, I think you're right. Good catch. Fixed.
@cyberdelia Thanks for the review. I pushed a couple of new commits based on your feedback. |
Lovely! Do you mind sharing a gist of the diff between your schema and the API one? It would help me plead your case on Monday. |
Fixes #29
Highlights
ResolvedSet
structure to mark references that have been (or are currently being) resolved, to avoid infinite loops.$ref
should be replaced entirely with the representation that they point to.Note that this still doesn't quite correctly generate the Heroku Platform API schema due to bugs in the schema itself (missing
type
information on some schemas). I've submitted a PR against the API to get that issue addressed, but until it's merged I've created a gist of the schema.json from my PR branch to test against.