Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉 Source Google Workspace Admin: use SAT #6878

Merged
merged 10 commits into from
Oct 31, 2021
Merged
Prev Previous commit
Next Next commit
Upd schemas: replace dynamic fields with object type
  • Loading branch information
gaart committed Oct 19, 2021
commit e16c433fd824e832ba0e688228ee9d92f1452943
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,9 @@
},
"events": {
"type": "array",
"items": [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below the events field has a dynamic structure, that is, this field is returned as an array of objects with different subfields and variable nesting. Is this okay to replace it with an object?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could explain more about "dynamic" schema? Just asking because we are losing a lot of specificity in the data which makes it harder to consume. Are these essentially oneOfs? Was the existing schema incorrect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherifnada The parameters field has a list of objects with variable payload (different objects within the same array at the same point of time), in some cases there are deeply nested structures, and the inner items are different from each other, so the oneOf is not applicable, the anyOf possibly could work

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just worried this will cause breaking changes to the schema. This is a pretty important stream (events are potentially the most important resource in this stream) so like described in UX handbook sections Describe output schemas as completely and reliably as possible and Be very cautious about breaking changes to output schemas, it is probably worth attempting to describe the schema as completely as possible. Do you have any insight into how doable this is? @gaart

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherifnada schema updated, nested fields added

{
"type": "object",
"properties": {
"type": {
"type": "string"
},
"name": {
"type": "string"
},
"parameters": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
},
"intValue": {
"type": "string"
},
"boolValue": {
"type": "string"
}
}
}
]
}
}
}
]
"items": {
"type": "object"
}
},
"time": {
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,126 +20,30 @@
"customerId": {
"type": "string"
}
},
"required": ["time", "uniqQualifier", "applicationName", "customerId"]
}
},
"etag": {
"type": ["string"]
},
"actor": {
"type": "object",
"properties": {
"callerType": {
"type": "string"
},
"email": {
"type": "string"
},
"profileId": {
"type": "string"
},
"key": {
"type": "string"
}
},
"required": ["callerType", "email", "profileId", "key"]
},
"ownerDomain": {
"type": "string"
}
},
"ipAddress": {
"type": "string"
},
"events": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"type": {
"type": "string"
},
"name": {
"type": "string"
},
"parameters": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"boolValue": {
"type": "boolean"
}
},
"required": ["name", "boolValue"]
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"boolValue": {
"type": "boolean"
}
},
"required": ["name", "boolValue"]
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["name", "value"]
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["name", "value"]
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["name", "value"]
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["name", "value"]
}
]
}
},
"required": ["type", "name", "parameters"]
}
]
"items": {
"type": "object"
}
},
"time": {
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
"type": "string"
}
},
"required": ["time", "uniqueQualifier", "applicationName", "customerId"]
"required": [
"time",
"uniqueQualifier",
"applicationName",
"customerId"
]
},
"etag": {
"type": "string"
Expand All @@ -36,73 +41,18 @@
"type": "string"
}
},
"required": ["email", "profileId"]
"required": [
"email"
]
},
"ipAddress": {
"type": "string"
},
"events": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"type": {
"type": "string"
},
"name": {
"type": "string"
},
"parameters": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["name", "value"]
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"multiValue": {
"type": "array",
"items": [
{
"type": "string"
}
]
}
},
"required": ["name", "multiValue"]
},
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"boolValue": {
"type": "boolean"
}
},
"required": ["name", "boolValue"]
}
]
}
},
"required": ["type", "name", "parameters"]
}
]
"items": {
"type": "object"
}
},
"time": {
"type": "string"
Expand Down
Loading