Skip to content

Commit 6458f86

Browse files
committed
update
1 parent 10f8e53 commit 6458f86

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

schema_entry/entrypoint.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ def with_schema(self, schemaObj: Union[str, dict, PydanticModelLike]) -> Union[s
179179
schemaObjSchemaType = cast(SchemaType, schemaObj)
180180
self.schema = schemaObjSchemaType
181181
else:
182-
schema = cast(SchemaType, schemaObj.model_json_schema())
183-
self.schema = pydantic_schema_to_protocol(schema)
182+
schema = schemaObj.model_json_schema()
183+
self.schema = cast(SchemaType, pydantic_schema_to_protocol(schema))
184184
self._name = schemaObj.__name__.lower()
185185
self.__doc__ = schemaObj.__doc__
186186
return schemaObj
@@ -215,7 +215,8 @@ def __call__(self, argv: Sequence[str]) -> Optional[Any]:
215215
description=self.__doc__,
216216
usage=self.usage,
217217
formatter_class=argparse.RawDescriptionHelpFormatter)
218-
return self.pass_args_to_sub(parser, argv)
218+
self.pass_args_to_sub(parser, argv)
219+
219220
else:
220221
parser = argparse.ArgumentParser(
221222
prog=self.prog,

schema_entry/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def parse_schema_as_cmd(key: str, schema: PropertyType, parser: argparse.Argumen
220220

221221
def _remove_sigal_allOf(x: Dict[str, Any]) -> Dict[str, Any]:
222222
info: Dict[str, Any] = {}
223-
if x.get("allOf"):
223+
if x.get("allOf") and isinstance(x['allOf'], list) :
224224
if len(x["allOf"]) == 1:
225225
info.update(**x["allOf"][0])
226226
del x["allOf"]
@@ -233,7 +233,7 @@ def _remove_sigal_allOf(x: Dict[str, Any]) -> Dict[str, Any]:
233233

234234

235235
def remove_sigal_allOf(d: Dict[str, Any]) -> Dict[str, Any]:
236-
if d.get('properties'):
236+
if d.get('properties') and isinstance(d['properties'], dict):
237237
for key, value in d.get('properties').items():
238238
info = _remove_sigal_allOf(value)
239239
d['properties'][key] = info
@@ -252,9 +252,7 @@ def remove_defs_interference(d: Dict[str, Any]) -> Dict[str, Any]:
252252

253253
def replace_refs(d: Dict[str, Any]) -> Dict[str, Any]:
254254
info = jsonref.replace_refs(d)
255-
print(info)
256255
if info.get("$defs"):
257-
print("remove $defs")
258256
del info["$defs"]
259257
return info
260258

0 commit comments

Comments
 (0)