Skip to content

Latest commit

 

History

History
69 lines (47 loc) · 2.08 KB

README.md

File metadata and controls

69 lines (47 loc) · 2.08 KB

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.