From 7b175736b3672ade6fea46cae4d8b32d202a000c Mon Sep 17 00:00:00 2001 From: Ben Weintraub Date: Sun, 27 Oct 2024 10:49:40 -0700 Subject: [PATCH] fix: allow required fields list to be specified as empty (#651) The Pydantic model for OpenAPI schemas in this tool was more stringent about the required key than the OpenAPI / JSON Schema specs themselves, requiring a min_length of 1, when neither of those schemas actually do. This change just removes the min_length constraint on the required field, so that 'required: []' is allowed in inputs to this tool. --- openapi_python_client/schema/openapi_schema_pydantic/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi_python_client/schema/openapi_schema_pydantic/schema.py b/openapi_python_client/schema/openapi_schema_pydantic/schema.py index a3e4cb522..d42ccc6ad 100644 --- a/openapi_python_client/schema/openapi_schema_pydantic/schema.py +++ b/openapi_python_client/schema/openapi_schema_pydantic/schema.py @@ -34,7 +34,7 @@ class Schema(BaseModel): uniqueItems: Optional[bool] = None maxProperties: Optional[int] = Field(default=None, ge=0) minProperties: Optional[int] = Field(default=None, ge=0) - required: Optional[List[str]] = Field(default=None, min_length=1) + required: Optional[List[str]] = Field(default=None) enum: Union[None, List[Any]] = Field(default=None, min_length=1) const: Union[None, StrictStr, StrictInt, StrictFloat, StrictBool] = None type: Union[DataType, List[DataType], None] = Field(default=None)