Coder Social home page Coder Social logo

theangrybyrd / newtonsoft.json.fsharp.idiomatic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from baronfel/newtonsoft.json.fsharp.idiomatic

1.0 3.0 0.0 75 KB

A set of json converters for F# Discriminated Unions that allow for some flexibility when using this construct

License: MIT License

Batchfile 0.69% F# 93.55% Shell 5.76%

newtonsoft.json.fsharp.idiomatic's Introduction

Newtonsoft.Json.FSharp.Idiomatic

A set of Converters for Json.Net that (de)serialize unions in a nicer format than the out-of-box converters.

The provided converters are:

  • OptionConverter
    • allows for use of options instead of nullables, treats Null as None
  • SingleCaseDuConverter
    • reads and writes enum-style DU's (ie type Foo = | Bar | Baz | Qux) as their string name
  • MultiCaseDuConverter
    • reads and writes DUs with data attached as an object with a kind property equal to the case name, and whose property names and values are drawn from the DU property names and value. This Converter is fairly fragile and requires that the kind property (or a customizable property name) is first in order on the JSON.
  • OutOfOrderMultiCaseDuConverter
    • This converter reads/buffers the object properties of a JSON object and uses the property names to infer the correct DU case to deserialize into. It requires that your DU cases have property names that are set-distinct (that is no 100% overlap), and that the JSON contains all properties of the DU, even if some of them are null.

Builds

MacOS/Linux Windows
Travis Badge Build status
Build History Build History

Nuget

Stable Prerelease
NuGet Badge NuGet Badge

Building

Make sure the following requirements are installed in your system:

> build.cmd // on windows
$ ./build.sh  // on unix

Environment Variables

  • CONFIGURATION will set the configuration of the dotnet commands. If not set it will default to Release.
    • CONFIGURATION=Debug ./build.sh will result in things like dotnet build -c Debug
  • GITHUB_TOKEN will be used to upload release notes and nuget packages to github.
    • Be sure to set this before releasing

Watch Tests

The WatchTests target will use dotnet-watch to watch for changes in your lib or tests and re-run your tests on all TargetFrameworks

./build.sh WatchTests

Releasing

git add .
git commit -m "Scaffold"
git remote add origin origin https://github.com/user/MyCoolNewLib.git
git push -u origin master
paket config add-token "https://www.nuget.org" 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a
  • Create a GitHub OAuth Token

    • You can then set the GITHUB_TOKEN to upload release notes and artifacts to github
    • Otherwise it will fallback to username/password
  • Then update the RELEASE_NOTES.md with a new version, date, and release notes ReleaseNotesHelper

#### 0.2.0 - 2017-04-20
* FEATURE: Does cool stuff!
* BUGFIX: Fixes that silly oversight
  • You can then use the Release target. This will:
    • make a commit bumping the version: Bump version to 0.2.0 and add the release notes to the commit
    • publish the package to nuget
    • push a git tag
./build.sh Release

newtonsoft.json.fsharp.idiomatic's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.