File tree Expand file tree Collapse file tree 2 files changed +33
-32
lines changed
Expand file tree Collapse file tree 2 files changed +33
-32
lines changed Original file line number Diff line number Diff line change @@ -82,31 +82,9 @@ cd spec_repo
8282echo " Checking out the \" $A2A_SPEC_BRANCH \" branch..."
8383git checkout $A2A_SPEC_BRANCH
8484
85- echo " Running datamodel-codegen ..."
85+ echo " Invoking the generate_types.sh script ..."
8686GENERATED_FILE=" $ROOT_DIR /src/a2a/types.py"
87- uv run datamodel-codegen \
88- --input " $TMP_WORK_DIR /spec_repo/specification/json/a2a.json" \
89- --input-file-type jsonschema \
90- --output " $GENERATED_FILE " \
91- --target-python-version 3.10 \
92- --output-model-type pydantic_v2.BaseModel \
93- --disable-timestamp \
94- --use-schema-description \
95- --use-union-operator \
96- --use-field-description \
97- --use-default \
98- --use-default-kwarg \
99- --use-one-literal-as-default \
100- --class-name A2A \
101- --use-standard-collections \
102- --use-subclass-enum \
103- --base-class a2a._base.A2ABaseModel \
104- --field-constraints \
105- --snake-case-field \
106- --no-alias
107-
108- echo " Formatting generated types file with ruff..."
109- uv run ruff format " $GENERATED_FILE "
87+ $ROOT_DIR /scripts/generate_types.sh " $GENERATED_FILE " --input-file " $TMP_WORK_DIR /spec_repo/specification/json/a2a.json"
11088
11189echo " Committing generated types file to the \" $FEATURE_BRANCH \" branch..."
11290cd $ROOT_DIR
Original file line number Diff line number Diff line change 44# Treat unset variables as an error.
55set -euo pipefail
66
7- # Check if an output file path was provided as an argument.
8- if [ -z " $1 " ]; then
9- echo " Error: Output file path must be provided as the first argument." >&2
7+ REMOTE_URL=" https://raw.githubusercontent.com/a2aproject/A2A/refs/heads/main/specification/json/a2a.json"
8+
9+ GENERATED_FILE=" "
10+ INPUT_FILE=" "
11+
12+ # Parse command-line arguments
13+ while [[ $# -gt 0 ]]; do
14+ case " $1 " in
15+ --input-file)
16+ INPUT_FILE=" $2 "
17+ shift 2
18+ ;;
19+ * )
20+ GENERATED_FILE=" $1 "
21+ shift 1
22+ ;;
23+ esac
24+ done
25+
26+ if [ -z " $GENERATED_FILE " ]; then
27+ echo " Error: Output file path must be provided." >&2
28+ echo " Usage: $0 [--input-file <path>] <output-file-path>"
1029 exit 1
1130fi
1231
13- REMOTE_URL=" https://raw.githubusercontent.com/a2aproject/A2A/refs/heads/main/specification/json/a2a.json"
14- GENERATED_FILE=" $1 "
15-
1632echo " Running datamodel-codegen..."
17- echo " - Source URL: $REMOTE_URL "
33+ declare -a source_args
34+ if [ -n " $INPUT_FILE " ]; then
35+ echo " - Source File: $INPUT_FILE "
36+ source_args=(" --input" " $INPUT_FILE " )
37+ else
38+ echo " - Source URL: $REMOTE_URL "
39+ source_args=(" --url" " $REMOTE_URL " )
40+ fi
1841echo " - Output File: $GENERATED_FILE "
1942
2043uv run datamodel-codegen \
21- --url " $REMOTE_URL " \
44+ " ${source_args[@]} " \
2245 --input-file-type jsonschema \
2346 --output " $GENERATED_FILE " \
2447 --target-python-version 3.10 \
You can’t perform that action at this time.
0 commit comments