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

Array type as object properties not supported #10

Closed
mbarbet opened this issue Feb 13, 2018 · 4 comments
Closed

Array type as object properties not supported #10

mbarbet opened this issue Feb 13, 2018 · 4 comments
Assignees
Labels
Milestone

Comments

@mbarbet
Copy link

mbarbet commented Feb 13, 2018

I tried to use your tool with this sample below , I just changed the price number property by prices , an array of object with price property

{ "type":"array", "items":{ "type":"object", "properties":{ "prices":{ "type":"array", "items":{ "type":"object", "properties":{ "price":{ "type":"number" } }, "required":["price"] } }, "name":{ "type":"string", "minLength":5, "maxLength":32 }, "isExpired":{ "default":false, "type":"boolean" }, "manufactured":{ "type":"string", "format":"date-time" } }, "required":[ "prices", "name", "manufactured" ] } }

If I try to convert this schema in xsd with validateXsdSchema set to true i have this error

{"status":400,"message":"org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 36; Unexpected <complexType> appears at line 8 column 36","error":"java.lang.IllegalArgumentException"}

If I try to convert this schema in xsd with validateXsdSchema set to false i have this result

<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:x="http://example.com/myschema.xsd" elementFormDefault="qualified" targetNamespace="http://example.com/myschema.xsd"> <complexType name="array"> <sequence> <element name="prices"> <complexType> <sequence> <element maxOccurs="unbounded" minOccurs="0"> <complexType name=""> <sequence> <element name="price" type="decimal"/> </sequence> </complexType> </element> </sequence> </complexType> </element> <element name="name"> <simpleType> <restriction base="string"> <minLength value="5"/> <maxLength value="32"/> </restriction> </simpleType> </element> <element minOccurs="0" name="isExpired" type="boolean"/> <element name="manufactured" type="dateTime"/> </sequence> </complexType> </schema>

I think this result comport misplaced complexType whitout name attribute.
Am I missing something?

@ethlo
Copy link
Owner

ethlo commented Feb 13, 2018

Hi, and thanks for the bug report. I will have a look as soon as possible :)

@monicagarud
Copy link

Hi, any updates on the above issue

@bhagawathi
Copy link

I may not be 100% right but the way the tool is designed to take the array of objects as reference.
Refer the accounts.json and accounts.xsd under the test resources
to see how the array of objects are handled.
This as per my inference is not a bug but how you get to use the tool.

ethlo added a commit that referenced this issue Apr 10, 2020
@ethlo
Copy link
Owner

ethlo commented Apr 10, 2020

Fixed in 2.2.1

@ethlo ethlo closed this as completed Apr 10, 2020
@ethlo ethlo added this to the 2.2.1 milestone Apr 10, 2020
@ethlo ethlo self-assigned this Apr 10, 2020
@ethlo ethlo added the bug label Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants