So I'm using the FSharp.Data library and I have a generated type as such:
<ArrayOfCar>
<Car>
<LicenseNumber>000</LicenseNumber>
<ProductionYear>2014</ProductionYear>
<Type>Audi</Type>
</Car>
<Car>
<LicenseNumber>999</LicenseNumber>
<ProductionYear>2012</ProductionYear>
<Type>BMW</Type>
</Car>
</ArrayOfCar>
Now I have a question, as it seems the F# compiler will generate two types from this, ArrayOfCars
and Car
.
Now I'm calling an API that will return either the example above for a collection of cars and also a single Car
with Car
then being the root element. However I can only parse ArrayOfCars
using ArrayOfCars.Parse
there is no Car.Parse
as far as I can see.
Is there something I'm missing here or must I then generate a seperate type for Car
to handle when it is the root element?
No comments:
Post a Comment