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

[feature-request] Add option to allow unchanged localName properties while generating mappings. #82

Open
gitowiec opened this issue May 11, 2018 · 6 comments

Comments

@gitowiec
Copy link

Allowing unchanged localName names (exactly the same as in XML eg <Element_With_Underscore> makes JSON prop Element_With_Underscore) would help to use library like cxsd. One could generate TypeScript types for intellisense and use it to compose JSON to generate XML using Jsonix mappings

@AndreasBrie
Copy link

I would also appreciate an option to keep the original localNames and property names. That would be very cool and would make our work a lot easier.

Thank you :)

@highsource
Copy link
Owner

@AndreasBrie

to keep the original localNames and property names

You mean JSON property names should be exactly as local names of respective attributes/elements?

There are some properties which may contain several elements. Won't work in that case, but for other cases should be quite doable.

@AndreasBrie
Copy link

AndreasBrie commented Aug 22, 2018

Thanks for your fast reply.
Yes. For Example, this is an extract of a XSD-File
<xsd:element name="STABE_BEZ" minOccurs="0"> <xsd:annotation> <xsd:documentation>Cntry of affil. of means of transport at departure of goods</xsd:documentation> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="15"/> </xsd:restriction> </xsd:simpleType> </xsd:element>

and i would like to keep the underscore and perhaps also the uppercase (but thats not necessarily required). So instead of being converted to:

{ name: 'stabebez', elementName: { localPart: 'STABE_BEZ' } }
i would like to have:
{ name: 'STABE_BEZ', elementName: { localPart: 'STABE_BEZ' } }

Would this be possible?

fyi reason for my request: We use this for converting SAP Idoc Schema files to typescript types via this project's json schema generation. And for SAP Idoc Files it is very common to use underscores in field names. And to easily find the usage of a certain SAP Idoc field it would be very helpful to search with the original field names. So this would be mainly for keeping a kind of type description consistency. Therefore it wouldn't be a must-have but a cool nice-to-have feature :)

@highsource
Copy link
Owner

Ok, this can be quite easily implemented for "simple" property types like attribute property and element property.

This won't work for other properties (value, elements, element reference, elements reference, any attribute, any element).

@underoll
Copy link

underoll commented Oct 4, 2021

...so will it be implemented for simple types at least?

@matthiasblomme
Copy link

Any progress on this topic?

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

5 participants