Skip to content

Dzoukr/OpenAPIParser

Repository files navigation

drawing

Open API F# Parser

Simple library for parsing YAML/JSON Open API (previously called as Swagger) specification (version 3.0.1). Originally part of my type provider, but I will probably never finish it, so at least community can use part of it for own projects. :)

Installation

First install NuGet package

Install-Package OpenAPIParser

or using Paket

nuget OpenAPIParser

How to use

Typically, you would use some existing specification (see official examples for version 3):

open OpenAPIParser.Version3.Parser
let openAPI = Document.loadFromYamlFile "mySpec.yaml" 

Then you have basic F# record filled

let version = openAPI.Info.Version
let title = openAPI.Info.Title
let paths = openAPI.Paths
...

Please check test project for more examples.

Limitations

Not all properties from 3.0.1 specification are implemented. Especially anyOf and oneOf Schema objects, which will be probably implemented in future versions. Please check Specification record definition for already implemented properties.

Contribution

You know the drill. Code + Tests = Good PR. Any contribution more than welcome!