-
Notifications
You must be signed in to change notification settings - Fork 428
Expand file tree
/
Copy pathgenerate_types.sh
More file actions
executable file
·44 lines (37 loc) · 1.19 KB
/
generate_types.sh
File metadata and controls
executable file
·44 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
# Treat unset variables as an error.
set -euo pipefail
# Check if an output file path was provided as an argument.
if [ -z "$1" ]; then
echo "Error: Output file path must be provided as the first argument." >&2
exit 1
fi
REMOTE_URL="https://raw.githubusercontent.com/a2aproject/A2A/refs/heads/main/specification/json/a2a.json"
GENERATED_FILE="$1"
echo "Running datamodel-codegen..."
echo " - Source URL: $REMOTE_URL"
echo " - Output File: $GENERATED_FILE"
uv run datamodel-codegen \
--url "$REMOTE_URL" \
--input-file-type jsonschema \
--output "$GENERATED_FILE" \
--target-python-version 3.10 \
--output-model-type pydantic_v2.BaseModel \
--disable-timestamp \
--use-schema-description \
--use-union-operator \
--use-field-description \
--use-default \
--use-default-kwarg \
--use-one-literal-as-default \
--class-name A2A \
--use-standard-collections \
--use-subclass-enum \
--base-class a2a._base.A2ABaseModel \
--field-constraints \
--snake-case-field \
--no-alias
echo "Formatting generated file with ruff..."
uv run ruff format "$GENERATED_FILE"
echo "Codegen finished successfully."