The latest version of json-spec-openapi is 1.0.0.0-0.
json-spec-openapi
Version 0.3.1.0 revision 0 uploaded by rickowens.
Package meta
- Synopsis
- json-spec-openapi
- Description
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" }
- Author
- Rick Owens
- Bug reports
- n/a
- Category
- JSON, OpenApi
- Copyright
- 2022 Rick Owens
- Homepage
- https://github.com/owensmurray/json-spec-openapi
- Maintainer
- rick@owensmurray.com
- Package URL
- n/a
- Stability
- n/a