Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add --check option in Mix tasks to compare the generated spec with a previously generated file #618

Merged

Conversation

davidebriani
Copy link
Contributor

Add a --check option to run Mix tasks and compare the generated spec with a previously generated file.

This is useful for scenarios where a CI check is desirable to catch unwanted drifts from a validated OpenAPI spec: e.g. the OpenAPI spec is committed and reviewed, and should not change without additional review.

Fixes #617

Add a --check option to run Mix tasks and compare the generated spec
with a previously generated file.

This is useful for scenarios where a CI check is desirable to catch
unwanted drifts from a validated OpenAPI spec: e.g. the OpenAPI spec is
committed and reviewed, and should not change without additional review.

Fixes open-api-spex#617

Signed-off-by: Davide Briani <davide@briani.dev>
@mbuhot mbuhot merged commit 56dcf23 into open-api-spex:master Jul 7, 2024
14 checks passed
@@ -7,6 +7,7 @@ defmodule Mix.Tasks.Openapi.Spec.Json do

$ mix openapi.spec.json --spec PhoenixAppWeb.ApiSpec apispec.json
$ mix openapi.spec.json --spec PhoenixAppWeb.ApiSpec --pretty=true
$ mix openapi.spec.json --spec PhoenixAppWeb.ApiSpec --check=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small stylistic note: Boolean arga can be set to true with just --arg, looks a bit nicer than --arg=true

nathanalderson pushed a commit to Tango-Tango/open_api_spex that referenced this pull request Dec 20, 2024
…le (open-api-spex#618)

Add a --check option to run Mix tasks and compare the generated spec
with a previously generated file.

This is useful for scenarios where a CI check is desirable to catch
unwanted drifts from a validated OpenAPI spec: e.g. the OpenAPI spec is
committed and reviewed, and should not change without additional review.

Fixes open-api-spex#617

Signed-off-by: Davide Briani <davide@briani.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a --check flag to mix openapi.spec.json and mix openapi.spec.yaml
3 participants