An sbt plugin to support the OpenAPI Diff project.
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
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()
See the openapi-diff documentation for details on writing diff extensions.
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. |
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.
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.
Based heavily on sbt-openapi-generator.