Cannot generate a complex type for lists.
See original GitHub issueHi,
I was trying to generate java classes for the following json schema.
{
"type":"object",
"properties": {
"container": {
"items": [
{
"item1": {
"type": "string"
}
},
{
"item2": {
"type": "string"
}
}
],
"type":"array"
}
}
}
It seems jsonschema2pojo cannot generate a type for list. In java classes the list container has the type Object .
java private List<Object> container = new ArrayList<Object>();
However i would expect something like this.
private List<Container> container = new ArrayList<Object>();
And the corresponding container class.
class Container {
private String item1;
private String item2;
// getters and setters
....
}
Is it a bug or is there some parameter to be specified to do this?
Regards, Shamsi
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
cannot generate classes because no top-level elements with ...
I am trying to create a class from a xsd file using the XSD.EXE tool. but for some reason i get this error....
Read more >XML Schema complexType Element - W3Schools
True indicates that an element cannot use this complex type directly but must use a complex type derived from this complex type. Default...
Read more >Querying arrays with complex types and nested structures
Your source data often contains arrays with complex data types and nested structures. Examples in this section show how to change element's data...
Read more >Supported XSD Elements and JPA Annotations - Appian 22.2
Anonymous lists are treated as anonymous simple data types that cannot be selected when creating new variables, rules, constants, and entities. When importing...
Read more >Tutorial: Create a more complex data model for an ASP.NET ...
In this tutorial you'll add more entities and relationships and you'll customize the data model by specifying formatting, validation, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The example seems like perfectly fine schema. You can find similar ones here
UPDATE Never mind. That is actually wrong. The flaw is in generated json files. You can close this issue
Thanks!
What is the thing inside the array? Is it an object with a property called item1? That schema would look like this:
Show me where, in the link you provided, there is an example that looks like yours.