Skip to content

Commit

Permalink
chore: Remove exclusionary logic from schema generation (#5641)
Browse files Browse the repository at this point in the history
Co-authored-by: Leonardo Gama <[email protected]>
  • Loading branch information
Leo10Gama and Leonardo Gama authored Jul 28, 2023
1 parent a3429e3 commit 354e4ae
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions schema/make_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,31 +78,9 @@ class SamCliCommandSchema:

def to_schema(self) -> dict:
"""Return the JSON schema representation of the SAM CLI command."""
COMMANDS_TO_EXCLUDE = [ # TEMPORARY: for use only while generating piece-by-piece
"deploy",
"build",
"local",
"validate",
"package",
"init",
"delete",
"bootstrap",
"list",
"traces",
"sync",
"publish",
"pipeline",
"logs",
"remote",
]
split_cmd_name = self.name.split("_")
formatted_cmd_name = " ".join(split_cmd_name)
exclude_params = split_cmd_name[0] in COMMANDS_TO_EXCLUDE
formatted_params_list = (
"* " + "\n* ".join([f"{param.name}:\n{param.description}" for param in self.parameters])
if not exclude_params
else ""
)
formatted_params_list = "* " + "\n* ".join([f"{param.name}:\n{param.description}" for param in self.parameters])
params_description = f"Available parameters for the {formatted_cmd_name} command:\n{formatted_params_list}"

return {
Expand All @@ -114,9 +92,7 @@ def to_schema(self) -> dict:
"title": f"Parameters for the {formatted_cmd_name} command",
"description": params_description,
"type": "object",
"properties": {param.name: param.to_schema() for param in self.parameters}
if not exclude_params
else {},
"properties": {param.name: param.to_schema() for param in self.parameters},
},
},
"required": ["parameters"],
Expand Down

0 comments on commit 354e4ae

Please sign in to comment.