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

Elements with same name but different types are not supported #19

Closed
julienadam opened this issue Nov 7, 2017 · 6 comments
Closed

Elements with same name but different types are not supported #19

julienadam opened this issue Nov 7, 2017 · 6 comments

Comments

@julienadam
Copy link

Description

I am using the library to generate a report based on this schema set :

https://www.esma.europa.eu/sites/default/files/library/2016-_annex_6_firds_reference_data_xml_schema.zip

Specifically, the DRAFT4auth.039.001.01_ESMAUG_DATNWD_1.0.0.xsd schema which has 2 elements with the same name "NonWorkgDay" but different types, one is SecuritiesNonTradingDayReport1, the other is SecuritiesNonTradingDay1.

Repro steps

type Rpt = XmlProvider<Schema = @"DRAFT4auth.039.001.01_ESMAUG_DATNWD_1.0.0.xsd">
Rpt.NonWorkgDay will be defined as self-referencing type instead of referencing the other type.

Expected behavior

Generate 2 distinct types, I guess ?

Actual behavior

Only generates the first type (or at least only one of the types)

Known workarounds

None

Related information

N/A

@giacomociti
Copy link
Collaborator

hi @julienadam, thanks for reporting this isuue. I'll try to investigate it as soon as possible. In the meantime the usual workaround may be to use the raw XElement property.

@giacomociti
Copy link
Collaborator

hi @julienadam , the issue is tricky but I may provide a quick patch capable of handling your case.
This would not be the ideal solution in general, but I still haven't found a way to handle different types with the same name (your case) and also having recursive definitions in the same schema. Anyway, since your xsd seems to have no recursive definitions, it should work for you. I still hope to find a better solution but in the meantime let me know if you need the patch

@julienadam
Copy link
Author

Hi, thanks for looking into it. There's no rush, I ended up generating C# classes with good old xsd.exe, it is ugly but it does the job. I'll be very happy to switch back to FSharp.Data.Xsd when the issue is fixed though !

I looked at it briefly with a few colleagues, it does look tricky indeed... xsd.exe seems to use variations of the type names defined in the schema instead of elements names, I'm not sure if that's applicable here.

@giacomociti
Copy link
Collaborator

I think I've found the proper way to fix the issue. Now (in version 1.0.2) an ordinal suffix is appended (2, 3, ...) for different types with the same name

@giacomociti
Copy link
Collaborator

I hope the issue is now fixed, @julienadam can we close this?

@julienadam
Copy link
Author

Yes, I tested this new version and the problem is fixed.

Thanks !

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