Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to generate an .xsd for F# types?

Tags:

f#

xsd

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?

like image 283
Ben Schäffner Avatar asked Feb 21 '17 16:02

Ben Schäffner


1 Answers

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).

like image 108
Helge Rene Urholm Avatar answered Oct 01 '22 07:10

Helge Rene Urholm