Skip to content

Commit 3f5722a

Browse files
authored
bugfix/fix model generation on empty schemas (#17)
1 parent fdfd034 commit 3f5722a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 0.0.1
2+
3+
### Enhancements
4+
5+
### Features
6+
7+
### Fixes
8+
9+
* **Model generation when schema is empty fixed** Key error was being thrown when properties not in schema, but this doesn't exist when schema is null. Null check added.
10+
111
## 0.0.0
212

313
### Enhancements
@@ -6,4 +16,4 @@
616

717
* **Initial Release** First release of the project with all existing implementations in place.
818

9-
### Fixes
19+
### Fixes
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.0" # pragma: no cover
1+
__version__ = "0.0.1" # pragma: no cover

unstructured_platform_plugins/schema/json_schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ def schema_to_base_model_type(json_type_name, name: str, type_info: dict) -> Typ
305305

306306
def schema_to_base_model(schema: dict, name: str = "reconstructed_model") -> Type[BaseModel]:
307307
inputs = {}
308+
if schema["type"] == "null":
309+
return create_model(name)
308310
properties = schema["properties"]
309311

310312
for k, v in properties.items():

0 commit comments

Comments
 (0)