-
Notifications
You must be signed in to change notification settings - Fork 288
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
XSD Support #1149
XSD Support #1149
Conversation
Are you going to include this on the other PR? |
Actually I'm a bit confused, guess I need a "bit for dummies" crash course |
I meant git for dummies |
Ok, I see that this actually includes the other PR, so let's keep this as the current one, and close the other one |
Avoid doing rebases because that makes things harder, just commit new commits to your baronfelxsd branch and push, and this PR will be updated |
There's an xsdprovider branch that was @runefs version, I assume your implementation is an evolution of that right? |
actually my implementation is more of a rewrite, there's little in common with the existing branch |
What I meant is, functionality wise it's a superset, right? |
I've merged with master and pushed to your branch |
Maybe you can reuse the test cases from the xsdprovider branch and integrate them here as well? I merged that branch with master and pushed it so it's easy to look at |
@giacomociti let me know when you're done with your changes, I'll wait for that before doing a more detailed review. I want to get this into 3.0 |
The last commit addresses a little issue (see fsprojects/FSharp.Data.Xsd#15). |
the last commit was the last fix from FSharp.Data.Xsd fsprojects/FSharp.Data.Xsd#19 |
Yes, perf impact should be negligible, but do make sure to add some tests for those elements with the same name (both signature test, and a test that gets the value at runtime) |
@ovatsus I think we have enough tests now, so you may start the code review (unless you want me to also fix the GetSample issue, but it is not trivial and may take a while). In the meantime I can finish the docs, although I'm having troubles with generate.fsx |
What error are you getting with generate.fsx? |
I got this on Ubuntu: /home/giacomo/Documenti/Repos/FSharp.Data/docs/tools/generate.fsx(25,1): error FS0078: Unable to find the file 'Fsharp.Charting.dll' in any of but on Windows it worked. |
Oh, I don't think FSharp.Charting works on linux, so that should be fine |
I'll have a look at removing the GetSample method. The way it was done in CsvProvider doesn't work for you as you're passing the schema as the sample to get the common code to download it |
I've found a way to avoid generating GetSamples by factoring out a couple of functions in the common helper code. Maybe you can figure out a better way |
Since something similar will be needed eventually for JsonSchema, I refactored a bit the generateType folder to support schemas better, still need to finish a couple of more things, will probably push that tomorrow |
I added a couple of tests: the first one cover nillable elements, which are supported albeit they may seem strange. |
…aronfelxsd # Conflicts: # tests/FSharp.Data.Tests/XmlProvider.fs
This is now released as part of 3.0.0-beta4. Sorry for taking so long |
Great! Thanks @ovatsus |
The XML Provider is augmented with XSD support as in FSharp.Data.Xsd.
An new parameter
Schema
is added. When this parameter is used (instead ofSample
), anInferedType
is derived from the specified XSD.In order to leverage the existing implementation, the approach (as made evident in the unit tests) is to derive a type essentially equivalent to the one that would be inferred from a significant set of valid samples. The focus is on elements and not on complex types: provided types correspond to element shapes, not to complex types in the schema.
ToDo: