You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I am trying to use Open API v3 that I made in SwaggerHub but it fails for me with given error. Any idea what could be the problem?
Spec
RSpec.describe BackendController, type: :request do
let(:open_api_json) do
File.read("openapi.json")
end
describe "GET article_v1" do
specify do
get "/Old-Road-Studio/blogging/1.0.0/v1/article/123"
expect(response).to have_http_status(200)
expect(response.body).to be_valid_openapi_schema
end
end
Error
1) BackendController GET article_v1 should be valid openapi schema
Failure/Error: expect(response.body).to be_valid_openapi_schema
JSON::Schema::ValidationError:
The property '#/' did not contain a required property of 'swagger'
# ./spec/requests/backends_spec.rb:12:in `block (3 levels) in <top (required)>'
First off, thanks for using this project! Sorry I haven't replied to this sooner. I've been meaning to debug it but have been busy with work.
I actually haven't tested this with version 3 of the spec. I should have put in the README that it's only v2 supported. My guess is that the json scheme I have for validating that your json is valid is failing because it's checking for v2 formatting. However, I haven't confirmed that.
We could now enhance this gem to support either format. I don't have the time right now, but I'd be happy to help if someone made an initial PR with a possible solution.
I would love to add v3 support, it just might take me a bit of time until I could do it on my own.
Thanks again for using this project! I hope it's been helpful to you in the past if you had other v2 projects.
Will add v3 support soon. Already put the starting pieces into the schema-validator gem for that.
Problem is exactly the default being v2 spec. There is no option yet to define which spec version you wanna use.
Hey, I am trying to use Open API v3 that I made in SwaggerHub but it fails for me with given error. Any idea what could be the problem?
Spec
Error
Schema
The text was updated successfully, but these errors were encountered: