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

Include multiplicity in mapping files #33

Closed
tedbarth opened this issue Sep 22, 2014 · 4 comments
Closed

Include multiplicity in mapping files #33

tedbarth opened this issue Sep 22, 2014 · 4 comments

Comments

@tedbarth
Copy link

Jsonix generates mappings from XML schema definitions that might include information about multiplicity (optional, collection, mandatory, upper/lower bound) of member elements but doesn't include it in the mapping files. Only the information about being a collection is included. Including the information about multiplicity would allow to dynamically create user interfaces like input forms. Without this feature you still have to define a static code model that creates the Javascript object (and form fields; with information from the user interface) which only is ready to get marshalled. Information about multiplicity would make the intermediate model unnecessary.

Of course it would be much better to have a representation of the content datatype itself (e.g. constraints on strings and integers) as well. But this is much less important.

Is there a special reason why multiplicity is not part of the mapping files (yet)?
Are there any plans to include it?
Did I misunderstand something?
Do you know any other JS-XSD parser that parses multiplicity information?

@highsource
Copy link
Owner

This is not exactly the scope of Jsonix. Jsonix focuses on XML-JS
conversions and does not validate, so multiplicity is actually not required
as it does not influence the resulting models.

Having said that, I don't mind including it. The problem is, however, that
XML elements don't always clearly map onto properties. Sometimes you get
"elements" and "element references"-type properties which have
heterogeneous content. In these cases you don't have a clear mapping
between XML Schema elements and model properties.
But it many cases it may be possible. I'll consider it for future releases.

I actually don't know any othe JS-XSD parser at all :)
On the schema level you can get the infos, sure. I did it already in other
projects - on XSOM basis. (Jsonix is based on JAXB/XJC and XJC uses XSOM to
process schemas.)

But what I wouldn't like to do is making Jsonix validate things. This may
be extremely hard.

On Mon, Sep 22, 2014 at 5:00 PM, Sebastian Barth notifications@github.com
wrote:

Jsonix generates mappings from XML schema definitions that may includes
information about multiplicity (optional, collection, mandatory,
upper/lower bound) of member elements but doesn't include it in the mapping
files. Only the information about being a collection is included. Including
the information about multiplicity would allow to dynamically create user
interfaces like input forms. Without this feature you still have to define
a static code model that creates the Javascript object (and form fields;
with information from the user interface) which only is ready to get
marshalled. Information about multiplicity would make the intermediate
model unnecessary.

Of course it would be much better to have a representation of the content
datatype itself (e.g. constraints on strings and integers).

Is there a special reason why multiplicity is not part of the mapping
files (yet)?
Are there any plans to include it?
Did I misunderstand something?
Do you know any other JS-XSD parser that parses multiplicity information?


Reply to this email directly or view it on GitHub
#33.

@tedbarth
Copy link
Author

It's a big plus of Jsonix that you have a subset of XSD information as mappings in JS. Though I don't completely understand what you wrote about the XML problem I found another reason that could be interesting for future usecases beyond XML-JS transformation, too:

  • The mapping can be used to generated a mapper to JSON and other formats (in Javascript).
  • Compression: Multiplicity could help to strip out unnecessary information about mandatory fields.

I could not find any Java source code in this repo. Any plans about opening the source for us?

@highsource
Copy link
Owner

Java source code?
Do you mean this one?
https://github.com/highsource/jsonix-schema-compiler

Well of course it is open. :)

I'll try to do the multiplicity. I think the idea is reasonable. But as I
wrote, there are limitations.

On Mon, Sep 29, 2014 at 12:17 PM, Sebastian Barth notifications@github.com
wrote:

It's a big plus of Jsonix that you have a subset of XSD information as
mappings in JS. Though I don't completely understand what you wrote about
the XML problem I found another reason that could be interesting for future
usecases beyond XML-JS transformation, too:

  • The mapping can be used to generated a mapper to JSON and other
    formats.
  • Compression: Multiplicity could help to strip out unnecessary
    information about mandatory fields.

I could not find any Java source code in this repo. Any plans about
opening the source for us?


Reply to this email directly or view it on GitHub
#33 (comment).

@highsource
Copy link
Owner

Moved to highsource/jsonix-schema-compiler#23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants