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
Incorrect Detection of Breaking Change for Default Values in oasdiff
Description
The oasdiff tool is incorrectly marking the addition of a new required property with a default value in request bodies as a breaking change. According to OpenAPI specifications, if a new required field in the request body schema is assigned a default value, it should not be considered a breaking change because it does not require any changes from the client’s side to maintain compatibility.
Versions
oasdiff Version: 1.10.9
OpenAPI Specification Files: Version 1.1 and 1.2
Steps to Reproduce
OpenAPI Specification File 1.1 (api-1.1.yaml):
openapi: 3.0.0info:
title: Order APIversion: '1.1'paths:
/order:
post:
summary: Create a new orderrequestBody:
required: truecontent:
application/json:
schema:
$ref: '#/components/schemas/Order'responses:
'200':
description: Order createdcomponents:
schemas:
Order:
type: objectproperties:
itemId:
type: string
OpenAPI Specification File 1.2 (api-1.2.yaml):
openapi: 3.0.0info:
title: Order APIversion: '1.2'paths:
/order:
post:
summary: Create a new orderrequestBody:
required: truecontent:
application/json:
schema:
$ref: '#/components/schemas/Order'responses:
'200':
description: Order createdcomponents:
schemas:
Order:
type: objectproperties:
itemId:
type: stringquantity:
type: numberdefault: 0required:
- quantity
Run oasdiff on these files:
Use the following command to compare the two versions of the API specifications:
oasdiff api-1.1.yaml api-1.2.yaml
Output
1 breaking changes: 1 error, 0 warning
error [new-required-request-property] at api-1.2.yaml
in API POST /order
added the new required request property 'quantity'
The text was updated successfully, but these errors were encountered:
Incorrect Detection of Breaking Change for Default Values in
oasdiff
Description
The
oasdiff
tool is incorrectly marking the addition of a new required property with a default value in request bodies as a breaking change. According to OpenAPI specifications, if a new required field in the request body schema is assigned a default value, it should not be considered a breaking change because it does not require any changes from the client’s side to maintain compatibility.Versions
Steps to Reproduce
api-1.1.yaml
):api-1.2.yaml
):oasdiff
on these files:Use the following command to compare the two versions of the API specifications:
The text was updated successfully, but these errors were encountered: