jrouly / sbt-openapi-diff   0.0.3

GitHub
Scala versions: 2.12 2.10
sbt plugins: 1.0 0.13

sbt-openapi-diff

Scala CI

An sbt plugin to support the OpenAPI Diff project.

Usage

Add to your project/plugins.sbt:

addSbtPlugin("net.rouly" % "sbt-openapi-diff" % "version")

Update your build.sbt:

enablePlugins(OpenApiDiffPlugin)
openApiDiffFiles := (file("openapi.v1.yaml"), file("openapi.v2.yaml"))

Invoke one of the provided tasks:

> openApiDiff
> openApiDiffRender

Changing the renderer

You can change how the diff is rendered by setting openApiDiffRenderer:

import org.openapitools.openapidiff.core.output._
openApiDiffRenderer := new MarkdownRender()
openApiDiffRenderer := new HtmlRender()
openApiDiffRenderer := new ConsoleRender()

Extensions

See the openapi-diff documentation for details on writing diff extensions.

sbt keys

Key Type Description
openApiDiffFiles TaskKey[(sbt.File, sbt.File)] OpenAPI specification files to diff.
openApiDiff TaskKey[ChangedOpenApi] Returns the diff between two OpenAPI specifications.
openApiDiffRenderer SettingKey[Render] OpenAPI specification diff renderer.
openApiDiffRender TaskKey[String] Returns the rendered diff between two OpenAPI specifications.

Examples

Please see an sbt-test configuration for examples of using the plugin. Do not run those examples directly, please copy them to separate place first.

Contribution and testing

Write plugin integration tests under src/sbt-test.

Execute next command to run tests:

sbt scripted

More information about how to write and execute tests is here.

Credits

Based heavily on sbt-openapi-generator.