Merge "Default to u32 when maximum is unset"

This commit is contained in:
Zuul
2025-09-11 11:01:36 +00:00
committed by Gerrit Code Review
2 changed files with 45 additions and 16 deletions

View File

@@ -89,11 +89,19 @@ class Integer(BasePrimitiveType):
def type_hint(self): def type_hint(self):
if self.minimum is not None: if self.minimum is not None:
if self.minimum == 0: if self.minimum == 0:
if not self.maximum or self.format == "u32": if self.format in ["u64", "uint64"]:
# Do not default at u64 (for now), unless explicitly
# requested.
return "u64"
elif (
not self.maximum
or self.maximum == 4294967295
or self.format in ["u32", "uint32"]
):
return "u32" return "u32"
elif self.maximum == 65535 or self.format == "u16": elif self.maximum == 65535 or self.format in ["u16", "uint16"]:
return "u16" return "u16"
elif self.maximum == 255 or self.format == "u8": elif self.maximum == 255 or self.format == ["u8", "uint8"]:
return "u8" return "u8"
elif self.minimum == -128 and self.maximum == 127: elif self.minimum == -128 and self.maximum == 127:
return "i8" return "i8"

View File

@@ -695,40 +695,48 @@ components:
The total number of bytes that are stored in Object Storage for the account. The total number of bytes that are stored in Object Storage for the account.
schema: schema:
type: integer type: integer
format: int64 format: uint64
minimum: 0
X-Account-Container-Count: X-Account-Container-Count:
description: The number of containers. description: The number of containers.
schema: schema:
type: integer type: integer
format: int64 format: uint64
minimum: 0
X-Account-Object-Count: X-Account-Object-Count:
description: The number of objects in the account. description: The number of objects in the account.
schema: schema:
type: integer type: integer
format: int64 format: uint64
minimum: 0
X-Account-Storage-Policy-Bytes-Used: X-Account-Storage-Policy-Bytes-Used:
description: | description: |
The total number of bytes that are stored in in a given storage policy, where name is the name of the storage policy. The total number of bytes that are stored in in a given storage policy, where name is the name of the storage policy.
schema: schema:
type: integer type: integer
format: uint64
minimum: 0
X-Account-Storage-Policy-Container-Count: X-Account-Storage-Policy-Container-Count:
description: | description: |
The number of containers in the account that use the given storage policy where name is the name of the storage policy. The number of containers in the account that use the given storage policy where name is the name of the storage policy.
schema: schema:
type: integer type: integer
format: int64 format: uint64
minimum: 0
X-Account-Storage-Policy-Object-Count: X-Account-Storage-Policy-Object-Count:
description: | description: |
The number of objects in given storage policy where name is the name of the storage policy. The number of objects in given storage policy where name is the name of the storage policy.
schema: schema:
type: integer type: integer
format: int64 format: int64
minimum: 0
X-Account-Meta-Quota-Bytes: X-Account-Meta-Quota-Bytes:
description: | description: |
If present, this is the limit on the total size in bytes of objects stored in the account. Typically this value is set by an administrator. If present, this is the limit on the total size in bytes of objects stored in the account. Typically this value is set by an administrator.
schema: schema:
type: string type: integer
format: int64 format: int64
minimum: 0
X-Account-Access-Control: X-Account-Access-Control:
description: | description: |
Note: X-Account-Access-Control is not supported by Keystone auth. Note: X-Account-Access-Control is not supported by Keystone auth.
@@ -749,11 +757,13 @@ components:
schema: schema:
type: integer type: integer
format: int64 format: int64
minimum: 0
X-Container-Object-Count: X-Container-Object-Count:
description: The number of objects. description: The number of objects.
schema: schema:
type: integer type: integer
format: int64 format: int64
minimum: 0
acceptRanges: acceptRanges:
description: The type of ranges that the object accepts. description: The type of ranges that the object accepts.
schema: schema:
@@ -772,12 +782,16 @@ components:
description: | description: |
The maximum object count of the container. If not set, this header is not returned by this operation. The maximum object count of the container. If not set, this header is not returned by this operation.
schema: schema:
type: string type: integer
format: uint64
minimum: 0
X-Container-Meta-Quota-Bytes: X-Container-Meta-Quota-Bytes:
description: | description: |
The maximum size of the container, in bytes. If not set, this header is not returned by this operation. The maximum size of the container, in bytes. If not set, this header is not returned by this operation.
schema: schema:
type: string type: integer
format: uint64
minimum: 0
X-Storage-Policy: X-Storage-Policy:
description: | description: |
In requests, specifies the name of the storage policy to use for the container. In responses, is the storage policy name. The storage policy of the container cannot be changed. In requests, specifies the name of the storage policy to use for the container. In responses, is the storage policy name. The storage policy of the container cannot be changed.
@@ -1054,7 +1068,8 @@ components:
description: | description: |
Maximum time for the origin to hold the preflight results. A browser may make an OPTIONS call to verify the origin is allowed to make the request. Set the value to an integer number of seconds after the time that the request was received. Maximum time for the origin to hold the preflight results. A browser may make an OPTIONS call to verify the origin is allowed to make the request. Set the value to an integer number of seconds after the time that the request was received.
schema: schema:
type: string type: integer
format: uint64
X-Container-Meta-Access-Control-Expose-Headers: X-Container-Meta-Access-Control-Expose-Headers:
in: header in: header
name: X-Container-Meta-Access-Control-Expose-Headers name: X-Container-Meta-Access-Control-Expose-Headers
@@ -1076,14 +1091,18 @@ components:
description: | description: |
Sets maximum size of the container, in bytes. Typically these values are set by an administrator. Returns a 413 response (request entity too large) when an object PUT operation exceeds this quota value. This value does not take effect immediately. see Container Quotas for more information. Sets maximum size of the container, in bytes. Typically these values are set by an administrator. Returns a 413 response (request entity too large) when an object PUT operation exceeds this quota value. This value does not take effect immediately. see Container Quotas for more information.
schema: schema:
type: string type: integer
format: uint64
minimum: 0
X-Container-Meta-Quota-Count: X-Container-Meta-Quota-Count:
in: header in: header
name: X-Container-Meta-Quota-Count name: X-Container-Meta-Quota-Count
description: | description: |
Sets maximum object count of the container. Typically these values are set by an administrator. Returns a 413 response (request entity too large) when an object PUT operation exceeds this quota value. This value does not take effect immediately. see Container Quotas for more information. Sets maximum object count of the container. Typically these values are set by an administrator. Returns a 413 response (request entity too large) when an object PUT operation exceeds this quota value. This value does not take effect immediately. see Container Quotas for more information.
schema: schema:
type: string type: integer
format: uint64
minimum: 0
X-Container-Meta-Temp-Url-Key: X-Container-Meta-Temp-Url-Key:
in: header in: header
name: X-Container-Meta-Temp-URL-Key name: X-Container-Meta-Temp-URL-Key
@@ -1123,6 +1142,8 @@ components:
description: For an integer value n, limits the number of results to n. description: For an integer value n, limits the number of results to n.
schema: schema:
type: integer type: integer
format: uint32
minimum: 0
marker: marker:
in: query in: query
name: marker name: marker
@@ -1354,13 +1375,13 @@ components:
count: count:
description: The number of objects in the container. description: The number of objects in the container.
type: integer type: integer
format: int64 format: uint64
minimum: 0 minimum: 0
bytes: bytes:
description: | description: |
The total number of bytes that are stored in Object Storage for the account. The total number of bytes that are stored in Object Storage for the account.
type: integer type: integer
format: int64 format: uint64
minimum: 0 minimum: 0
name: name:
description: The name of the container. description: The name of the container.
@@ -1386,7 +1407,7 @@ components:
description: | description: |
The total number of bytes that are stored in Object Storage for the container. The total number of bytes that are stored in Object Storage for the container.
type: integer type: integer
format: int64 format: uint64
minimum: 0 minimum: 0
hash: hash:
description: The MD5 checksum value of the object content. description: The MD5 checksum value of the object content.