-
-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving servant-swagger into the main servant repo
- Loading branch information
1 parent
0f160b8
commit 4378353
Showing
30 changed files
with
2,551 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
# This Travis job script has been generated by a script via | ||
# | ||
# haskell-ci '--config=cabal.haskell-ci' 'cabal.project' | ||
# | ||
# To regenerate the script (for example after adjusting tested-with) run | ||
# | ||
# haskell-ci regenerate | ||
# | ||
# For more information, see https://github.com/haskell-CI/haskell-ci | ||
# | ||
# version: 0.10.3 | ||
# | ||
version: ~> 1.0 | ||
language: c | ||
os: linux | ||
dist: xenial | ||
git: | ||
# whether to recursively clone submodules | ||
submodules: false | ||
branches: | ||
only: | ||
- master | ||
cache: | ||
directories: | ||
- $HOME/.cabal/packages | ||
- $HOME/.cabal/store | ||
- $HOME/.hlint | ||
before_cache: | ||
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log | ||
# remove files that are regenerated by 'cabal update' | ||
- rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.* | ||
- rm -fv $CABALHOME/packages/hackage.haskell.org/*.json | ||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache | ||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar | ||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx | ||
- rm -rfv $CABALHOME/packages/head.hackage | ||
jobs: | ||
include: | ||
- compiler: ghc-8.10.2 | ||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.2","cabal-install-3.2"]}} | ||
os: linux | ||
- compiler: ghc-8.8.4 | ||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.4","cabal-install-3.2"]}} | ||
os: linux | ||
- compiler: ghc-8.6.5 | ||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}} | ||
os: linux | ||
- compiler: ghc-8.4.4 | ||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}} | ||
os: linux | ||
- compiler: ghc-8.2.2 | ||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}} | ||
os: linux | ||
- compiler: ghc-8.0.2 | ||
addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}} | ||
os: linux | ||
before_install: | ||
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') | ||
- WITHCOMPILER="-w $HC" | ||
- HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//') | ||
- HCPKG="$HC-pkg" | ||
- unset CC | ||
- CABAL=/opt/ghc/bin/cabal | ||
- CABALHOME=$HOME/.cabal | ||
- export PATH="$CABALHOME/bin:$PATH" | ||
- TOP=$(pwd) | ||
- "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')" | ||
- echo $HCNUMVER | ||
- CABAL="$CABAL -vnormal+nowrap" | ||
- set -o pipefail | ||
- TEST=--enable-tests | ||
- BENCH=--enable-benchmarks | ||
- HEADHACKAGE=false | ||
- rm -f $CABALHOME/config | ||
- | | ||
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config | ||
echo "remote-build-reporting: anonymous" >> $CABALHOME/config | ||
echo "write-ghc-environment-files: always" >> $CABALHOME/config | ||
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config | ||
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config | ||
echo "world-file: $CABALHOME/world" >> $CABALHOME/config | ||
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config | ||
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config | ||
echo "installdir: $CABALHOME/bin" >> $CABALHOME/config | ||
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config | ||
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config | ||
echo "install-dirs user" >> $CABALHOME/config | ||
echo " prefix: $CABALHOME" >> $CABALHOME/config | ||
echo "repository hackage.haskell.org" >> $CABALHOME/config | ||
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config | ||
install: | ||
- ${CABAL} --version | ||
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" | ||
- | | ||
echo "program-default-options" >> $CABALHOME/config | ||
echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config | ||
- cat $CABALHOME/config | ||
- rm -fv cabal.project cabal.project.local cabal.project.freeze | ||
- travis_retry ${CABAL} v2-update -v | ||
# Generate cabal.project | ||
- rm -rf cabal.project cabal.project.local cabal.project.freeze | ||
- touch cabal.project | ||
- | | ||
echo "packages: ." >> cabal.project | ||
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-swagger' >> cabal.project ; fi | ||
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" | ||
- | | ||
echo "allow-newer: aeson-pretty-0.8.7:base-compat" >> cabal.project | ||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-swagger)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" | ||
- cat cabal.project || true | ||
- cat cabal.project.local || true | ||
- if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi | ||
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | ||
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" | ||
- rm cabal.project.freeze | ||
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | ||
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | ||
script: | ||
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) | ||
# Packaging... | ||
- ${CABAL} v2-sdist all | ||
# Unpacking... | ||
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ | ||
- cd ${DISTDIR} || false | ||
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \; | ||
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \; | ||
- PKGDIR_servant_swagger="$(find . -maxdepth 1 -type d -regex '.*/servant-swagger-[0-9.]*')" | ||
# Generate cabal.project | ||
- rm -rf cabal.project cabal.project.local cabal.project.freeze | ||
- touch cabal.project | ||
- | | ||
echo "packages: ${PKGDIR_servant_swagger}" >> cabal.project | ||
- if [ $HCNUMVER -ge 80200 ] ; then echo 'package servant-swagger' >> cabal.project ; fi | ||
- "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" | ||
- | | ||
echo "allow-newer: aeson-pretty-0.8.7:base-compat" >> cabal.project | ||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(servant-swagger)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" | ||
- cat cabal.project || true | ||
- cat cabal.project.local || true | ||
# Building... | ||
# this builds all libraries and executables (without tests/benchmarks) | ||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | ||
# Building with tests and benchmarks... | ||
# build & run tests, build benchmarks | ||
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | ||
# Testing... | ||
- ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | ||
# cabal check... | ||
- (cd ${PKGDIR_servant_swagger} && ${CABAL} -vnormal check) | ||
# haddock... | ||
- ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | ||
# Building without installed constraints for packages in global-db... | ||
- rm -f cabal.project.local | ||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | ||
# Constraint sets | ||
- rm -rf cabal.project.local | ||
# Constraint set swagger2-2.3 | ||
- if [ $HCNUMVER -lt 80800 ] ; then ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='swagger2 ==2.3.*' all ; fi | ||
# Constraint set swagger2-2.4 | ||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='swagger2 ==2.4.*' all | ||
# Constraint set swagger2-2.5 | ||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='swagger2 ==2.5.*' all | ||
# Constraint set servant-0.18.1 | ||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='servant == 0.18.1' all | ||
|
||
# REGENDATA ("0.10.3",["--config=cabal.haskell-ci","cabal.project"]) | ||
# EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
1.1.9 | ||
------- | ||
|
||
* Support `servant-0.18` | ||
|
||
1.1.8 | ||
------- | ||
|
||
* Support `servant-0.17` | ||
|
||
1.1.7.1 | ||
------- | ||
|
||
* Support `swagger2-2.4` | ||
|
||
1.1.7 | ||
----- | ||
|
||
* Support servant-0.15 | ||
- support for 'Stream' and 'StreamBody' combinators | ||
- orphan 'ToSchema (SourceT m a)' instance | ||
* Fix BodyTypes to work with generalized ReqBody' | ||
[#88](https://github.com/haskell-servant/servant-swagger/pull/88) | ||
|
||
1.1.6 | ||
----- | ||
|
||
* Fixes: | ||
* `validateEveryToJSON` now prints validation errors | ||
|
||
* Notes: | ||
* GHC-8.6 compatible release | ||
|
||
1.1.5 | ||
----- | ||
|
||
* Notes: | ||
* `servant-0.13` compatible release | ||
* Drops compatibility with previous `servant` versions. | ||
|
||
1.1.4 | ||
----- | ||
|
||
* Notes: | ||
* `servant-0.12` compatible release | ||
|
||
1.1.3.1 | ||
--- | ||
|
||
* Notes: | ||
* GHC-8.2 compatible release | ||
|
||
1.1.3 | ||
--- | ||
|
||
* Notes: | ||
* `servant-0.11` compatible release | ||
|
||
1.1.2.1 | ||
--- | ||
|
||
* Notes: | ||
* `servant-0.10` compatible release | ||
|
||
1.1.2 | ||
--- | ||
|
||
* Minor fixes: | ||
* Support for aeson-1, insert-ordered-containers-0.2 | ||
* CaptureAll instance | ||
|
||
1.1.1 | ||
--- | ||
|
||
* Minor fixes: | ||
* Fix `unused-imports` and `unused-foralls` warnings; | ||
* Fix tests to match `swagger2-2.1.1` (add `example` property for `UTCTime` schema). | ||
|
||
1.1 | ||
--- | ||
|
||
* Breaking changes: | ||
* Requires `swagger2 >= 2.1` | ||
* Requires `servant >= 0.5` | ||
|
||
* Notes: | ||
* GHC-8.0 compatible release | ||
|
||
1.0.3 | ||
--- | ||
|
||
* Fixes: | ||
* Improve compile-time performance of `BodyTypes` even further (see [18e0d95](https://github.com/haskell-servant/servant-swagger/commit/18e0d95ef6fe9076dd9621cb515d8d1a189f71d3))! | ||
|
||
1.0.2 | ||
--- | ||
|
||
* Minor changes: | ||
* Add GHC 7.8 support (see [#26](https://github.com/haskell-servant/servant-swagger/pull/26)). | ||
|
||
* Fixes: | ||
* Improve compile-time performance of `BodyTypes` (see [#25](https://github.com/haskell-servant/servant-swagger/issues/25)). | ||
|
||
1.0.1 | ||
--- | ||
|
||
* Fixes: | ||
* Stop using `Data.Swagger.Internal`; | ||
* Documentation fixes (links to examples). | ||
|
||
1.0 | ||
--- | ||
|
||
* Major changes (see [#24](https://github.com/haskell-servant/servant-swagger/pull/24)): | ||
* Switch to `swagger2-2.*`; | ||
* Add automatic `ToJSON`/`ToSchema` validation tests; | ||
* Add great documentation; | ||
* Export some type-level functions for servant API. | ||
|
||
* Minor changes: | ||
* Rework Todo API example; | ||
* Stop exporting `ToResponseHeader`, `AllAccept` and `AllToResponseHeader` (see [bd50db4](https://github.com/haskell-servant/servant-swagger/commit/bd50db48ca6a106e4366560ded70932d409de1e2)); | ||
* Change maintainer, update authors/copyrights (see [1a62681](https://github.com/haskell-servant/servant-swagger/commit/1a6268101dc826a92c42e832e402e251c0d32147)); | ||
* Include changelog and example files into `extra-source-files`. | ||
|
||
0.1.2 | ||
--- | ||
|
||
* Fixes: | ||
* Fix default spec for `ReqBody` param to be required (see [#22](https://github.com/haskell-servant/servant-swagger/issues/22)); | ||
* Set version bounds for `swagger2`. | ||
|
||
0.1.1 | ||
--- | ||
|
||
* Fixes: | ||
* Fix `subOperations` to filter endpoints also by method (see [#18](https://github.com/haskell-servant/servant-swagger/issues/18)); | ||
* Fix response schema in `ToSwagger` instance for `Header` (see [b59e557](https://github.com/haskell-servant/servant-swagger/commit/b59e557a05bc2669332c52b397879e7598747b82)). | ||
|
||
0.1 | ||
--- | ||
* Major changes | ||
* Use `swagger2` for data model (see [#9](https://github.com/dmjio/servant-swagger/pull/9)); this changes almost everything. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright (c) 2015-2016, Servant contributors | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of servant-swagger nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# servant-swagger | ||
|
||
[![Build Status](https://travis-ci.org/haskell-servant/servant-swagger.svg?branch=master)](https://travis-ci.org/haskell-servant/servant-swagger) | ||
[![Hackage](https://img.shields.io/hackage/v/servant-swagger.svg)](http://hackage.haskell.org/package/servant-swagger) | ||
[![Stackage LTS](http://stackage.org/package/servant-swagger/badge/lts)](http://stackage.org/lts/package/servant-swagger) | ||
[![Stackage Nightly](http://stackage.org/package/servant-swagger/badge/nightly)](http://stackage.org/nightly/package/servant-swagger) | ||
|
||
Swagger 2.0 conforming json for [servant](https://github.com/haskell-servant/servant) APIs. | ||
|
||
![servant-swagger robot](http://s16.postimg.org/rndz1wbyt/servant.png) | ||
|
||
### Motivation | ||
|
||
Swagger is a project used to describe and document RESTful APIs. | ||
Unlike Servant it is language-agnostic and thus is quite popular among developers | ||
in different languages. It also exists for a longer time and has more tools to work with. | ||
|
||
This package provides means to generate Swagger specification for a Servant API | ||
and also to partially test whether API conforms with its specification. | ||
|
||
Generated Swagger specification then can be used for many things such as | ||
- displaying interactive documentation using [Swagger UI](http://swagger.io/swagger-ui/); | ||
- generating clients and servers in many languages using [Swagger Codegen](http://swagger.io/swagger-codegen/); | ||
- and [many others](http://swagger.io/open-source-integrations/). | ||
|
||
### Usage | ||
|
||
Please refer to [haddock documentation](http://hackage.haskell.org/package/servant-swagger). | ||
|
||
Some examples can be found in [`example/` directory](/example). | ||
|
||
### Try it out | ||
|
||
All generated swagger specifications can be interactively viewed on [Swagger Editor](http://editor.swagger.io/). | ||
|
||
Ready-to-use specification can be served as JSON and interactive API documentation | ||
can be displayed using [Swagger UI](https://github.com/swagger-api/swagger-ui). | ||
|
||
Many Swagger tools, including server and client code generation for many languages, can be found on | ||
[Swagger's Tools and Integrations page](http://swagger.io/open-source-integrations/). | ||
|
||
### Contributing | ||
|
||
We are happy to receive bug reports, fixes, documentation enhancements, and other improvements. | ||
|
||
Please report bugs via the [github issue tracker](https://github.com/haskell-servant/servant-swagger/issues). | ||
|
Oops, something went wrong.