Skip to content

Commit 7b17573

Browse files
committed
fix: allow required fields list to be specified as empty (openapi-generators#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.
1 parent a0b1bb7 commit 7b17573

File tree

1 file changed

+1
-1
lines changed
  • openapi_python_client/schema/openapi_schema_pydantic

1 file changed

+1
-1
lines changed

Diff for: openapi_python_client/schema/openapi_schema_pydantic/schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Schema(BaseModel):
3434
uniqueItems: Optional[bool] = None
3535
maxProperties: Optional[int] = Field(default=None, ge=0)
3636
minProperties: Optional[int] = Field(default=None, ge=0)
37-
required: Optional[List[str]] = Field(default=None, min_length=1)
37+
required: Optional[List[str]] = Field(default=None)
3838
enum: Union[None, List[Any]] = Field(default=None, min_length=1)
3939
const: Union[None, StrictStr, StrictInt, StrictFloat, StrictBool] = None
4040
type: Union[DataType, List[DataType], None] = Field(default=None)

0 commit comments

Comments
 (0)