Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: schema auto generated documentation and json schema #2251

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,10 @@ def items(self, schema: dict, indentation: int, var_path: list, table: str):

def required(self, schema: dict, var_name: str, parent_schema: dict):
output = None
if schema.get("required"):
if parent_schema and parent_schema.get("primary_key") == var_name:
output = "Required, Unique"
elif schema.get("required"):
output = "Required"
if parent_schema and parent_schema.get("primary_key") == var_name:
output = "Required, Unique"
return output

def default(self, schema: dict):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,13 @@ def convert_default(self, default, parent_schema: dict) -> dict:
return {"default": default}

def convert_items(self, items: dict, parent_schema: dict) -> dict:
output = {"items": {}}
output["items"] = self.convert_schema(items)
if (primary_key := parent_schema.get("primary_key")) and output["items"]["type"] == "dict":
output["items"]["keys"][primary_key]["required"] = True
output = {
"items": self.convert_schema(items),
carlbuchmann marked this conversation as resolved.
Show resolved Hide resolved
}
if (primary_key := parent_schema.get("primary_key")) and items.get("type") == "dict":
output["items"].setdefault("required", [])
if primary_key not in output["items"]["required"]:
output["items"]["required"].append(primary_key)
return output

def convert_display_name(self, display_name: str, parent_schema: dict) -> dict:
Expand Down
Loading