Writing OData service with F#?

Hello,

I just finished a first small app with F# and Suave, providing a Web API interface (REST).
Now I thought about further development of the API by implementing the ODATA protocol.

However, it is very hard finding information on F# and OData.
Basically it is some basic (very helpful) material by Tamizh Vendan written in 2016.
It seems there is no active contribution to packages or that sort in this area.

So I was wondering if it makes sense following that path (F# / OData service) if I’m not capable of implementing all supporting routines myself.

For C# there seem to be a lot of samples and libraries which make implementations much easier.
Is it possible to use those libraries in the same way in F# (and possibly with Suave)?

Can any of you valued experts share some insight on this?

Thanks in advance and best regards
cil

1 Like

Hi,

Did you get anywhere with this was going to make this my next project.

Found an old medium article and a pre-release nuget package.

Craig

Hi cil,

It’s great to hear that you’ve successfully built a small app with F# and Suave! Implementing the OData protocol can indeed enhance your API, but I understand the challenges of finding resources and libraries for F# in this area.

While there isn’t as much active development in F# for OData compared to C#, there are still some resources and libraries that might help:

Microsoft Learn Tutorial: There’s a tutorial on Microsoft Learn that walks you through implementing basic CRUD operations in an ASP.NET Core OData 8 service using F#. This might be a good starting point for understanding how to set up an OData service in F#.

Type Providers: F# has type providers that can simplify working with OData services. The FSharp.Data.TypeProviders assembly can help generate client types for an OData service.

Suave.OData.LiteDB: There’s an experimental implementation of OData in Suave with LiteDB.FSharp available on GitHub. While it’s not production-ready, it might give you some insights into how to integrate OData with Suave.

If you find that the available resources and libraries are not sufficient for your needs, it might be worth considering using C# libraries alongside F#. F# is interoperable with C#, so you can leverage C# libraries for OData while writing the rest of your application in F#.

Best regards,
Lisa
HomeDepotSurvey com