Skip to content

Commit

Permalink
add test for OpenAPI 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
glowcloud committed May 14, 2024
1 parent 30f0c89 commit b6fc6c9
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 2 deletions.
27 changes: 25 additions & 2 deletions test/e2e-cypress/e2e/features/parameters-one-of-any-of.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,32 @@
* @prettier
*/

describe("Parameter with oneOf and anyOf keywords", () => {
describe("Parameter with oneOf and anyOf keywords in OpenAPI 3.0.x", () => {
it("should render correct form fields", () => {
cy.visit("/?url=/documents/features/parameters-one-of-any-of.yaml")
cy.visit("/?url=/documents/features/parameters-one-of-any-of-oas3.yaml")
.get("#operations-default-get_")
.click()
cy.get(".parameters-col_description")
.eq(1)
.find("select")
.should("exist")
.and("have.value", "ascending")
cy.get(".parameters-col_description")
.eq(2)
.find("input")
.should("exist")
.and("have.value", "test")
cy.get(".parameters-col_description")
.eq(3)
.find("textarea")
.should("exist")
.and("contain", "\"eq\": \"active\"")
})
})

describe("Parameter with oneOf and anyOf keywords in OpenAPI 3.1.0.", () => {
it("should render correct form fields", () => {
cy.visit("/?url=/documents/features/parameters-one-of-any-of-oas31.yaml")
.get("#operations-default-get_")
.click()
cy.get(".parameters-col_description")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
openapi: 3.1.0
paths:
/:
get:
parameters:
- name: enum
in: query
schema:
oneOf:
- type: string
default: ascending
enum:
- ascending
- descending
- name: string
in: query
default: test
schema:
anyOf:
- type: string
- name: object
in: query
schema:
oneOf:
- type: object
properties:
eq:
type: string
enum:
- active
- archived
neq:
type: string
enum:
- active
- archived
in:
type: array
items:
type: string
enum:
- active
- archived
notIn:
type: array
items:
type: string
enum:
- active
- archived

0 comments on commit b6fc6c9

Please sign in to comment.