This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempting to support proto OneOf (#58)
* Attempting to support proto OneOf * Fixing a broken test affected by this PR Co-authored-by: Chrusty <Chris@H>
- Loading branch information
Showing
10 changed files
with
214 additions
and
6 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
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 testdata | ||
|
||
const OneOf = `{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"properties": { | ||
"bar": { | ||
"properties": { | ||
"foo": { | ||
"type": "integer" | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"type": "object" | ||
}, | ||
"baz": { | ||
"properties": { | ||
"foo": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"type": "object" | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"bar" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"baz" | ||
] | ||
} | ||
] | ||
}` |
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,17 @@ | ||
syntax="proto3"; | ||
package samples; | ||
|
||
message OneOf { | ||
oneof choice { | ||
Bar bar = 1; | ||
Baz baz = 2; | ||
} | ||
|
||
message Bar { | ||
int32 foo = 1; | ||
} | ||
|
||
message Baz { | ||
string foo = 1; | ||
} | ||
} |
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,37 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"properties": { | ||
"bar": { | ||
"properties": { | ||
"foo": { | ||
"type": "integer" | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"type": "object" | ||
}, | ||
"baz": { | ||
"properties": { | ||
"foo": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"type": "object" | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"required": [ | ||
"bar" | ||
] | ||
}, | ||
{ | ||
"required": [ | ||
"baz" | ||
] | ||
} | ||
] | ||
} |