Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ResolveComponent RPC for resolving a component's data and templated renderer properties #5362

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

begelundmuller
Copy link
Contributor

This PR adds a ResolveComponent RPC which resolves the data (if a data resolver is configured) and the templated renderer properties (if any) for a component for a provided set of arguments.

The RPC replaces the /v1/instances/{instance_id}/components/{name}/data endpoint, which is now marked deprecated.

Proto signature:

service QueryService {
  // ResolveComponent resolves the data and renderer for a Component resource.
  rpc ResolveComponent(ResolveComponentRequest) returns (ResolveComponentResponse) {
    option (google.api.http) = {
      post: "/v1/instances/{instance_id}/queries/components/{component}/resolve",
      body: "*",
    };
  }
}

message ResolveComponentRequest {
  // Instance ID
  string instance_id = 1;
  // Component name
  string component = 2;
  // Optional args to pass to the data resolver and for resolving templating in the renderer properties
  google.protobuf.Struct args = 3;
}

message ResolveComponentResponse {
  // Schema of the resolved component data
  StructType schema = 1;
  // Resolved component data
  repeated google.protobuf.Struct data = 2;
  // Renderer properties with templating resolved for the provided args
  google.protobuf.Struct renderer_properties = 3;
}

runtime/server/components.go Show resolved Hide resolved
@begelundmuller begelundmuller merged commit e90ed4c into main Aug 12, 2024
7 checks passed
@begelundmuller begelundmuller deleted the begelundmuller/resolve-component-rpc branch August 12, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants