Skip to content

Commit

Permalink
skip added required properties in the response-property-became-requir…
Browse files Browse the repository at this point in the history
…ed check
  • Loading branch information
tcdsv committed Feb 5, 2024
1 parent b91141d commit 837ca53
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 45 deletions.
4 changes: 4 additions & 0 deletions checker/check-response-property-became-required.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func ResponsePropertyBecameRequiredCheck(diffReport *diff.Diff, operationsSource
if mediaTypeDiff.SchemaDiff.RequiredDiff != nil {
for _, changedRequiredPropertyName := range mediaTypeDiff.SchemaDiff.RequiredDiff.Added {
id := ResponsePropertyBecameRequiredId
if mediaTypeDiff.SchemaDiff.Base.Properties[changedRequiredPropertyName] == nil {
// added properties are processed by ResponseRequiredPropertyUpdatedCheck check
continue
}
if mediaTypeDiff.SchemaDiff.Revision.Properties[changedRequiredPropertyName] == nil {
// removed properties processed by the ResponseRequiredPropertyUpdatedCheck check
continue
Expand Down
94 changes: 49 additions & 45 deletions data/checker/response_property_became_optional_base.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
openapi: 3.0.1
info:
title: Tufin
version: "2.0"
servers:
- url: https://localhost:9080
paths:
/api/v1.0/groups:
post:
operationId: createOneGroup
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/GroupView'
description: OK
summary: Create One Project
components:
parameters:
groupId:
in: path
name: groupId
required: true
schema:
type: string
schemas:
GroupView:
type: object
properties:
data:
type: object
properties:
created:
type: string
format: date-time
readOnly: true
pattern: "^[a-z]+$"
id:
type: string
readOnly: true
name:
type: string
required:
- name
openapi: 3.0.1
info:
title: Tufin
version: "2.0"
servers:
- url: https://localhost:9080
paths:
/api/v1.0/groups:
post:
operationId: createOneGroup
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/GroupView'
description: OK
summary: Create One Project
components:
parameters:
groupId:
in: path
name: groupId
required: true
schema:
type: string
schemas:
GroupView:
type: object
properties:
data:
type: object
properties:
created:
type: string
format: date-time
readOnly: true
pattern: "^[a-z]+$"
id:
type: string
readOnly: true
name:
type: string
required:
- name
location:
type: string
required:
- location

0 comments on commit 837ca53

Please sign in to comment.