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 :: UTCTime } deriving ToSchema via (EncodingSchema User) -- <-- ToSchema instance defined here instance HasJsonEncodingSpec User where type EncodingSpec User = JsonObject '[ '("name", JsonString) , '("last-login", JsonDateTime) ] toJSONStructure user = (Field @"name" (name user), (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", "last-login" ], "type": "object" }
[Skip to Readme]
Downloads
- json-spec-openapi-0.2.1.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.20), insert-ordered-containers (>=0.2.5.3 && <0.3), json-spec (>=0.2.1.3 && <0.3), lens (>=5.2.3 && <5.3), 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-01-08T22:38:30Z |
Distributions | Stackage:1.0.0.0 |
Downloads | 487 total (40 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] |