mirror of
https://github.com/thegeneralist01/twitter-openapi
synced 2026-01-11 15:40:26 +01:00
update hook and test
Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
parent
c4dbc8e82d
commit
fc5f4c5ae7
2 changed files with 45 additions and 8 deletions
|
|
@ -118,6 +118,20 @@ class SchemasCheck(SchemasHookBase):
|
|||
return value
|
||||
|
||||
|
||||
class RequiredCheck(SchemasHookBase):
|
||||
def hook(self, value: dict):
|
||||
required = value.get("required", [])
|
||||
|
||||
for key, property in value.get("properties", {}).items():
|
||||
if key in required and property.get("default") is not None:
|
||||
print(f"{key} is required and has default value")
|
||||
d = property.get("default") is None and property.get("nullable", False)
|
||||
if property not in required and d:
|
||||
print(f"{key} is not required and has no default value")
|
||||
|
||||
return value
|
||||
|
||||
|
||||
# RequestHookBase extends
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue