-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(map): Codegen for XMLSchema Target #64
Conversation
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
f1a035d
to
cd7066c
Compare
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had trouble validating the output schema. I'm also unsure about what the target XML document would look like for instances.
For example, the following fails to validate in VS Code.
<?xml version="1.0"?>
<xs:schema xmlns:org.acme.hr="org.acme.hr" targetNamespace="org.acme.hr" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:concerto="concerto"
>
<xs:element name="root">
<xs:complexType name="Map1">
<xs:sequence>
<xs:complexType>
<xs:sequence>
<xs:element name="key" type="xs:string"/>
<xs:element name="value" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Problems:
- s4s-att-not-allowed: Attribute 'name' cannot appear in element 'complexType'.
- s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: complexType.
If I change the definition to the following, it does validate, but produces unexpected instances.
<?xml version="1.0"?>
<xs:schema xmlns:org.acme.hr="org.acme.hr" targetNamespace="org.acme.hr" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:concerto="concerto"
>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="key" type="xs:string"/>
<xs:element name="value" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Technologies Online Tools 1.0 (https://www.liquid-technologies.com) -->
<root xmlns="org.acme.hr" xmlns:concerto="concerto" xsi:schemaLocation="org.acme.hr schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<key>string</key>
<value>1981-11-16T18:39:36.34</value>
</root>
Is the design here better suited to our use case?
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
@mttrbrts thanks for catching this. I've switched validators and was able to reproduce the same issues which are now patched. RedHats VSCode plugin used for inline validation and liquid-technologies online instance validator both suggest the current generation of XSD is valid. Here is a sample: XSD:
Instance:
|
A sample XSD which supports multiple entries in a Map. Each Map will have its own 'entry' type defining the entries within the instance.
|
* feat(*): keys are variable typed Signed-off-by: Jonathan Casey <[email protected]> * test(*): update test Signed-off-by: Jonathan Casey <[email protected]> * test(*): update snapshot Signed-off-by: Jonathan Casey <[email protected]> * test(*): adds scalar test coverage Signed-off-by: Jonathan Casey <[email protected]> * feat(*): minor refactor, update tests Signed-off-by: Jonathan Casey <[email protected]> * test(*): update snapshot Signed-off-by: Jonathan Casey <[email protected]> --------- Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Signed-off-by: Jonathan Casey <[email protected]>
Description
Add XMLSchema code generation for Map Type. Validated against xmlvalidation.com & w3schools.com.
Sample <String, String>
Sample <String, DateTime>
Sample <String, SSN>
Sample <String, Concept>
Sample <SSN, String>
Sample <SSN, Employee>