-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Reuven
committed
Apr 3, 2024
1 parent
05b7335
commit 5369849
Showing
10 changed files
with
161 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
info: | ||
title: Tufin | ||
version: 1.0.0 | ||
openapi: 3.0.3 | ||
paths: | ||
/example/callback: | ||
post: | ||
responses: | ||
'200': | ||
description: 200 response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Empty' | ||
x-amazon-apigateway-integration: | ||
type: http_proxy | ||
connectionId: ${vpc_link_id} | ||
httpMethod: POST | ||
uri: http://api.example.com/v1/example/callback | ||
responses: | ||
default: | ||
statusCode: '201' | ||
passthroughBehavior: when_no_match | ||
connectionType: VPC_LINK | ||
components: | ||
schemas: | ||
Empty: | ||
type: object | ||
title: Empty Schema | ||
properties: {} | ||
required: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
info: | ||
title: Tufin | ||
version: 1.0.0 | ||
openapi: 3.0.3 | ||
paths: | ||
/example/callback: | ||
post: | ||
responses: | ||
'200': | ||
description: 200 response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Empty' | ||
x-amazon-apigateway-integration: | ||
type: http_proxy | ||
connectionId: ${vpc_link_id} | ||
httpMethod: POST | ||
uri: http://api.example.com/v1/example/calllllllllback | ||
responses: | ||
default: | ||
statusCode: '200' | ||
passthroughBehavior: when_no_match | ||
connectionType: VPC_LINK | ||
components: | ||
schemas: | ||
Empty: | ||
type: object | ||
title: Empty Schema | ||
properties: {} | ||
required: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package diff | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/wI2L/jsondiff" | ||
) | ||
|
||
// ModifiedInterfaces is map of interface names to their respective diffs | ||
type ModifiedInterfaces map[string]jsondiff.Patch | ||
|
||
// Empty indicates whether a change was found in this element | ||
func (modifiedInterfaces ModifiedInterfaces) Empty() bool { | ||
return len(modifiedInterfaces) == 0 | ||
} | ||
|
||
// GetJsonOrigValue returns the original value of the diff, only if there is exactly one diff | ||
func GetJsonOrigValue(patch jsondiff.Patch) (json.RawMessage, bool) { | ||
if len(patch) != 1 { | ||
return nil, false | ||
} | ||
result, ok := patch[0].OldValue.(json.RawMessage) | ||
if !ok { | ||
return nil, false | ||
} | ||
return result, true | ||
} | ||
|
||
// GetJsonOrigValue returns the new value of the diff, only if there is exactly one diff | ||
func GetJsonNewValue(patch jsondiff.Patch) (json.RawMessage, bool) { | ||
if len(patch) != 1 { | ||
return nil, false | ||
} | ||
result, ok := patch[0].Value.(json.RawMessage) | ||
if !ok { | ||
return nil, false | ||
} | ||
return result, true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters