json-spec-openapi: json-spec-openapi
This package provides a way to produce openapi3 documentation from a json-spec specification.
Example
Given this data type:
data User = User { name :: Text , lastLogin :: Maybe UTCTime } deriving ToSchema via (EncodingSchema User) -- <-- ToSchema instance defined here instance HasJsonEncodingSpec User where type EncodingSpec User = JsonObject '[ Required "name" JsonString , Optional "last-login" JsonDateTime ] toJSONStructure user = (Field @"name" (name user), (fmap (Field @"last-login") (lastLogin user), ()))
Calling `Data.Aeson.encode (Data.OpenApi3.toSchema (Proxy :: Proxy User))` will produce the following Schema:
{ "additionalProperties": false, "properties": { "last-login": { "format": "date-time", "type": "string" }, "name": { "type": "string" } }, "required": [ "name" ], "type": "object" }
[Skip to Readme]
Downloads
- json-spec-openapi-1.0.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.2.0.0, 0.2.1.0, 0.2.1.1, 0.3.0.0, 0.3.1.0, 0.3.1.1, 0.3.1.2, 1.0.0.0 (info) |
---|---|
Dependencies | aeson (>=2.2.1.0 && <2.3), base (>=4.19.0.0 && <4.21), insert-ordered-containers (>=0.2.5.3 && <0.3), json-spec (>=0.5.0.0 && <1.2), lens (>=5.2.3 && <5.4), openapi3 (>=3.2.4 && <3.3), text (>=2.1 && <2.2) [details] |
License | MIT |
Copyright | 2022 Rick Owens |
Author | Rick Owens |
Maintainer | rick@owensmurray.com |
Category | JSON, OpenApi |
Home page | https://github.com/owensmurray/json-spec-openapi |
Uploaded | by rickowens at 2024-09-27T02:02:29Z |
Distributions | LTSHaskell:1.0.0.0 |
Downloads | 505 total (21 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user Build status unknown [no reports yet] |