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

support recursive arrays / arrays of references (plus a bunch of other changes) #55

Merged
merged 13 commits into from
Feb 4, 2019
Merged

Conversation

mwlazlo
Copy link
Contributor

@mwlazlo mwlazlo commented Oct 10, 2018

This patch enables recursive references and nested arrays of references...
I also added a few more test schemas of things I'd like to implement if I get some more time.

@mwlazlo
Copy link
Contributor Author

mwlazlo commented Oct 14, 2018

So I had another branch I've been working on that I think has reached the point of a 0.1 release. It seems to handle anything I can throw at it with the exception of oneOf, allOf, anyOf.

It also generates code to marshal/unmarshal additionalProperties in the presence of regular properties.

@mwlazlo mwlazlo changed the title support recursive arrays / arrays of references support recursive arrays / arrays of references (plus a bunch of other changes) Oct 14, 2018
…r stand alone or in the presence of regular properties

- test cases for marshal/unmarshal
- validation of required properties
@@ -85,6 +86,7 @@ func TestThatPropertiesCanBeParsed(t *testing.T) {
}
}

/*
Copy link
Owner

Choose a reason for hiding this comment

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

If this is going, lets just delete it instead of commenting it out.

output_test.go Outdated
}
}

/*
Copy link
Owner

Choose a reason for hiding this comment

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

Prefer deletion to commenting out.

refresolver.go Outdated


func (r *RefResolver) mapPaths(schema *Schema) error {

Copy link
Owner

Choose a reason for hiding this comment

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

Remove line?

input.go Outdated
)

func ReadInputFiles(inputFiles []string) ([]*Schema, error) {

Copy link
Owner

Choose a reason for hiding this comment

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

Remove spare line.

@@ -0,0 +1,311 @@
package generate
Copy link
Owner

Choose a reason for hiding this comment

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

It's a shame this isn't picked up as a move. A few people have worked on it, as a delete and create, then it might not pick up their names as authors. I'm not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

$ git log --follow jsonschema.go
... returns the full history, not sure why it doesn't get transferred from the rename...
The blame log remains the same though. Could start an AUTHORS or ChangeLog file?

@a-h
Copy link
Owner

a-h commented Oct 17, 2018

Thanks so much for your efforts, it's looking pretty good to me so far. It definitely fixes a few things. Would be interested to hear from other people using the tool too.

Some of the output looks a little unformatted.

screen shot 2018-10-17 at 20 01 24

Maybe we need to rethink how sensible it is to use the description field as a type name. I'm seeing that used a lot for a long form description, so some type names are coming out silly.

screen shot 2018-10-17 at 20 05 04

screen shot 2018-10-17 at 20 05 22

@mwlazlo
Copy link
Contributor Author

mwlazlo commented Oct 17, 2018

Fixed those formatting bugs, also removed Description from consideration in getSchemaName().

@emicklei
Copy link

is this PR ready to merge?

@a-h a-h merged commit 3cfcc0c into a-h:master Feb 4, 2019
@a-h
Copy link
Owner

a-h commented Feb 4, 2019

Sorry for the terribly long delay, thanks for the changes.

zepheiryan added a commit to zepheiryan/generate that referenced this pull request May 12, 2022
…t would be generated with the same name get overwritten by one another). Add a fix and a unit test, and remove the last bits of a-h#28 that no longer apply.
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.

None yet

3 participants