https://github.com/akhansari/fsharp.openapi
F# Wrapper for OpenAPI.NET
https://github.com/akhansari/fsharp.openapi
fsharp openapi
Last synced: 8 days ago
JSON representation
F# Wrapper for OpenAPI.NET
- Host: GitHub
- URL: https://github.com/akhansari/fsharp.openapi
- Owner: akhansari
- License: mit
- Created: 2020-07-15T23:16:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-17T09:00:06.000Z (3 months ago)
- Last Synced: 2025-04-17T18:23:29.429Z (13 days ago)
- Topics: fsharp, openapi
- Language: F#
- Homepage:
- Size: 69.3 KB
- Stars: 51
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## FSharp OpenAPI [](https://www.nuget.org/packages/FSharp.OpenApi)
F# Wrapper for [OpenAPI.NET SDK](https://github.com/microsoft/OpenAPI.NET).
- Describe API specifications with computation expressions.
- Provide helpers for F# libraries to write specifications and exposing them to Scalar UI.This is still a work in progress project and breaking changes could be frequent.\
Contributions are welcome.### Example Usage
Creating an OpenAPI document
```fsharp
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)
```