cloudapi: make UploadOptions anyOf
oneOf means that the body is valid against exactly ONE schema. There's an issue with AWS EC2 upload options though: It requires region and share_with_accounts fields. Such a request is also valid AWS S3 upload though (this one only require region). This means that AWS EC2 upload options will be always valid against two schemas which violates the oneOf rule. Let's switch to anyOf and explain this in the openAPI spec. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
a8a1bb4270
commit
00d602efc3
2 changed files with 124 additions and 106 deletions
|
|
@ -686,11 +686,17 @@ components:
|
|||
Naming package sets for a repository assigns it to a specific part
|
||||
(pipeline) of the build process.
|
||||
UploadOptions:
|
||||
oneOf:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/AWSEC2UploadOptions'
|
||||
- $ref: '#/components/schemas/AWSS3UploadOptions'
|
||||
- $ref: '#/components/schemas/GCPUploadOptions'
|
||||
- $ref: '#/components/schemas/AzureUploadOptions'
|
||||
description: |
|
||||
This should really be oneOf but AWSS3UploadOptions is a subset of
|
||||
AWSEC2UploadOptions. This means that all AWSEC2UploadOptions objects
|
||||
are also valid AWSS3UploadOptionas objects which violates the oneOf
|
||||
rules. Therefore, we have to use anyOf here but be aware that it isn't
|
||||
possible to mix and match more schemas together.
|
||||
AWSEC2UploadOptions:
|
||||
type: object
|
||||
required:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue