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

Schema with non-complex type as root element produces extra/invalid pojos #8

Closed
joelittlejohn opened this issue Jun 23, 2013 · 1 comment
Milestone

Comments

@joelittlejohn
Copy link
Owner

Original author: joelittl...@gmail.com (January 07, 2011 10:16:15)

Currently jsonschema2pojo can't deal with schemas that contain a simple type (e.g. string, integer, array, etc) as their root element.

Example schema 1:
{
"type" : "string"
}

JSON data valid against example schema 1:

"abc"

Expected jsonschema2pojo behaviour:

No pojos should be generated. JSON content will be unmarshalled into java.lang.String.

Example schema 2:

{
"type" : "array",
"items" : {
"type" : "object",
"properties" : {
"foo" : {
"type" : "string"
}
}
}
}

JSON data valid against example schema 1:
[{"foo":"bar"}, {"foo":"bar"}, {"foo":"bar"}]

Expected behaviour:

One pojo should be generated. The root construct will be represented in Java by a simple collection (e.g. java.util.List), and the elements of that collection will be instances of the generated pojo.

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=8

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on January 07, 2011 11:17:19
Fixed in trunk rev 4ffc856e87.

Will be included in 0.1.4.

flibbertigibbet added a commit to flibbertigibbet/jsonschema2pojo that referenced this issue Jun 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant