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

Validate OpenAPI file #259

Closed
ahx opened this issue May 13, 2024 · 3 comments
Closed

Validate OpenAPI file #259

ahx opened this issue May 13, 2024 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ahx
Copy link
Owner

ahx commented May 13, 2024

Being able to (optionally) validate the structure of a given OpenAPI file would be handy.

Solution idea:

Make use of the meta schemas included in json_schemer

@ahx ahx added the enhancement New feature or request label May 13, 2024
@ahx ahx added the help wanted Extra attention is needed label Jun 7, 2024
@jan-bw
Copy link
Contributor

jan-bw commented Dec 24, 2024

hi, I am wondering whether this makes sense to add this as a separate feature :)

it's fairly straightforward to validate you openapi file in the specs and I think we shouldn't validate it on runtime because that would be inefficient. an example spec in rspec I have is:

RSpec.describe "docs/openapi.yaml schema" do
  it "has correct structure" do
    schemer = JSONSchemer.openapi(
      YAML.load_file(
        Rails.root.join("docs/openapi.yaml")
      )
    )

    expect(schemer.validate.to_a).to eq([])
  end
end

what do you think? :)

@ahx
Copy link
Owner Author

ahx commented Dec 24, 2024

Hey. I totally agree. I was thinking about adding a shortcut to the json_schemer validation or something that is called in tests only.

Thanks for the feedback on this. @jan-bw
Maybe we just skip this.

@ahx
Copy link
Owner Author

ahx commented Jan 11, 2025

Closing this as not planned right now.

@ahx ahx closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants