fix: path-item $ref produces/consumes inheritance (via #5049)
* implement a selector for consumes options * fix incorrect comment, test names * add `consumesOptionsFor` selector * use `consumesOptionsFor` and drop `operationConsumes`
This commit is contained in:
17
test/e2e-cypress/static/documents/bugs/5043/status.yaml
Normal file
17
test/e2e-cypress/static/documents/bugs/5043/status.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
paths:
|
||||
findByStatus:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Finds Pets by status"
|
||||
description: "Multiple status values can be provided with comma separated strings"
|
||||
operationId: "findPetsByStatus"
|
||||
parameters:
|
||||
- name: "status"
|
||||
in: "body"
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
||||
44
test/e2e-cypress/static/documents/bugs/5043/swagger.yaml
Normal file
44
test/e2e-cypress/static/documents/bugs/5043/swagger.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
|
||||
version: "1.0.0"
|
||||
title: "Swagger Petstore"
|
||||
termsOfService: "http://swagger.io/terms/"
|
||||
contact:
|
||||
email: "apiteam@swagger.io"
|
||||
license:
|
||||
name: "Apache 2.0"
|
||||
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
host: "petstore.swagger.io"
|
||||
basePath: "/v2"
|
||||
produces:
|
||||
- application/json
|
||||
- application/xml
|
||||
- text/csv
|
||||
consumes:
|
||||
- application/json
|
||||
- application/xml
|
||||
- text/csv
|
||||
schemes:
|
||||
- "https"
|
||||
- "http"
|
||||
paths:
|
||||
/pet:
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Add a new pet to the store"
|
||||
description: ""
|
||||
operationId: "addPet"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Pet object that needs to be added to the store"
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/Pet"
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
/pet/findByStatus:
|
||||
$ref: "status.yaml#/paths/findByStatus"
|
||||
32
test/e2e-cypress/tests/bugs/5043.js
Normal file
32
test/e2e-cypress/tests/bugs/5043.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import repeat from "lodash/repeat"
|
||||
|
||||
describe("#5043: path-level $ref path items should inherit global consumes/produces", () => {
|
||||
it("should render consumes options correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5043/swagger.yaml")
|
||||
.get("#operations-pet-findPetsByStatus")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".content-type")
|
||||
.contains("application/json")
|
||||
.get(".content-type")
|
||||
.contains("application/xml")
|
||||
.get(".content-type")
|
||||
.contains("text/csv")
|
||||
})
|
||||
it("should render produces options correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5043/swagger.yaml")
|
||||
.get("#operations-pet-findPetsByStatus")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".body-param-content-type select")
|
||||
.contains("application/json")
|
||||
.get(".body-param-content-type select")
|
||||
.contains("application/xml")
|
||||
.get(".body-param-content-type select")
|
||||
.contains("text/csv")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user