Skip to content

Commit 1e19ebc

Browse files
committed
chore: consolidate schema generation
1 parent 0968335 commit 1e19ebc

2 files changed

Lines changed: 19 additions & 25 deletions

File tree

schema/make_schema.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import click
1010

1111
from samcli.cli.command import _SAM_CLI_COMMAND_PACKAGES
12-
from samcli.cli.lazy_group import LazyGroup
1312
from samcli.lib.config.samconfig import SamConfig
1413
from schema.exceptions import SchemaGenerationException
1514

@@ -199,15 +198,10 @@ def create_command_schema(module, subcommand):
199198
command = []
200199

201200
if isinstance(module.cli, click.core.Group): # command has subcommands (e.g. local invoke)
202-
# For LazyGroup, load lazy commands first (preserving definition order)
203-
if isinstance(module.cli, LazyGroup) and module.cli.lazy_subcommands:
204-
for subcommand_name in module.cli.lazy_subcommands.keys():
205-
subcommand = module.cli.get_command(None, subcommand_name)
206-
if subcommand:
207-
command.append(create_command_schema(module, subcommand))
208-
else:
209-
# For regular Groups, use commands dict
210-
for subcommand in module.cli.commands.values():
201+
ctx = click.Context(module.cli)
202+
for subcommand_name in module.cli.list_commands(ctx):
203+
subcommand = module.cli.get_command(ctx, subcommand_name)
204+
if subcommand:
211205
command.append(create_command_schema(module, subcommand))
212206
else:
213207
cmd_name = SamConfig.to_key([module.__name__.split(".")[-1]])

schema/samcli.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,21 @@
408408
"parameters"
409409
]
410410
},
411+
"local_generate_event": {
412+
"title": "Local Generate Event command",
413+
"description": "Generate events for Lambda functions.",
414+
"properties": {
415+
"parameters": {
416+
"title": "Parameters for the local generate event command",
417+
"description": "Available parameters for the local generate event command:\n* ",
418+
"type": "object",
419+
"properties": {}
420+
}
421+
},
422+
"required": [
423+
"parameters"
424+
]
425+
},
411426
"local_invoke": {
412427
"title": "Local Invoke command",
413428
"description": "Invoke AWS serverless functions locally.",
@@ -1024,21 +1039,6 @@
10241039
"parameters"
10251040
]
10261041
},
1027-
"local_generate_event": {
1028-
"title": "Local Generate Event command",
1029-
"description": "Generate events for Lambda functions.",
1030-
"properties": {
1031-
"parameters": {
1032-
"title": "Parameters for the local generate event command",
1033-
"description": "Available parameters for the local generate event command:\n* ",
1034-
"type": "object",
1035-
"properties": {}
1036-
}
1037-
},
1038-
"required": [
1039-
"parameters"
1040-
]
1041-
},
10421042
"package": {
10431043
"title": "Package command",
10441044
"description": "Package an AWS SAM application.",

0 commit comments

Comments
 (0)