-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
io.swagger.v3.jaxrs2.annotations.operations.AnnotatedOperationMethodTest.testCompletePetResource() fails randomly with:
java.lang.AssertionError:
expected [openapi: 3.0.1
paths:
/pet/findByTags:
get:
summary: Finds Pets by tags
description: Muliple tags can be provided with comma seperated strings. Use
tag1, tag2, tag3 for testing.
operationId: findPetsByTags
parameters:
- name: tags
in: query
description: Tags to filter by
required: true
schema:
type: string
responses:
default:
description: Pets matching criteria
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
400:
description: Invalid tag value
/pet/{petId}:
get:
summary: Find pet by ID
description: Returns a pet when 0 < ID <= 10. ID > 10 or nonintegers will simulate
API error conditions
operationId: getPetById
parameters:
- name: petId
in: path
description: ID of pet that needs to be fetched
required: true
schema:
type: integer
format: int64
responses:
default:
description: The pet
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
400:
description: Invalid ID supplied
404:
description: Pet not found
/pet/bodynoannotation:
post:
summary: Add a new pet to the store no annotation
operationId: addPetNoAnnotation
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
responses:
405:
description: Invalid input
/pet/bodyid:
post:
summary: Add a new pet to the store passing an integer with generic parameter
annotation
operationId: addPetByInteger
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
type: integer
format: int32
application/xml:
schema:
type: integer
format: int32
required: true
responses:
405:
description: Invalid input
/pet/bodyidnoannotation:
post:
summary: Add a new pet to the store passing an integer without parameter annotation
operationId: addPetByIntegerNoAnnotation
requestBody:
content:
application/json:
schema:
type: integer
format: int32
application/xml:
schema:
type: integer
format: int32
responses:
405:
description: Invalid input
/pet:
put:
summary: Update an existing pet
operationId: updatePet
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
required: true
responses:
400:
description: Invalid ID supplied
404:
description: Pet not found
405:
description: Validation exception
post:
summary: Add a new pet to the store
operationId: addPet
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
required: true
responses:
405:
description: Invalid input
/pet/findByStatus:
get:
summary: Finds Pets by status
description: Multiple status values can be provided with comma seperated strings
operationId: findPetsByStatus
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
schema:
type: string
- name: skip
in: query
schema:
type: integer
format: int32
- name: limit
in: query
schema:
type: integer
format: int32
responses:
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
400:
description: Invalid status value
components:
schemas:
Category:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Category
Tag:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: tag
Pet:
type: object
properties:
id:
type: integer
format: int64
category:
$ref: '#/components/schemas/Category'
name:
type: string
photoUrls:
type: array
xml:
wrapped: true
items:
type: string
xml:
name: photoUrl
tags:
type: array
xml:
wrapped: true
items:
$ref: '#/components/schemas/Tag'
status:
type: string
description: pet status in the store
enum:
- available,pending,sold
xml:
name: Pet
] but found [openapi: 3.0.1
paths:
/pet/{petId}:
get:
summary: Find pet by ID
description: Returns a pet when 0 < ID <= 10. ID > 10 or nonintegers will simulate
API error conditions
operationId: getPetById
parameters:
- name: petId
in: path
description: ID of pet that needs to be fetched
required: true
schema:
type: integer
format: int64
responses:
default:
description: The pet
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
400:
description: Invalid ID supplied
404:
description: Pet not found
/pet/bodyid:
post:
summary: Add a new pet to the store passing an integer with generic parameter
annotation
operationId: addPetByInteger
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
type: integer
format: int32
application/xml:
schema:
type: integer
format: int32
required: true
responses:
405:
description: Invalid input
/pet:
put:
summary: Update an existing pet
operationId: updatePet
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
required: true
responses:
400:
description: Invalid ID supplied
404:
description: Pet not found
405:
description: Validation exception
post:
summary: Add a new pet to the store
operationId: addPet
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
required: true
responses:
405:
description: Invalid input
/pet/findByStatus:
get:
summary: Finds Pets by status
description: Multiple status values can be provided with comma seperated strings
operationId: findPetsByStatus
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
schema:
type: string
- name: skip
in: query
schema:
type: integer
format: int32
- name: limit
in: query
schema:
type: integer
format: int32
responses:
default:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
400:
description: Invalid status value
/pet/findByTags:
get:
summary: Finds Pets by tags
description: Muliple tags can be provided with comma seperated strings. Use
tag1, tag2, tag3 for testing.
operationId: findPetsByTags
parameters:
- name: tags
in: query
description: Tags to filter by
required: true
schema:
type: string
responses:
default:
description: Pets matching criteria
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
400:
description: Invalid tag value
/pet/bodynoannotation:
post:
summary: Add a new pet to the store no annotation
operationId: addPetNoAnnotation
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
responses:
405:
description: Invalid input
/pet/bodyidnoannotation:
post:
summary: Add a new pet to the store passing an integer without parameter annotation
operationId: addPetByIntegerNoAnnotation
requestBody:
content:
application/json:
schema:
type: integer
format: int32
application/xml:
schema:
type: integer
format: int32
responses:
405:
description: Invalid input
components:
schemas:
Category:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Category
Tag:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
xml:
name: Tag
Pet:
type: object
properties:
id:
type: integer
format: int64
category:
$ref: '#/components/schemas/Category'
name:
type: string
photoUrls:
type: array
xml:
wrapped: true
items:
type: string
xml:
name: photoUrl
tags:
type: array
xml:
wrapped: true
items:
$ref: '#/components/schemas/Tag'
status:
type: string
description: pet status in the store
enum:
- available,pending,sold
xml:
name: Pet
]
the meaningful difference between the expected and actual results components.schemas.Tag.xml.name. the expectation is that name be "Tag" (capital T) whereas sometimes the names is a lowercase "tag".
i think the reason is that sometimes the Tag schema is discovered by finding
@XmlRootElement(name = "Tag") <---- Capital T "Tag"
public class Tag {
...
}
while other times its discovered via
@XmlRootElement(name = "Pet")
public class Pet {
...
@XmlElementWrapper(name = "tags")
@XmlElement(name = "tag") <----- lowercase t "tag"
public List<Tag> getTags() {
return tags;
}
...
}
Metadata
Metadata
Assignees
Labels
No labels