-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-schema
More file actions
executable file
·20 lines (19 loc) · 1.45 KB
/
fix-schema
File metadata and controls
executable file
·20 lines (19 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
cp schema.upstream.yaml schema.yaml
# The API actually returns 201 but spec only allows 200.
yq -i '.paths./v2/sandbox/fireWebhooks.post.responses.201 = .paths./v2/sandbox/fireWebhooks.post.responses.200' schema.yaml
# The API seems to return values not included in the enum.
yq -i 'del(.components.schemas.GetChartOfAccountsDataV2.properties.subType.enum)' schema.yaml
# openapi-python-client can't handle multiple content types with the same schema type.
yq -i 'del(.paths./v2/accounting/attachments.post.requestBody.content.application/json)' schema.yaml
# push /data/sync doesn't return most of the required fields (at least on sandbox)
yq -i 'del(.components.schemas.DataSyncResponseV2Dto.required)' schema.yaml
# API actually wants date, not date-time ("postedDate must be formatted as yyyy-mm-dd")
yq -i '.components.schemas.PushBankTransactionV2.properties.postedDate.format = "date"' schema.yaml
# BusinessInfoDataV2.businessType isn't always present and we don't care about the other required field.
yq -i 'del(.components.schemas.BusinessInfoDataV2.required)' schema.yaml
# get /businesses doesn't return all of the required fields
yq -i 'del(.components.schemas.BaseConnectionsResponseDataV2.required)' schema.yaml
yq -i '.components.schemas.BaseConnectionsResponseDataV2.properties.*.nullable = true' schema.yaml
# GetExpenseResponseV2Dto doesn't always include meta
yq -i '.components.schemas.GetExpenseResponseV2Dto.required |= filter(. != "meta")' schema.yaml