Skip to content

[Feat]: Add min_items = 1 constraint to Artifact in protobuf schema #1456

@punkyoon

Description

@punkyoon

Is your feature request related to a problem? Please describe.

The A2A Protocol Specification (Section 4.1.7) states that an Artifact's parts array "Must contain at least one part."

However, this constraint is not reflected in the protobuf schema definition at specification/a2a.proto.

Describe the solution you'd like

Current Schema

specification/a2a.proto

message Artifact {
  // Unique identifier (e.g. UUID) for the artifact. It must be at least unique
  // within a task.
  string artifact_id = 1 [(google.api.field_behavior) = REQUIRED];
  // A human readable name for the artifact.
  string name = 3;
  // A human readable description of the artifact, optional.
  string description = 4;
  // The content of the artifact. Must contain at least one part.
  repeated Part parts = 5 [(google.api.field_behavior) = REQUIRED];
  // Optional metadata included with the artifact.
  google.protobuf.Struct metadata = 6;
  // The URIs of extensions that are present or contributed to this Artifact.
  repeated string extensions = 7;
}

specification/buf.yaml

version: v2
deps:
  # Common Protobuf types.
  - buf.build/googleapis/googleapis

Proposed Change

specification/a2a.proto

+ import "buf/validate/validate.proto"; 

message Artifact {
  // Unique identifier (e.g. UUID) for the artifact. It must be at least unique
  // within a task.
  string artifact_id = 1 [(google.api.field_behavior) = REQUIRED];
  // A human readable name for the artifact.
  string name = 3;
  // A human readable description of the artifact, optional.
  string description = 4;
  // The content of the artifact. Must contain at least one part.
- repeated Part parts = 5 [(google.api.field_behavior) = REQUIRED];
+ repeated Part parts = 5 [
+   (google.api.field_behavior) = REQUIRED,
+   (buf.validate.field).repeated.min_items = 1
+ ];
  // Optional metadata included with the artifact.
  google.protobuf.Struct metadata = 6;
  // The URIs of extensions that are present or contributed to this Artifact.
  repeated string extensions = 7;
}

specification/buf.yaml

version: v2
deps:
  # Common Protobuf types.
  - buf.build/googleapis/googleapis
+ - buf.build/bufbuild/protovalidate

Why This Matters

SDKs that generate models from predefined schema in A2A repository (e.g., https://github.com/a2aproject/a2a-python using datamodel-codegen) do not automatically enforce the non-empty constraint because the schema lacks min_items. This means invalid Artifact objects with empty parts can be created without any validation error.

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions