Comments (9)
Sorry, I was distracted by something. Will do my best to make a release with the fix this week.
from fsharp.json.
I meant more my mistake that I never considered "enum" style use case for DU.
I will fix this but probably in the next major release as it breaks backward compatibility.
from fsharp.json.
Hmmm, I think it's a mistake. I will check more and come back with some solution.
from fsharp.json.
It depends on who your consumer is. If it's only for serializing F# to F#, then it's fine as it is. But I would be very surprised to see this type definition real typescript code:
type LogEntry = {
message: string;
level: {Info: []} | {Warn: []} | {Error: []};
}
and then
if ('Info' in logEntry.level) {
return <InfoIcon />
} else if (....
you get the picture. It's very unnatural for an API-consumer.
I realize there's probably some technical edge-cases though.
from fsharp.json.
hi @vsapronov ! Have you had chance to work on that issue? Is there anything I could help with? :-) I also ran into similar issue mentioned in the first comment.
from fsharp.json.
I'm having a similar issue with a list of Enums
type MailFlag = | AirMail | Priority | Confidential | InformDelivery
type Mail = {
address: string
flags: MailFlag list
}
and data
{
"address": "somewhere",
"flags": ["Priority", "InformDelivery"]
}
from fsharp.json.
Hi @vsapronov ! Have you had chance to find a solution? 😄
from fsharp.json.
Please try version 0.4.0 and let me know if it works for you.
from fsharp.json.
Here's documentation: https://github.com/vsapronov/FSharp.Json/blob/master/README.md#union-case-without-fields
from fsharp.json.
Related Issues (20)
- Is it possible to apply transforms with no attributes?
- Round tripping an union type with a single string field throws an exception
- Integration with Giraffe HOT 4
- Is there any fundamental reason why standard .NET collections are not among supported types? HOT 2
- Deserialize union in CaseKeyAsFieldValue mode from JSON with more than 2 fields HOT 5
- Serialize Map<string, string option> raises "Object reference not set to an instance of an object."
- Support for IReadOnlyDictionary<K,V>?
- Support for serialize non ascii words HOT 1
- Feature request - ISO8601 date transformer(s)
- Documentation repo? HOT 1
- Specifying Default Values As Compile Time Constants
- Q: how can I handle the reserved F# keyword 'type' in json string { "type": "abc", "weight": "123" } HOT 1
- Deserializing union cases without values throws exceptions
- Support null for Map<string, obj>
- Support expanding the content of an object to the upper layer
- Add benchmark performance table with other serializers
- Q: how do you decode dictionary keys that vary?
- Q: Is there a reason why TimeSpan is not a Supported Type? HOT 19
- Move to fsprojects?
- Missing alternative HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.json.