Skip to content

Options and Swagger #1132

Oct 12, 2022 · 1 comments · 12 replies
Discussion options

You must be logged in to vote

IMO:

Default JSON serialization of Option and other types is a bit different to what you might expect. This is true for dictionary types, too.
I built my own custom serializer (for System.Text.Json) to make LanguageExt types more "compatible", i.e. serialize Option<string> in the same way as string?.

But this has some drawbacks and if you have a strict view on those things it is even better to serialize Option like an array because it is equivalent to an array that can have size 0 and size 1. So it depends who is consuming your API and how compatible you want/have to be.

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@StefanBertels
Comment options

@speterson-zoll
Comment options

@StefanBertels
Comment options

@speterson-zoll
Comment options

@StefanBertels
Comment options

Answer selected by speterson-zoll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants