akhansari / FSharp.OpenApi

F# Wrapper for OpenAPI.NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FSharp OpenAPI NuGet Status

F# Wrapper for OpenAPI.NET SDK.

  • Describe API specifications with computation expressions.
  • Provide helpers for F# libraries to write specifications and exposing them to Swagger UI.

This is still a work in progress project and breaking changes could be frequent.
Contributions are welcome.

Example Usage

Creating an OpenAPI document

let document =
    apiDocument {
        info (apiInfo {
            version "1.0.0"
            title "Swagger Petstore (Simple)"
        })
        servers [
            apiServer {
                url "http://petstore.swagger.io/api"
            }
        ]
        paths [
            "/pets", apiPathItem {
                operations [
                    OperationType.Get, apiOperation {
                        description "Returns all pets from the system that the user has access to"
                        responses [
                            HttpStatusCode.OK, apiResponse {
                                description "OK"
                            }
                        ]
                    }
                ]
            }
        ]
    }

let outputString =
    document.Serialize (OpenApiSpecVersion.OpenApi3_0, OpenApiFormat.Json)

About

F# Wrapper for OpenAPI.NET

License:MIT License


Languages

Language:F# 100.0%