Skip to content

Commit

Permalink
Add support for protobuf oneOf
Browse files Browse the repository at this point in the history
  • Loading branch information
sudorandom committed Aug 22, 2024
1 parent e5a7f7d commit 410c6b2
Show file tree
Hide file tree
Showing 16 changed files with 6,555 additions and 27 deletions.
Binary file modified internal/converter/fixtures/fileset.binpb
Binary file not shown.
400 changes: 400 additions & 0 deletions internal/converter/fixtures/output/envoy.openapi.json

Large diffs are not rendered by default.

154 changes: 154 additions & 0 deletions internal/converter/fixtures/output/envoy.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,37 @@ components:
The JSON representation for `NullValue` is JSON `null`.
envoy.config.core.v3.Address:
type: object
allOf:
- anyOf:
- required:
- envoyInternalAddress
- required:
- pipe
- required:
- socketAddress
- not:
anyOf:
- required:
- envoyInternalAddress
- required:
- pipe
- required:
- socketAddress
anyOf:
- required:
- envoyInternalAddress
- required:
- pipe
- required:
- socketAddress
- not:
anyOf:
- required:
- envoyInternalAddress
- required:
- pipe
- required:
- socketAddress
properties:
socketAddress:
$ref: '#/components/schemas/envoy.config.core.v3.SocketAddress'
Expand Down Expand Up @@ -156,6 +187,21 @@ components:
description: Identifies a specific ControlPlane instance that Envoy is connected to.
envoy.config.core.v3.EnvoyInternalAddress:
type: object
allOf:
- anyOf:
- required:
- serverListenerName
- not:
anyOf:
- required:
- serverListenerName
anyOf:
- required:
- serverListenerName
- not:
anyOf:
- required:
- serverListenerName
properties:
serverListenerName:
type: string
Expand Down Expand Up @@ -332,6 +378,29 @@ components:
additionalProperties: false
envoy.config.core.v3.Node:
type: object
allOf:
- anyOf:
- required:
- userAgentBuildVersion
- required:
- userAgentVersion
- not:
anyOf:
- required:
- userAgentBuildVersion
- required:
- userAgentVersion
anyOf:
- required:
- userAgentBuildVersion
- required:
- userAgentVersion
- not:
anyOf:
- required:
- userAgentBuildVersion
- required:
- userAgentVersion
properties:
id:
type: string
Expand Down Expand Up @@ -451,6 +520,29 @@ components:
additionalProperties: false
envoy.config.core.v3.SocketAddress:
type: object
allOf:
- anyOf:
- required:
- namedPort
- required:
- portValue
- not:
anyOf:
- required:
- namedPort
- required:
- portValue
anyOf:
- required:
- namedPort
- required:
- portValue
- not:
anyOf:
- required:
- namedPort
- required:
- portValue
properties:
protocol:
$ref: '#/components/schemas/envoy.config.core.v3.SocketAddress.Protocol'
Expand Down Expand Up @@ -800,6 +892,45 @@ components:
description: '[#next-free-field: 7]'
envoy.service.discovery.v3.DynamicParameterConstraints:
type: object
allOf:
- anyOf:
- required:
- andConstraints
- required:
- constraint
- required:
- notConstraints
- required:
- orConstraints
- not:
anyOf:
- required:
- andConstraints
- required:
- constraint
- required:
- notConstraints
- required:
- orConstraints
anyOf:
- required:
- andConstraints
- required:
- constraint
- required:
- notConstraints
- required:
- orConstraints
- not:
anyOf:
- required:
- andConstraints
- required:
- constraint
- required:
- notConstraints
- required:
- orConstraints
properties:
constraint:
$ref: '#/components/schemas/envoy.service.discovery.v3.DynamicParameterConstraints.SingleConstraint'
Expand Down Expand Up @@ -829,6 +960,29 @@ components:
additionalProperties: false
envoy.service.discovery.v3.DynamicParameterConstraints.SingleConstraint:
type: object
allOf:
- anyOf:
- required:
- exists
- required:
- value
- not:
anyOf:
- required:
- exists
- required:
- value
anyOf:
- required:
- exists
- required:
- value
- not:
anyOf:
- required:
- exists
- required:
- value
properties:
key:
type: string
Expand Down
40 changes: 40 additions & 0 deletions internal/converter/fixtures/output/flex.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,46 @@
"schemas": {
"flex.ComplexType": {
"type": "object",
"allOf": [
{
"anyOf": [
{
"required": [
"optionalMsgField"
]
},
{
"not": {
"anyOf": [
{
"required": [
"optionalMsgField"
]
}
]
}
}
]
}
],
"anyOf": [
{
"required": [
"optionalMsgField"
]
},
{
"not": {
"anyOf": [
{
"required": [
"optionalMsgField"
]
}
]
}
}
],
"properties": {
"doubleField": {
"oneOf": [
Expand Down
15 changes: 15 additions & 0 deletions internal/converter/fixtures/output/flex.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ components:
schemas:
flex.ComplexType:
type: object
allOf:
- anyOf:
- required:
- optionalMsgField
- not:
anyOf:
- required:
- optionalMsgField
anyOf:
- required:
- optionalMsgField
- not:
anyOf:
- required:
- optionalMsgField
properties:
doubleField:
oneOf:
Expand Down
Loading

0 comments on commit 410c6b2

Please sign in to comment.