We're looking at leveraging F# for our projects in the future, and would like to be able to generate .xsd schemas from F# types automatically.
Searching the web returns a lot of answers for generating types from .xsd, but not the other way around.
Does anybody know of a way to do this?
That kind of dependens on what you actually mean.
If you meant: "How do I generate XSDs from dll?" then it can be quite simply done with svcutil... Ok, given that some other conditions are met, but kind of doable:
The following command generates metadata documents for service contracts and associated types in an assembly.
svcutil myAssembly.dll
https://msdn.microsoft.com/en-us/library/aa347733(v=vs.110).aspx
xsd.exe should also kind of be able to do about the same. Im not sure about under what conditions here though, but the docs are not so "stringent" as svcutil.
The following command generates XML schemas for all types in the assembly myAssembly.dll and saves them as schema0.xsd in the current directory.
xsd myAssembly.dll
https://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.110).aspx
If you meant "generate XSD from given *.fs file" then you're kind of out of luck (to my knowledge).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With