Skip to content

Commit 4439809

Browse files
committed
Rename to servant-openapi3
1 parent 9ba0797 commit 4439809

File tree

8 files changed

+106
-116
lines changed

8 files changed

+106
-116
lines changed

cabal.project

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
packages: .
2-
allow-newer: aeson-pretty-0.8.7:base-compat
1+
packages:
2+
servant-openapi3.cabal
3+
tests: true
34

45
source-repository-package
56
type: git
6-
location: https://github.com/biocad/swagger2/
7-
tag: 69788075a4a321505305ef79b57c183409c0c68f
7+
location: https://github.com/biocad/openapi3/
8+
tag: bd9df532f2381c4b22fe86ef722715088f5cfa68

servant-swagger.cabal renamed to servant-openapi3.cabal

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: servant-swagger
2-
version: 1.1.9
3-
synopsis: Generate a Swagger/OpenAPI/OAS 2.0 specification for your servant API.
1+
name: servant-openapi3
2+
version: 2.0.0
3+
synopsis: Generate a Swagger/OpenAPI/OAS 3.0 specification for your servant API.
44
description:
55
Swagger is a project used to describe and document RESTful APIs. The core of the
66
project is the [OpenAPI Specification (OAS)](https://swagger.io/docs/specification/about/).
@@ -18,13 +18,13 @@ description:
1818
* generating clients and servers in many languages using [Swagger Codegen](http://swagger.io/swagger-codegen/);
1919
.
2020
* and [many others](http://swagger.io/open-source-integrations/).
21-
homepage: https://github.com/haskell-servant/servant-swagger
22-
bug-reports: https://github.com/haskell-servant/servant-swagger/issues
21+
homepage: https://github.com/biocad/servant-openapi3
22+
bug-reports: https://github.com/biocad/servant-openapi3/issues
2323
license: BSD3
2424
license-file: LICENSE
25-
author: David Johnson, Nickolay Kudasov
26-
maintainer: [email protected]
27-
copyright: (c) 2015-2018, Servant contributors
25+
author: David Johnson, Nickolay Kudasov, Maxim Koltsov
26+
27+
copyright: (c) 2015-2020, Servant contributors
2828
category: Web, Servant, Swagger
2929
build-type: Custom
3030
cabal-version: 1.18
@@ -48,7 +48,7 @@ extra-doc-files:
4848

4949
source-repository head
5050
type: git
51-
location: https://github.com/haskell-servant/servant-swagger.git
51+
location: https://github.com/biocad/servant-openapi3.git
5252

5353
custom-setup
5454
setup-depends:
@@ -82,7 +82,7 @@ library
8282
, lens >=4.17 && <4.20
8383
, servant >=0.17 && <0.18
8484
, singleton-bool >=0.1.4 && <0.2
85-
, swagger2 >=2.3.0.1 && <2.7
85+
, openapi3 >=3.0.0 && <4.0
8686
, text >=1.2.3.0 && <1.3
8787
, unordered-containers >=0.2.9.0 && <0.3
8888

@@ -118,8 +118,8 @@ test-suite spec
118118
, lens
119119
, lens-aeson >=1.0.2 && <1.2
120120
, servant
121-
, servant-swagger
122-
, swagger2
121+
, servant-openapi3
122+
, openapi3
123123
, text
124124
, template-haskell
125125
, utf8-string >=1.0.1.1 && <1.1

src/Servant/Swagger.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import Servant.Swagger.Internal.Orphans ()
5050
-- >>> import Control.Applicative
5151
-- >>> import Control.Lens
5252
-- >>> import Data.Aeson
53-
-- >>> import Data.Swagger
53+
-- >>> import Data.OpenApi
5454
-- >>> import Data.Typeable
5555
-- >>> import GHC.Generics
5656
-- >>> import Servant.API
@@ -99,7 +99,7 @@ import Servant.Swagger.Internal.Orphans ()
9999
-- In order to generate @'Swagger'@ specification for a servant API, just use @'toSwagger'@:
100100
--
101101
-- >>> BSL8.putStrLn $ encode $ toSwagger (Proxy :: Proxy UserAPI)
102-
-- {"openapi":"3.0.0","info":{"version":"","title":""},"paths":{"/":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/User"},"type":"array"}}},"description":""}}},"post":{"requestBody":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"400":{"description":"Invalid `body`"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/UserId"}}},"description":""}}}},"/{user_id}":{"get":{"parameters":[{"required":true,"schema":{"type":"integer"},"in":"path","name":"user_id"}],"responses":{"404":{"description":"`user_id` not found"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}},"description":""}}}}},"components":{"schemas":{"User":{"required":["name","age"],"properties":{"name":{"type":"string"},"age":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}},"type":"object"},"UserId":{"type":"integer"}}}}
102+
-- {"openapi":"3.0.0","info":{"version":"","title":""},"paths":{"/":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/User"},"type":"array"}}},"description":""}}},"post":{"requestBody":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"400":{"description":"Invalid `body`"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/UserId"}}},"description":""}}}},"/{user_id}":{"get":{"parameters":[{"required":true,"schema":{"type":"integer"},"in":"path","name":"user_id"}],"responses":{"404":{"description":"`user_id` not found"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}},"description":""}}}}},"components":{"schemas":{"User":{"required":["name","age"],"type":"object","properties":{"age":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"},"name":{"type":"string"}}},"UserId":{"type":"integer"}}}}
103103
--
104104
-- By default @'toSwagger'@ will generate specification for all API routes, parameters, headers, responses and data schemas.
105105
--
@@ -120,7 +120,7 @@ import Servant.Swagger.Internal.Orphans ()
120120
-- & info.license ?~ "MIT"
121121
-- & servers .~ ["https://example.com"]
122122
-- :}
123-
-- {"openapi":"3.0.0","info":{"version":"1.0","title":"User API","license":{"name":"MIT"},"description":"This is an API for the Users service"},"servers":[{"url":"https://example.com"}],"paths":{"/":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/User"},"type":"array"}}},"description":""}}},"post":{"requestBody":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"400":{"description":"Invalid `body`"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/UserId"}}},"description":""}}}},"/{user_id}":{"get":{"parameters":[{"required":true,"schema":{"type":"integer"},"in":"path","name":"user_id"}],"responses":{"404":{"description":"`user_id` not found"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}},"description":""}}}}},"components":{"schemas":{"User":{"required":["name","age"],"properties":{"name":{"type":"string"},"age":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}},"type":"object"},"UserId":{"type":"integer"}}}}
123+
-- {"openapi":"3.0.0","info":{"version":"1.0","title":"User API","license":{"name":"MIT"},"description":"This is an API for the Users service"},"servers":[{"url":"https://example.com"}],"paths":{"/":{"get":{"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/User"},"type":"array"}}},"description":""}}},"post":{"requestBody":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"400":{"description":"Invalid `body`"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/UserId"}}},"description":""}}}},"/{user_id}":{"get":{"parameters":[{"required":true,"schema":{"type":"integer"},"in":"path","name":"user_id"}],"responses":{"404":{"description":"`user_id` not found"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}},"description":""}}}}},"components":{"schemas":{"User":{"required":["name","age"],"type":"object","properties":{"age":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"},"name":{"type":"string"}}},"UserId":{"type":"integer"}}}}
124124
--
125125
-- It is also useful to annotate or modify certain endpoints.
126126
-- @'subOperations'@ provides a convenient way to zoom into a part of an API.
@@ -138,7 +138,7 @@ import Servant.Swagger.Internal.Orphans ()
138138
-- & applyTagsFor getOps ["get" & description ?~ "GET operations"]
139139
-- & applyTagsFor postOps ["post" & description ?~ "POST operations"]
140140
-- :}
141-
-- {"openapi":"3.0.0","info":{"version":"","title":""},"paths":{"/":{"get":{"tags":["get"],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/User"},"type":"array"}}},"description":""}}},"post":{"tags":["post"],"requestBody":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"400":{"description":"Invalid `body`"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/UserId"}}},"description":""}}}},"/{user_id}":{"get":{"tags":["get"],"parameters":[{"required":true,"schema":{"type":"integer"},"in":"path","name":"user_id"}],"responses":{"404":{"description":"`user_id` not found"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}},"description":""}}}}},"components":{"schemas":{"User":{"required":["name","age"],"properties":{"name":{"type":"string"},"age":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"}},"type":"object"},"UserId":{"type":"integer"}}},"tags":[{"name":"get","description":"GET operations"},{"name":"post","description":"POST operations"}]}
141+
-- {"openapi":"3.0.0","info":{"version":"","title":""},"paths":{"/":{"get":{"tags":["get"],"responses":{"200":{"content":{"application/json;charset=utf-8":{"schema":{"items":{"$ref":"#/components/schemas/User"},"type":"array"}}},"description":""}}},"post":{"tags":["post"],"requestBody":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"400":{"description":"Invalid `body`"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/UserId"}}},"description":""}}}},"/{user_id}":{"get":{"tags":["get"],"parameters":[{"required":true,"schema":{"type":"integer"},"in":"path","name":"user_id"}],"responses":{"404":{"description":"`user_id` not found"},"200":{"content":{"application/json;charset=utf-8":{"schema":{"$ref":"#/components/schemas/User"}}},"description":""}}}}},"components":{"schemas":{"User":{"required":["name","age"],"type":"object","properties":{"age":{"maximum":9223372036854775807,"minimum":-9223372036854775808,"type":"integer"},"name":{"type":"string"}}},"UserId":{"type":"integer"}}},"tags":[{"name":"get","description":"GET operations"},{"name":"post","description":"POST operations"}]}
142142
--
143143
-- This applies @\"get\"@ tag to the @GET@ endpoints and @\"post\"@ tag to the @POST@ endpoint of the User API.
144144

0 commit comments

Comments
 (0)