F# Data JsonProvider integration with WebAPI

106 views
Skip to first unread message

Daniel Bradley

unread,
Oct 1, 2014, 12:57:01 PM10/1/14
to web-st...@googlegroups.com
Hi, just been doing some musing on leveraging the JsonProvider from F# Data to specify your JSON models in JSON first.

I've created a repo on what this could look like for integrating with WebAPI via their MediaTypeFormatter class with a simple test as an example of returning a JsonProvider type from an action and taking a JsonProvider type as an argument.

It's pretty rough around the edges, but hopefully enough to generate a conversation around a model-first approach to designing APIs. 

Anyone else played with anything similar?

Ryan Riley

unread,
Oct 1, 2014, 5:58:31 PM10/1/14
to web-st...@googlegroups.com
I hadn't tried it b/c the provider didn't provide a write/update API. How are you creating the JsonValue to serialize on the way out? Otherwise, it looks great! 

Daniel Bradley

unread,
Oct 2, 2014, 5:22:02 AM10/2/14
to web-st...@googlegroups.com
Gustavo only added the write API reletively recently. 

Essentially, you can just construct the model via its constructor as I do during the update test, then you can just get the underlying JsonValue and write it directly to a stream.
Reply all
Reply to author
Forward
0 new messages