cloudapi: reduce minsize type to just string
The type of the minsize parameter in the new disk customization was
meant to support both integers (size in bytes) and strings (size with
unit). However, the schema wasn't done properly, which made any input
result in an error:
GenericError: Failed to create the compose request:
{"code":"IMAGE-BUILDER-COMPOSER-30","details":"request body has an
error: doesn't match schema #/components/schemas/ComposeRequest:
Error at \"/customizations/disk/partitions/0\": doesn't match schema
due to: Error at \"/minsize\": input matches more than one oneOf
schemas
Reducing it to just support strings simplifies the schema. It's also
not an important feature reduction since sizes as integers (for
filesystems that are typically in GiB) aren't very convenient.
This commit is contained in:
parent
84dfe7e21b
commit
045364cbf2
4 changed files with 247 additions and 349 deletions
|
|
@ -1429,13 +1429,5 @@ func decodeMinsize(size *Minsize) (uint64, error) {
|
|||
return 0, nil
|
||||
}
|
||||
|
||||
if sizeStr, err := size.AsMinsize1(); err == nil {
|
||||
return datasizes.Parse(sizeStr)
|
||||
}
|
||||
|
||||
if sizeUint, err := size.AsMinsize0(); err == nil {
|
||||
return sizeUint, err
|
||||
}
|
||||
|
||||
return 0, fmt.Errorf("failed to convert value \"%v\" to number", size)
|
||||
return datasizes.Parse(*size)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue