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
swagger: '2.0'
info:
description: ABC
version: 1.0.5
title: Swagger Petstore
termsOfService: 'http://swagger.io/terms/'
host: petstore.swagger.io
basePath: /v2
schemes:
- https
- http
paths:
/pet/uploadImage:
put:
tags:
- pet
summary: Update an existing pet
description: ''
operationId: updatePet
parameters:
- in: body
name: body
description: Pet object that needs to be added to the store
required: true
schema:
$ref: '#/definitions/Pet'
responses:
'400':
description: Invalid ID supplied
definitions:
Pet:
type: object
required:
- id
properties:
id:
type: integer
format: int64
Lets add a new field in the body parameter Pet which is optional but a field inside that is required.
swagger: '2.0'
info:
description: ABC
version: 1.0.5
title: Swagger Petstore
termsOfService: 'http://swagger.io/terms/'
host: petstore.swagger.io
basePath: /v2
schemes:
- https
- http
paths:
/pet/uploadImage:
put:
tags:
- pet
summary: Update an existing pet
description: ''
operationId: updatePet
parameters:
- in: body
name: body
description: Pet object that needs to be added to the store
required: true
schema:
$ref: '#/definitions/Pet'
responses:
'400':
description: Invalid ID supplied
definitions:
Pet:
type: object
required:
- id
properties:
id:
type: integer
format: int64
breed:
$ref: '#/definitions/Breed'
Breed:
type: object
required:
- name
properties:
name:
type: string
This means that if Breed is passed in body then it must have name property. Or else we can send the request without the whole breed object.
This is being reported as breaking change. java -jar /usr/local/lib/swagger-brake-cli-2.2.0.jar --old-api=old.yml --new-api=new.yaml Loading old API from old.yml Loading new API from new.yaml Successfully loaded APIs Starting the check for breaking API changes Check is finished There were breaking API changes R007 Request parameter breed.name is required in PUT /pet/uploadImage
Incase there already exist a optional parameter and we add new required fields inside that, then it qualifies as a breaking change.
The text was updated successfully, but these errors were encountered:
Consider these two spec files:
Old
Lets add a new field in the body parameter Pet which is optional but a field inside that is required.
This means that if Breed is passed in body then it must have name property. Or else we can send the request without the whole breed object.
This is being reported as breaking change.
java -jar /usr/local/lib/swagger-brake-cli-2.2.0.jar --old-api=old.yml --new-api=new.yaml Loading old API from old.yml Loading new API from new.yaml Successfully loaded APIs Starting the check for breaking API changes Check is finished There were breaking API changes R007 Request parameter breed.name is required in PUT /pet/uploadImage
Incase there already exist a optional parameter and we add new required fields inside that, then it qualifies as a breaking change.
The text was updated successfully, but these errors were encountered: