-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
When an object type is an array, for instance
"type": ["string","integer"]
The conversion fails with this stack
java.lang.IllegalStateException
at com.google.gson.JsonArray.getAsString(JsonArray.java:226)
at edu.uoc.som.jsonschematouml.generators.JSONSchemaToUML.analyzeProperty(JSONSchemaToUML.java:463)
at edu.uoc.som.jsonschematouml.generators.JSONSchemaToUML.analyzeObject(JSONSchemaToUML.java:336)
at edu.uoc.som.jsonschematouml.generators.JSONSchemaToUML.analyzeRootSchemaElement(JSONSchemaToUML.java:264)
at edu.uoc.som.jsonschematouml.generators.JSONSchemaToUML.analyzeDefinitions(JSONSchemaToUML.java:754)
at edu.uoc.som.jsonschematouml.generators.JSONSchemaToUML.analyzeRootSchemaElement(JSONSchemaToUML.java:269)
at edu.uoc.som.jsonschematouml.generators.JSONSchemaToUML.analyzeSchema(JSONSchemaToUML.java:253)
at edu.uoc.som.jsonschematouml.generators.JSONSchemaToUML.analyze(JSONSchemaToUML.java:219)
at edu.uoc.som.jsonschematouml.generators.JSONSchemaToUML.launch(JSONSchemaToUML.java:171)
at edu.uoc.som.jsonschematouml.ui.handlers.ConvertToClassDiagram$1.run(ConvertToClassDiagram.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
This line doesn't handle the array case:
JSONSchemaToUML.java:463
else if(itemsObject.has("type") && itemsObject.get("type").getAsString().equals("string")) {
Note this case of type is conform to json schema type definition (at least in json schema draft v7):
"type": {
"anyOf": [
{"$ref": "#/definitions/simpleTypes"},
{
"type": "array",
"items": {"$ref": "#/definitions/simpleTypes"},
"minItems": 1,
"uniqueItems": true
}
],
Metadata
Metadata
Assignees
Labels
No labels