Fix parameters merging - #39
Conversation
|
Sorry, I can't remember the full context around this code by just looking at #29 and the code. Because the code is "merging" parameters, using Since you have a failing test in your description, could you just add a test case that fails without your implementation change? |
Ok, anyway merging with only the pipe operator there looks odd to me. [1] pry(#<Object>)> base[key]
=> [{"name"=>"id", "in"=>"path", "required"=>true, "schema"=>{"type"=>"integer"}, "example"=>0}]
[2] pry(#<Object>)> value
=> [{"name"=>"id", "in"=>"path", "required"=>true, "schema"=>{"type"=>"integer"}, "example"=>1}]We could merge considering only |
|
@k0kubun: I investigated more on this issue and updated my PR. In master branch, linting the current specs sample OpenAPI file with: I get these errors: No configurations were defined in extends -- using built in recommended configuration by default.
validating spec/rails/doc/openapi.yaml...
[1] spec/rails/doc/openapi.yaml:10:1 at #/servers
Servers must be a non-empty array.
8 | title: rspec-openapi
9 | version: 1.0.0
10 | servers: []
11 | paths:
12 | "/tables":
Error was generated by the no-empty-servers rule.
[2] spec/rails/doc/openapi.yaml:179:9 at #/paths/~1tables~1{id}/get/parameters/1
Operations must have unique `name` + `in` parameters. Repeats of `in:path` + `name:id`.
177 | type: integer
178 | example: 1
179 | - name: id
180 | in: path
… | < 3 more lines >
184 | example: 2
185 | responses:
186 | '200':
Error was generated by the operation-parameters-unique rule.The first error is not relevant (it can be solved via While in my branch: rm spec/rails/doc/openapi.yaml
OPENAPI=1 bundle exec rspec --order defined spec/requests/rails_spec.rb
npx @redocly/openapi-cli lint spec/rails/doc/openapi.yamlThe second error is gone. What do you think? |
k0kubun
left a comment
There was a problem hiding this comment.
It was much easier to understand the context for me now. Thank you!
Hi :)
I think there's a typo / missing
|in the parameters hash merging.I get an error when linting the yaml output of one of my specs:
The incorrect part of the YAML:
Here it is the relevant part of a failing test: