feat(spec): Switch to bufbuild protoc-gen-jsonschema for JSON Schema generation#1205
Conversation
Summary of ChangesHello @muscariello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the JSON Schema generation pipeline by replacing the Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a great improvement, switching the JSON Schema generation from protoc-gen-openapi to the more modern bufbuild/protoc-gen-jsonschema. This results in cleaner and more standards-compliant schemas. The addition of a devcontainer is a welcome change for ensuring a consistent development environment. The script updates are logical and the new proto_to_json_schema.sh script is well-implemented. I've identified a couple of minor issues in documentation and a small opportunity for simplification in one of the new setup scripts. Overall, this is a high-quality contribution that enhances the project's tooling.
.devcontainer/README.md
Outdated
|
|
||
| ### Build Tools | ||
| - **protoc** (v28.3) - Protocol Buffers compiler | ||
| - **protoc-gen-openapi** (gnostic) - OpenAPI v3 generator for protobuf |
There was a problem hiding this comment.
The list of build tools incorrectly mentions protoc-gen-openapi, which is the tool being replaced by this pull request. This should be updated to protoc-gen-jsonschema to accurately reflect the new development environment.
| - **protoc-gen-openapi** (gnostic) - OpenAPI v3 generator for protobuf | |
| - **protoc-gen-jsonschema** (bufbuild) - JSON Schema generator for protobuf |
specification/json/README.md
Outdated
| ``` | ||
|
|
||
| 3. **Go programming language** (for protoc-gen-openapiv2 plugin) | ||
| 3. **Go programming language** (for protoc-gen-openapi plugin) |
There was a problem hiding this comment.
.devcontainer/setup.sh
Outdated
| if [ -f "$HOME/go/bin/protoc-gen-jsonschema" ]; then | ||
| sudo cp "$HOME/go/bin/protoc-gen-jsonschema" /usr/local/bin/ | ||
| elif [ -f "$(go env GOPATH)/bin/protoc-gen-jsonschema" ]; then | ||
| sudo cp "$(go env GOPATH)/bin/protoc-gen-jsonschema" /usr/local/bin/ | ||
| fi |
There was a problem hiding this comment.
The logic to find and copy the protoc-gen-jsonschema binary can be simplified. Instead of checking a hardcoded default path before checking the GOPATH from the environment, it's more robust to rely solely on go env GOPATH, which should be the single source of truth in the devcontainer environment.
| if [ -f "$HOME/go/bin/protoc-gen-jsonschema" ]; then | |
| sudo cp "$HOME/go/bin/protoc-gen-jsonschema" /usr/local/bin/ | |
| elif [ -f "$(go env GOPATH)/bin/protoc-gen-jsonschema" ]; then | |
| sudo cp "$(go env GOPATH)/bin/protoc-gen-jsonschema" /usr/local/bin/ | |
| fi | |
| go_bin_path="$(go env GOPATH)/bin/protoc-gen-jsonschema" | |
| if [ -f "$go_bin_path" ]; then | |
| sudo cp "$go_bin_path" /usr/local/bin/ | |
| fi |
- Replace generate_openapi.sh and extract_json_schema.sh with single proto_to_json_schema.sh - Remove obsolete types/ folder (proto is now the source of truth) - Remove redundant generate-a2a-json GitHub workflow - Update build_docs.sh and build_llms_full.sh to use new unified script - Update specification/json/README.md with new workflow documentation Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
1519bb8 to
82d5cb3
Compare
Use go env GOPATH as single source of truth instead of checking multiple hardcoded paths. Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Add Debian to allowlist and sort alphabetically. Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
2e094f0 to
c2ecf40
Compare
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
docs/spec-json.md
Outdated
There was a problem hiding this comment.
The spec-json and spec-proto pages can be combined into a single page and use tabs similar to how specification.md does now
# A2A Definition/Schema
=== "JSON"
The A2A protocol JSON Schema definition (JSON Schema 2020-12 compliant).
This schema is automatically generated from the protocol buffer definitions and bundled into a single file with all message definitions.
## Download
You can download the schema file directly: [a2a.json](spec-json/a2a.json)
## Schema Definition
```json
--8<-- "spec-json/a2a.json"
```
=== "gRPC"
The normative A2A protocol definition in Protocol Buffers (proto3 syntax).
This is the source of truth for the A2A protocol specification.
## Download
You can download the proto file directly: [a2a.proto](spec-proto/a2a.proto)
## Protocol Definition
```protobuf
--8<-- "spec-proto/a2a.proto"
```
holtskinner
left a comment
There was a problem hiding this comment.
When I tried to run the new build_docs.sh I got errors
$ ./scripts/build_docs.sh
[build_docs] Checking schema freshness...
[build_docs] Regenerating a2a.json from proto
→ Generating JSON Schema from proto...
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=SendMessageConfiguration.json msg_name=SendMessageConfiguration proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=Task.json msg_name=Task proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=TaskStatus.json msg_name=TaskStatus proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=Part.json msg_name=Part proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=FilePart.json msg_name=FilePart proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=DataPart.json msg_name=DataPart proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=Message.json msg_name=Message proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=Artifact.json msg_name=Artifact proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=TaskStatusUpdateEvent.json msg_name=TaskStatusUpdateEvent proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=TaskArtifactUpdateEvent.json msg_name=TaskArtifactUpdateEvent proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=PushNotificationConfig.json msg_name=PushNotificationConfig proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AuthenticationInfo.json msg_name=AuthenticationInfo proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AgentInterface.json msg_name=AgentInterface proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AgentCard.json msg_name=AgentCard proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AgentProvider.json msg_name=AgentProvider proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AgentCapabilities.json msg_name=AgentCapabilities proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AgentExtension.json msg_name=AgentExtension proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AgentSkill.json msg_name=AgentSkill proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AgentCardSignature.json msg_name=AgentCardSignature proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=TaskPushNotificationConfig.json msg_name=TaskPushNotificationConfig proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=StringList.json msg_name=StringList proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=Security.json msg_name=Security proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=SecurityScheme.json msg_name=SecurityScheme proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=APIKeySecurityScheme.json msg_name=APIKeySecurityScheme proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=HTTPAuthSecurityScheme.json msg_name=HTTPAuthSecurityScheme proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=OAuth2SecurityScheme.json msg_name=OAuth2SecurityScheme proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=OpenIdConnectSecurityScheme.json msg_name=OpenIdConnectSecurityScheme proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=MutualTlsSecurityScheme.json msg_name=MutualTlsSecurityScheme proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=OAuthFlows.json msg_name=OAuthFlows proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=AuthorizationCodeOAuthFlow.json msg_name=AuthorizationCodeOAuthFlow proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=ClientCredentialsOAuthFlow.json msg_name=ClientCredentialsOAuthFlow proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=ImplicitOAuthFlow.json msg_name=ImplicitOAuthFlow proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=PasswordOAuthFlow.json msg_name=PasswordOAuthFlow proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=SendMessageRequest.json msg_name=SendMessageRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=GetTaskRequest.json msg_name=GetTaskRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=ListTasksRequest.json msg_name=ListTasksRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=ListTasksResponse.json msg_name=ListTasksResponse proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=CancelTaskRequest.json msg_name=CancelTaskRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=GetTaskPushNotificationConfigRequest.json msg_name=GetTaskPushNotificationConfigRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=DeleteTaskPushNotificationConfigRequest.json msg_name=DeleteTaskPushNotificationConfigRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=SetTaskPushNotificationConfigRequest.json msg_name=SetTaskPushNotificationConfigRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=SubscribeToTaskRequest.json msg_name=SubscribeToTaskRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=ListTaskPushNotificationConfigRequest.json msg_name=ListTaskPushNotificationConfigRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=GetExtendedAgentCardRequest.json msg_name=GetExtendedAgentCardRequest proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=SendMessageResponse.json msg_name=SendMessageResponse proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=StreamResponse.json msg_name=StreamResponse proto_filename=a2a.proto
INFO[0000] Generating JSON-schema for MESSAGE jsonschema_filename=ListTaskPushNotificationConfigResponse.json msg_name=ListTaskPushNotificationConfigResponse proto_filename=a2a.proto
→ Creating JSON Schema bundle...
jq: error: Could not open file /var/folders/31/njc6g6wx60b9w8cyw2kbfp6h00jt0h/T/tmp.IkxOfFxOUM/*.jsonschema.json: No such file or directory
[build_docs] Warning: proto to JSON schema conversion failed
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
|
@holtskinner seems ok. Can you check the script in the devcontainer env ? I am not sure why it fails for you but it must not fail in the clean container. Let me know. Thanks ! |
Summary
Switch from protoc-gen-openapi to bufbuild's protoc-gen-jsonschema plugin for cleaner and more standards-compliant JSON Schema generation.
Changes
Benefits
related to #1160