Skip to content

Commit

Permalink
Release 0.17.0-M11
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Dec 9, 2020
1 parent 1a55940 commit de01a8e
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tapir documentation is available at [tapir.softwaremill.com](http://tapir.softwa
Add the following dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.17.0-M11"
```

You'll need partial unification enabled in the compiler (alternatively, you'll need to manually provide type arguments in some cases):
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2 changes: 1 addition & 1 deletion generated-doc/out/client/play.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Add the dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-play-client" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-play-client" % "0.17.0-M11"
```

To make requests using an endpoint definition using the [play client](https://github.com/playframework/play-ws), import:
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/client/sttp.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Add the dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-sttp-client" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-sttp-client" % "0.17.0-M11"
```

To make requests using an endpoint definition using the [sttp client](https://github.com/softwaremill/sttp), import:
Expand Down
6 changes: 4 additions & 2 deletions generated-doc/out/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
extensions = [
'sphinx_markdown_tables',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -182,4 +184,4 @@ def setup(app):
'auto_toc_tree_section': 'Contents',
'enable_auto_doc_ref': False
}, True)
app.add_transform(AutoStructify)
app.add_transform(AutoStructify)
4 changes: 2 additions & 2 deletions generated-doc/out/docs/asyncapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
To use, add the following dependencies:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-docs" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-circe-yaml" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-docs" % "0.17.0-M11"
"com.softwaremill.sttp.tapir" %% "tapir-asyncapi-circe-yaml" % "0.17.0-M11"
```

Tapir contains a case class-based model of the asyncapi data structures in the `asyncapi/asyncapi-model` subproject (the
Expand Down
20 changes: 10 additions & 10 deletions generated-doc/out/docs/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
To use, add the following dependencies:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-openapi-circe-yaml" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-openapi-docs" % "0.17.0-M11"
"com.softwaremill.sttp.tapir" %% "tapir-openapi-circe-yaml" % "0.17.0-M11"
```

Tapir contains a case class-based model of the openapi data structures in the `openapi/openapi-model` subproject (the
Expand Down Expand Up @@ -70,26 +70,26 @@ akka-http/http4s routes for exposing documentation using [Swagger UI](https://sw

```scala
// Akka HTTP
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-akka-http" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-redoc-akka-http" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-akka-http" % "0.17.0-M11"
"com.softwaremill.sttp.tapir" %% "tapir-redoc-akka-http" % "0.17.0-M11"

// Finatra
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-finatra" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-finatra" % "0.17.0-M11"

// HTTP4S
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-http4s" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-redoc-http4s" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-http4s" % "0.17.0-M11"
"com.softwaremill.sttp.tapir" %% "tapir-redoc-http4s" % "0.17.0-M11"

// Play
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-play" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-redoc-play" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-play" % "0.17.0-M11"
"com.softwaremill.sttp.tapir" %% "tapir-redoc-play" % "0.17.0-M11"
```

Note: `tapir-swagger-ui-akka-http` transitively pulls some Akka modules in version 2.6. If you want to force
your own Akka version (for example 2.5), use sbt exclusion. Mind the Scala version in artifact name:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-akka-http" % "0.17.0-M10" exclude("com.typesafe.akka", "akka-stream_2.12")
"com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-akka-http" % "0.17.0-M11" exclude("com.typesafe.akka", "akka-stream_2.12")
```

Usage example for akka-http:
Expand Down
6 changes: 3 additions & 3 deletions generated-doc/out/endpoint/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `tapir-cats` module contains additional instances for some [cats](https://ty
datatypes as well as additional syntax:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-cats" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-cats" % "0.17.0-M11"
```

- `import sttp.tapir.integ.cats.codec._` - brings schema, validator and codec instances
Expand All @@ -19,7 +19,7 @@ If you use [refined](https://github.com/fthomas/refined), the `tapir-refined` mo
validators for `T Refined P` as long as a codec for `T` already exists:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-refined" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-refined" % "0.17.0-M11"
```

You'll need to extend the `sttp.tapir.codec.refined.TapirCodecRefined`
Expand All @@ -40,7 +40,7 @@ The `tapir-enumeratum` module provides schemas, validators and codecs for [Enume
enumerations. To use, add the following dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-enumeratum" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-enumeratum" % "0.17.0-M11"
```

Then, `import sttp.tapir.codec.enumeratum`, or extends the `sttp.tapir.codec.enumeratum.TapirCodecEnumeratum` trait.
Expand Down
12 changes: 6 additions & 6 deletions generated-doc/out/endpoint/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ the json codec that is in scope.
To use Circe add the following dependency to your project:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % "0.17.0-M11"
```

Next, import the package (or extend the `TapirJsonCirce` trait, see [MyTapir](../mytapir.md)):
Expand Down Expand Up @@ -93,7 +93,7 @@ Now the above JSON object will render as
To use µPickle add the following dependency to your project:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-json-upickle" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-json-upickle" % "0.17.0-M11"
```

Next, import the package (or extend the `TapirJsonuPickle` trait, see [MyTapir](../mytapir.md) and add `TapirJsonuPickle` not `TapirCirceJson`):
Expand Down Expand Up @@ -128,7 +128,7 @@ For more examples, including making a custom encoder/decoder, see [TapirJsonuPic
To use Play JSON add the following dependency to your project:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-json-play" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-json-play" % "0.17.0-M11"
```

Next, import the package (or extend the `TapirJsonPlay` trait, see [MyTapir](../mytapir.md) and add `TapirJsonPlay` not `TapirCirceJson`):
Expand All @@ -144,7 +144,7 @@ Play JSON requires `Reads` and `Writes` implicit values in scope for each type y
To use Spray JSON add the following dependency to your project:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-json-spray" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-json-spray" % "0.17.0-M11"
```

Next, import the package (or extend the `TapirJsonSpray` trait, see [MyTapir](../mytapir.md) and add `TapirJsonSpray` not `TapirCirceJson`):
Expand All @@ -160,7 +160,7 @@ Spray JSON requires a `JsonFormat` implicit value in scope for each type you wan
To use Tethys JSON add the following dependency to your project:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-json-tethys" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-json-tethys" % "0.17.0-M11"
```

Next, import the package (or extend the `TapirJsonTethys` trait, see [MyTapir](../mytapir.md) and add `TapirJsonTethys` not `TapirCirceJson`):
Expand All @@ -176,7 +176,7 @@ Tethys JSON requires `JsonReader` and `JsonWriter` implicit values in scope for
To use [Jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) add the following dependency to your project:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-jsoniter-scala" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-jsoniter-scala" % "0.17.0-M11"
```

Next, import the package (or extend the `TapirJsonJsoniter` trait, see [MyTapir](../mytapir.md) and add `TapirJsonJsoniter` not `TapirCirceJson`):
Expand Down
4 changes: 2 additions & 2 deletions generated-doc/out/endpoint/zio.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ exposing the endpoints using the [http4s](https://http4s.org) server.
You'll need the following dependencies:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-zio" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-zio-http4s-server" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-zio" % "0.17.0-M11"
"com.softwaremill.sttp.tapir" %% "tapir-zio-http4s-server" % "0.17.0-M11"
```

Next, instead of the usual `import sttp.tapir._`, you should import:
Expand Down
62 changes: 62 additions & 0 deletions generated-doc/out/generator/sbt-openapi-codegen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Generate endpoint definitions from an OpenAPI YAML

```eval_rst
.. note::
This is a really early alpha implementation.
```

## Installation steps

Add the sbt plugin to the `project/plugins.sbt`:

```scala
addSbtPlugin("com.softwaremill.sttp.tapir" % "sbt-openapi-codegen" % "0.17.0-M11")
```

Enable the plugin for your project in the `build.sbt`:

```scala
enablePlugins(OpenapiCodegenPlugin)
```

Add your OpenApi file to the project, and override the `openapiSwaggerFile` setting in the `build.sbt`:

```scala
openapiSwaggerFile := baseDirectory.value / "swagger.yaml"
```

At this point your compile step will try to generate the endpoint definitions
to the `sttp.tapir.generated.TapirGeneratedEndpoints` object, where you can access the
defined case-classes and endpoint definitions.

## Usage and options

The generator currently supports these settings, you can override them in the `build.sbt`;

| setting | default value | description |
|---|---|---|
| openapiSwaggerFile | baseDirectory.value / "swagger.yaml" | The swagger file with the api definitions. |
| openapiPackage | sttp.tapir.generated | The name for the generated package. |
| openapiObject | TapirGeneratedEndpoints | The name for the generated object. |

The general usage is;

```scala
import sttp.tapir.generated._
import sttp.tapir.docs.openapi._
import sttp.tapir.openapi.circe.yaml._

val docs = TapirGeneratedEndpoints.generatedEndpoints.toOpenAPI("My Bookshop", "1.0")
```

### Limitations

Currently, the generated code depends on `"io.circe" %% "circe-generic"`. In the future probably we will make the encoder/decoder json lib configurable (PRs welcome).

We currently miss a lot of OpenApi features like:
- tags
- enums/ADTs
- missing model types and meta descriptions (like date, minLength)
- file handling

6 changes: 6 additions & 0 deletions generated-doc/out/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ Development and maintenance of sttp tapir is sponsored by [SoftwareMill](https:/
testing
.. toctree::
:maxdepth: 2
:caption: Generators
generator/sbt-openapi-codegen
.. toctree::
:maxdepth: 2
:caption: Other subjects
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To use tapir, add the following dependency to your project:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-core" % "0.17.0-M11"
```

This will import only the core classes needed to create endpoint descriptions. To generate a server or a client, you
Expand Down
3 changes: 2 additions & 1 deletion generated-doc/out/requirements.pip
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
sphinx_rtd_theme==0.4.3
recommonmark==0.5.0
sphinx==2.0.1
sphinx-autobuild==0.7.1
sphinx-autobuild==0.7.1
sphinx-markdown-tables==0.0.15
4 changes: 2 additions & 2 deletions generated-doc/out/server/akkahttp.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ To expose an endpoint as an [akka-http](https://doc.akka.io/docs/akka-http/curre
dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.17.0-M11"
```

This will transitively pull some Akka modules in version 2.6. If you want to force
your own Akka version (for example 2.5), use sbt exclusion. Mind the Scala version in artifact name:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.17.0-M10" exclude("com.typesafe.akka", "akka-stream_2.12")
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % "0.17.0-M11" exclude("com.typesafe.akka", "akka-stream_2.12")
```

Now import the package:
Expand Down
4 changes: 2 additions & 2 deletions generated-doc/out/server/finatra.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ To expose an endpoint as an [finatra](https://twitter.github.io/finatra/) server
dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-finatra-server" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-finatra-server" % "0.17.0-M11"
```

and import the package:
Expand All @@ -16,7 +16,7 @@ import sttp.tapir.server.finatra._
or if you would like to use cats-effect project, you can add the following dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-finatra-server-cats" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-finatra-server-cats" % "0.17.0-M11"
```

and import the packate:
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/server/http4s.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ To expose an endpoint as an [http4s](https://http4s.org) server, first add the f
dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % "0.17.0-M11"
```

and import the package:
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/server/play.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To expose endpoint as a [play-server](https://www.playframework.com/) first add the following dependencies:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-play-server" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-play-server" % "0.17.0-M11"
```

and (if you don't already depend on Play)
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/server/vertx.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Endpoints can be mounted as Vert.x `Route`s on top of a Vert.x `Router`.

Use the following dependency
```scala
"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % "0.17.0-M11"
```

Then import the package:
Expand Down
2 changes: 1 addition & 1 deletion generated-doc/out/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ details on how the stub works).
Add the dependency:

```scala
"com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % "0.17.0-M10"
"com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % "0.17.0-M11"
```

And the following imports:
Expand Down

0 comments on commit de01a8e

Please sign in to comment.