From 6349f38bd41516d9a8fbd04c02664cbd338e6a98 Mon Sep 17 00:00:00 2001 From: Maik Groten Date: Wed, 11 Nov 2026 17:20:42 +0100 Subject: [PATCH 1/2] feat(request-router): let a plugin leave connection settings to the requester or approver A request router plugin reads every setting of a request from the connection config an admin saved, or a routing rule's. A host had no way to know that one of those settings, such as a quality profile or a root folder, could instead be chosen per request, so the choice could only be made by the admin in advance. RequestRouterDescriptor.requester_options lists the config fields that may be chosen per request. Each names a select with dynamic_options, an optional media type and label, and a chooser_field: a select in the same form in which an admin says per server who chooses (admin, requester or approver). The host offers the values ListConfigOptions returns, checks the pick against them and passes it as that key of RouterConnection.config, so the plugin's RPCs do not change. Manifest validation checks the declaration against the admin form. Hosts that predate the field drop it and never offer the choice. AI disclosure: written with Claude Fable 5.2 in Claude Code. go test ./... and go vet pass locally. Co-Authored-By: Claude Fable 5.2 --- README.md | 47 +++ docs/compatibility.md | 14 + .../silo/plugin/v1/request_router.pb.go | 373 ++++++++++++------ pkg/pluginsdk/manifest/manifest.go | 81 ++++ pkg/pluginsdk/manifest/request_router_test.go | 66 ++++ proto/silo/plugin/v1/request_router.proto | 34 ++ 6 files changed, 484 insertions(+), 131 deletions(-) diff --git a/README.md b/README.md index a5e5631..50adf8c 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,53 @@ refuses to install a bare plugin binary that declares them; see an empty key or base URL, so a plugin that declares either flag needs its own client for connections without them. +### Requester options + +By default a request goes out with the settings the admin saved on the server, +or a routing rule's. A plugin can let the requester, or the admin who +approves, choose some of them, such as a quality profile, by listing the +config fields in its manifest: + +```json +{ + "type": "request_router.v1", + "id": "seerr", + "request_router": { + "requester_options": [ + { "field": "radarr_profile_id", "media_type": "movie", "label": "Quality", "chooser_field": "profile_chosen_by" }, + { "field": "sonarr_profile_id", "media_type": "series", "label": "Quality", "chooser_field": "profile_chosen_by" } + ] + } +} +``` + +- `field`: a select field of the capability's admin form with + `dynamic_options`. The host offers the choices `ListConfigOptions` returns + for it on the server the request would go to. +- `media_type`: `movie` or `series`; empty offers the option for both. A field + may be listed once per media type. +- `label`: what requesters see, at most 24 characters on a single line. Empty + means the form field's label. +- `chooser_field`: a select in the same form that lists its own options, each + with one of these values, so an admin decides per server who chooses: + - `admin`: nobody; the saved value applies. Also what any other or missing + value means. + - `requester`: the requester when requesting. An approving admin may change + the pick. + - `approver`: the admin when approving. + + Empty lets requesters choose on every server. Because it is a select, a + routing rule can override it like any other. + +The plugin needs no other code. The host checks a pick against +the listed choices and passes it to `Fulfill` as that key of +`RouterConnection.config`, over the server's own value and a routing rule's. +When nobody picks, the config stays as the admin set it. Every +choice `ListConfigOptions` returns for the field is open to every requester +who may request, so list only fields whose choices are safe to hand out. +Hosts that predate the field ignore it; see +[docs/compatibility.md](docs/compatibility.md). + ### Wording Silo clients draw a request as four steps: requested, approved, the router's diff --git a/docs/compatibility.md b/docs/compatibility.md index 5222783..1460788 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -184,6 +184,20 @@ metadata stored when the plugin was installed or updated. A host built on an older SDK stored that metadata without them, so they take effect after the plugin is next updated on a host that reads them. +`RequestRouterDescriptor.requester_options` is a repeated message field read +from the manifest. Empty, or an absent descriptor, means requesters choose +nothing, which is the behaviour hosts had before the field existed. Hosts that +predate it drop it as an unknown field when they install a plugin archive, and +never offer the choice, so a plugin can declare options without raising its +minimum host version. Silo reads a bare plugin binary's manifest strictly, so a +Silo host that predates the field refuses to install a binary that declares +it; install it from an archive there. The plugin's RPCs do not change: a host +that reads the field passes a requester's or approving admin's pick as a key of +`RouterConnection.config`, where the plugin already reads the admin's value. +Hosts read the field from the capability metadata stored when the plugin was +installed or updated, so it takes effect after the plugin is next updated on a +host that reads it. + `MetadataItem.overview_language` and the `title_language` and `overview_language` fields on `SeasonRecord` and `EpisodeRecord` (added in v0.29.0) are plain strings, like the older `MetadataItem.title_language`. diff --git a/pkg/pluginproto/silo/plugin/v1/request_router.pb.go b/pkg/pluginproto/silo/plugin/v1/request_router.pb.go index 883b6bd..5cecfb9 100644 --- a/pkg/pluginproto/silo/plugin/v1/request_router.pb.go +++ b/pkg/pluginproto/silo/plugin/v1/request_router.pb.go @@ -180,8 +180,12 @@ type RequestRouterDescriptor struct { // base_url_optional declares that the plugin works without a base URL. The // host's admin form then saves and tests a server without one. BaseUrlOptional bool `protobuf:"varint,5,opt,name=base_url_optional,json=baseUrlOptional,proto3" json:"base_url_optional,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // requester_options lists the connection settings a requester may choose + // when making a request, such as a quality profile. Empty means requesters + // choose nothing, which is how hosts treat plugins built before this field. + RequesterOptions []*RequesterOption `protobuf:"bytes,6,rep,name=requester_options,json=requesterOptions,proto3" json:"requester_options,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RequestRouterDescriptor) Reset() { @@ -249,6 +253,104 @@ func (x *RequestRouterDescriptor) GetBaseUrlOptional() bool { return false } +func (x *RequestRouterDescriptor) GetRequesterOptions() []*RequesterOption { + if x != nil { + return x.RequesterOptions + } + return nil +} + +// RequesterOption lets the requester, or the admin who approves, choose one +// connection setting for a single request. The host offers the choices that +// ListConfigOptions returns for field on the server the request would go to, +// checks the pick against them, and passes it to Fulfill as that key of +// RouterConnection.config, over the server's own value and over a routing +// rule's. The plugin reads the config as it always does, so honouring a pick +// needs no code beyond the manifest. When nobody picks, the config stays as +// the admin set it. +type RequesterOption struct { + state protoimpl.MessageState `protogen:"open.v1"` + // field is the config key the requester sets. It must name a select field + // of the capability's admin form that has dynamic_options, so the host has + // a list to offer and to check a pick against. + Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` + // media_type limits the option to requests of one media type: "movie" or + // "series". Empty offers it for both. + MediaType string `protobuf:"bytes,2,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"` + // label names the choice to requesters, e.g. "Quality". Empty means the + // admin form field's label. At most 24 characters, on a single line + // without leading or trailing spaces. + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + // chooser_field is the config key of a select in the capability's admin + // form that names who chooses on a server: "admin" (nobody; the saved value + // applies), "requester" (the requester when requesting; an approving admin + // may change it) or "approver" (the admin when approving). The select lists + // its options itself, each with one of those values. A server with any + // other value, or none, is "admin". Empty lets requesters choose on every + // server. + ChooserField string `protobuf:"bytes,4,opt,name=chooser_field,json=chooserField,proto3" json:"chooser_field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RequesterOption) Reset() { + *x = RequesterOption{} + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RequesterOption) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequesterOption) ProtoMessage() {} + +func (x *RequesterOption) ProtoReflect() protoreflect.Message { + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequesterOption.ProtoReflect.Descriptor instead. +func (*RequesterOption) Descriptor() ([]byte, []int) { + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{2} +} + +func (x *RequesterOption) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +func (x *RequesterOption) GetMediaType() string { + if x != nil { + return x.MediaType + } + return "" +} + +func (x *RequesterOption) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *RequesterOption) GetChooserField() string { + if x != nil { + return x.ChooserField + } + return "" +} + // RequestRouterWording names the part of a request that a request router // handles, in words that fit how the plugin works. Clients draw a request as // four steps: requested, approved, the router's step, and in the library. The @@ -273,7 +375,7 @@ type RequestRouterWording struct { func (x *RequestRouterWording) Reset() { *x = RequestRouterWording{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[2] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -285,7 +387,7 @@ func (x *RequestRouterWording) String() string { func (*RequestRouterWording) ProtoMessage() {} func (x *RequestRouterWording) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[2] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -298,7 +400,7 @@ func (x *RequestRouterWording) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestRouterWording.ProtoReflect.Descriptor instead. func (*RequestRouterWording) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{2} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{3} } func (x *RequestRouterWording) GetStep() string { @@ -337,7 +439,7 @@ type RequestStatusWording struct { func (x *RequestStatusWording) Reset() { *x = RequestStatusWording{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[3] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -349,7 +451,7 @@ func (x *RequestStatusWording) String() string { func (*RequestStatusWording) ProtoMessage() {} func (x *RequestStatusWording) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[3] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -362,7 +464,7 @@ func (x *RequestStatusWording) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestStatusWording.ProtoReflect.Descriptor instead. func (*RequestStatusWording) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{3} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{4} } func (x *RequestStatusWording) GetLabel() string { @@ -398,7 +500,7 @@ type RouterConnection struct { func (x *RouterConnection) Reset() { *x = RouterConnection{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[4] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -410,7 +512,7 @@ func (x *RouterConnection) String() string { func (*RouterConnection) ProtoMessage() {} func (x *RouterConnection) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[4] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -423,7 +525,7 @@ func (x *RouterConnection) ProtoReflect() protoreflect.Message { // Deprecated: Use RouterConnection.ProtoReflect.Descriptor instead. func (*RouterConnection) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{4} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{5} } func (x *RouterConnection) GetId() string { @@ -468,7 +570,7 @@ type RequestedQuality struct { func (x *RequestedQuality) Reset() { *x = RequestedQuality{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[5] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -480,7 +582,7 @@ func (x *RequestedQuality) String() string { func (*RequestedQuality) ProtoMessage() {} func (x *RequestedQuality) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[5] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -493,7 +595,7 @@ func (x *RequestedQuality) ProtoReflect() protoreflect.Message { // Deprecated: Use RequestedQuality.ProtoReflect.Descriptor instead. func (*RequestedQuality) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{5} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{6} } func (x *RequestedQuality) GetId() string { @@ -522,7 +624,7 @@ type FulfillRequest struct { func (x *FulfillRequest) Reset() { *x = FulfillRequest{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[6] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -534,7 +636,7 @@ func (x *FulfillRequest) String() string { func (*FulfillRequest) ProtoMessage() {} func (x *FulfillRequest) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[6] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -547,7 +649,7 @@ func (x *FulfillRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use FulfillRequest.ProtoReflect.Descriptor instead. func (*FulfillRequest) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{6} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{7} } func (x *FulfillRequest) GetCapabilityId() string { @@ -598,7 +700,7 @@ type FulfillmentTarget struct { func (x *FulfillmentTarget) Reset() { *x = FulfillmentTarget{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[7] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -610,7 +712,7 @@ func (x *FulfillmentTarget) String() string { func (*FulfillmentTarget) ProtoMessage() {} func (x *FulfillmentTarget) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[7] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -623,7 +725,7 @@ func (x *FulfillmentTarget) ProtoReflect() protoreflect.Message { // Deprecated: Use FulfillmentTarget.ProtoReflect.Descriptor instead. func (*FulfillmentTarget) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{7} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{8} } func (x *FulfillmentTarget) GetQuality() string { @@ -686,7 +788,7 @@ type FulfillResponse struct { func (x *FulfillResponse) Reset() { *x = FulfillResponse{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[8] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -698,7 +800,7 @@ func (x *FulfillResponse) String() string { func (*FulfillResponse) ProtoMessage() {} func (x *FulfillResponse) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[8] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -711,7 +813,7 @@ func (x *FulfillResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use FulfillResponse.ProtoReflect.Descriptor instead. func (*FulfillResponse) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{8} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{9} } func (x *FulfillResponse) GetTargets() []*FulfillmentTarget { @@ -739,7 +841,7 @@ type TargetRef struct { func (x *TargetRef) Reset() { *x = TargetRef{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[9] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -751,7 +853,7 @@ func (x *TargetRef) String() string { func (*TargetRef) ProtoMessage() {} func (x *TargetRef) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[9] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -764,7 +866,7 @@ func (x *TargetRef) ProtoReflect() protoreflect.Message { // Deprecated: Use TargetRef.ProtoReflect.Descriptor instead. func (*TargetRef) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{9} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{10} } func (x *TargetRef) GetQuality() string { @@ -800,7 +902,7 @@ type CheckStatusRequest struct { func (x *CheckStatusRequest) Reset() { *x = CheckStatusRequest{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[10] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -812,7 +914,7 @@ func (x *CheckStatusRequest) String() string { func (*CheckStatusRequest) ProtoMessage() {} func (x *CheckStatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[10] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -825,7 +927,7 @@ func (x *CheckStatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckStatusRequest.ProtoReflect.Descriptor instead. func (*CheckStatusRequest) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{10} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{11} } func (x *CheckStatusRequest) GetCapabilityId() string { @@ -885,7 +987,7 @@ type DownloadProgress struct { func (x *DownloadProgress) Reset() { *x = DownloadProgress{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[11] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -897,7 +999,7 @@ func (x *DownloadProgress) String() string { func (*DownloadProgress) ProtoMessage() {} func (x *DownloadProgress) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[11] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -910,7 +1012,7 @@ func (x *DownloadProgress) ProtoReflect() protoreflect.Message { // Deprecated: Use DownloadProgress.ProtoReflect.Descriptor instead. func (*DownloadProgress) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{11} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{12} } func (x *DownloadProgress) GetPhase() string { @@ -983,7 +1085,7 @@ type TargetStatus struct { func (x *TargetStatus) Reset() { *x = TargetStatus{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[12] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -995,7 +1097,7 @@ func (x *TargetStatus) String() string { func (*TargetStatus) ProtoMessage() {} func (x *TargetStatus) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[12] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1008,7 +1110,7 @@ func (x *TargetStatus) ProtoReflect() protoreflect.Message { // Deprecated: Use TargetStatus.ProtoReflect.Descriptor instead. func (*TargetStatus) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{12} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{13} } func (x *TargetStatus) GetQuality() string { @@ -1069,7 +1171,7 @@ type CheckStatusResponse struct { func (x *CheckStatusResponse) Reset() { *x = CheckStatusResponse{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[13] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1081,7 +1183,7 @@ func (x *CheckStatusResponse) String() string { func (*CheckStatusResponse) ProtoMessage() {} func (x *CheckStatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[13] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1094,7 +1196,7 @@ func (x *CheckStatusResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckStatusResponse.ProtoReflect.Descriptor instead. func (*CheckStatusResponse) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{13} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{14} } func (x *CheckStatusResponse) GetStatuses() []*TargetStatus { @@ -1114,7 +1216,7 @@ type ConfigOption struct { func (x *ConfigOption) Reset() { *x = ConfigOption{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[14] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1126,7 +1228,7 @@ func (x *ConfigOption) String() string { func (*ConfigOption) ProtoMessage() {} func (x *ConfigOption) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[14] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1139,7 +1241,7 @@ func (x *ConfigOption) ProtoReflect() protoreflect.Message { // Deprecated: Use ConfigOption.ProtoReflect.Descriptor instead. func (*ConfigOption) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{14} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{15} } func (x *ConfigOption) GetValue() string { @@ -1165,7 +1267,7 @@ type ConfigOptionList struct { func (x *ConfigOptionList) Reset() { *x = ConfigOptionList{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[15] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1177,7 +1279,7 @@ func (x *ConfigOptionList) String() string { func (*ConfigOptionList) ProtoMessage() {} func (x *ConfigOptionList) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[15] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1190,7 +1292,7 @@ func (x *ConfigOptionList) ProtoReflect() protoreflect.Message { // Deprecated: Use ConfigOptionList.ProtoReflect.Descriptor instead. func (*ConfigOptionList) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{15} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{16} } func (x *ConfigOptionList) GetOptions() []*ConfigOption { @@ -1210,7 +1312,7 @@ type ListConfigOptionsRequest struct { func (x *ListConfigOptionsRequest) Reset() { *x = ListConfigOptionsRequest{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[16] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1222,7 +1324,7 @@ func (x *ListConfigOptionsRequest) String() string { func (*ListConfigOptionsRequest) ProtoMessage() {} func (x *ListConfigOptionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[16] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1235,7 +1337,7 @@ func (x *ListConfigOptionsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListConfigOptionsRequest.ProtoReflect.Descriptor instead. func (*ListConfigOptionsRequest) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{16} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{17} } func (x *ListConfigOptionsRequest) GetCapabilityId() string { @@ -1262,7 +1364,7 @@ type ListConfigOptionsResponse struct { func (x *ListConfigOptionsResponse) Reset() { *x = ListConfigOptionsResponse{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[17] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1274,7 +1376,7 @@ func (x *ListConfigOptionsResponse) String() string { func (*ListConfigOptionsResponse) ProtoMessage() {} func (x *ListConfigOptionsResponse) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[17] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1287,7 +1389,7 @@ func (x *ListConfigOptionsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListConfigOptionsResponse.ProtoReflect.Descriptor instead. func (*ListConfigOptionsResponse) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{17} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{18} } func (x *ListConfigOptionsResponse) GetOptionsByField() map[string]*ConfigOptionList { @@ -1307,7 +1409,7 @@ type TestConnectionRequest struct { func (x *TestConnectionRequest) Reset() { *x = TestConnectionRequest{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[18] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1319,7 +1421,7 @@ func (x *TestConnectionRequest) String() string { func (*TestConnectionRequest) ProtoMessage() {} func (x *TestConnectionRequest) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[18] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1332,7 +1434,7 @@ func (x *TestConnectionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TestConnectionRequest.ProtoReflect.Descriptor instead. func (*TestConnectionRequest) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{18} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{19} } func (x *TestConnectionRequest) GetCapabilityId() string { @@ -1359,7 +1461,7 @@ type TestConnectionResponse struct { func (x *TestConnectionResponse) Reset() { *x = TestConnectionResponse{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[19] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1371,7 +1473,7 @@ func (x *TestConnectionResponse) String() string { func (*TestConnectionResponse) ProtoMessage() {} func (x *TestConnectionResponse) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[19] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1384,7 +1486,7 @@ func (x *TestConnectionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TestConnectionResponse.ProtoReflect.Descriptor instead. func (*TestConnectionResponse) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{19} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{20} } func (x *TestConnectionResponse) GetOk() bool { @@ -1416,7 +1518,7 @@ type ValidateRequest struct { func (x *ValidateRequest) Reset() { *x = ValidateRequest{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[20] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1428,7 +1530,7 @@ func (x *ValidateRequest) String() string { func (*ValidateRequest) ProtoMessage() {} func (x *ValidateRequest) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[20] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1441,7 +1543,7 @@ func (x *ValidateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateRequest.ProtoReflect.Descriptor instead. func (*ValidateRequest) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{20} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{21} } func (x *ValidateRequest) GetCapabilityId() string { @@ -1475,7 +1577,7 @@ type ValidateResponse struct { func (x *ValidateResponse) Reset() { *x = ValidateResponse{} - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[21] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1487,7 +1589,7 @@ func (x *ValidateResponse) String() string { func (*ValidateResponse) ProtoMessage() {} func (x *ValidateResponse) ProtoReflect() protoreflect.Message { - mi := &file_silo_plugin_v1_request_router_proto_msgTypes[21] + mi := &file_silo_plugin_v1_request_router_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1500,7 +1602,7 @@ func (x *ValidateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateResponse.ProtoReflect.Descriptor instead. func (*ValidateResponse) Descriptor() ([]byte, []int) { - return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{21} + return file_silo_plugin_v1_request_router_proto_rawDescGZIP(), []int{22} } func (x *ValidateResponse) GetFieldErrors() map[string]string { @@ -1537,13 +1639,20 @@ const file_silo_plugin_v1_request_router_proto_rawDesc = "" + " \x03(\x05R\aseasons\x1a>\n" + "\x10ExternalIdsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x96\x02\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xe4\x02\n" + "\x17RequestRouterDescriptor\x12)\n" + "\x10supports_seasons\x18\x01 \x01(\bR\x0fsupportsSeasons\x12:\n" + "\x19reports_download_progress\x18\x02 \x01(\bR\x17reportsDownloadProgress\x12>\n" + "\awording\x18\x03 \x01(\v2$.silo.plugin.v1.RequestRouterWordingR\awording\x12(\n" + "\x10api_key_optional\x18\x04 \x01(\bR\x0eapiKeyOptional\x12*\n" + - "\x11base_url_optional\x18\x05 \x01(\bR\x0fbaseUrlOptional\"\xb0\x01\n" + + "\x11base_url_optional\x18\x05 \x01(\bR\x0fbaseUrlOptional\x12L\n" + + "\x11requester_options\x18\x06 \x03(\v2\x1f.silo.plugin.v1.RequesterOptionR\x10requesterOptions\"\x81\x01\n" + + "\x0fRequesterOption\x12\x14\n" + + "\x05field\x18\x01 \x01(\tR\x05field\x12\x1d\n" + + "\n" + + "media_type\x18\x02 \x01(\tR\tmediaType\x12\x14\n" + + "\x05label\x18\x03 \x01(\tR\x05label\x12#\n" + + "\rchooser_field\x18\x04 \x01(\tR\fchooserField\"\xb0\x01\n" + "\x14RequestRouterWording\x12\x12\n" + "\x04step\x18\x01 \x01(\tR\x04step\x12<\n" + "\x06queued\x18\x02 \x01(\v2$.silo.plugin.v1.RequestStatusWordingR\x06queued\x12F\n" + @@ -1659,77 +1768,79 @@ func file_silo_plugin_v1_request_router_proto_rawDescGZIP() []byte { return file_silo_plugin_v1_request_router_proto_rawDescData } -var file_silo_plugin_v1_request_router_proto_msgTypes = make([]protoimpl.MessageInfo, 25) +var file_silo_plugin_v1_request_router_proto_msgTypes = make([]protoimpl.MessageInfo, 26) var file_silo_plugin_v1_request_router_proto_goTypes = []any{ (*RequestDescriptor)(nil), // 0: silo.plugin.v1.RequestDescriptor (*RequestRouterDescriptor)(nil), // 1: silo.plugin.v1.RequestRouterDescriptor - (*RequestRouterWording)(nil), // 2: silo.plugin.v1.RequestRouterWording - (*RequestStatusWording)(nil), // 3: silo.plugin.v1.RequestStatusWording - (*RouterConnection)(nil), // 4: silo.plugin.v1.RouterConnection - (*RequestedQuality)(nil), // 5: silo.plugin.v1.RequestedQuality - (*FulfillRequest)(nil), // 6: silo.plugin.v1.FulfillRequest - (*FulfillmentTarget)(nil), // 7: silo.plugin.v1.FulfillmentTarget - (*FulfillResponse)(nil), // 8: silo.plugin.v1.FulfillResponse - (*TargetRef)(nil), // 9: silo.plugin.v1.TargetRef - (*CheckStatusRequest)(nil), // 10: silo.plugin.v1.CheckStatusRequest - (*DownloadProgress)(nil), // 11: silo.plugin.v1.DownloadProgress - (*TargetStatus)(nil), // 12: silo.plugin.v1.TargetStatus - (*CheckStatusResponse)(nil), // 13: silo.plugin.v1.CheckStatusResponse - (*ConfigOption)(nil), // 14: silo.plugin.v1.ConfigOption - (*ConfigOptionList)(nil), // 15: silo.plugin.v1.ConfigOptionList - (*ListConfigOptionsRequest)(nil), // 16: silo.plugin.v1.ListConfigOptionsRequest - (*ListConfigOptionsResponse)(nil), // 17: silo.plugin.v1.ListConfigOptionsResponse - (*TestConnectionRequest)(nil), // 18: silo.plugin.v1.TestConnectionRequest - (*TestConnectionResponse)(nil), // 19: silo.plugin.v1.TestConnectionResponse - (*ValidateRequest)(nil), // 20: silo.plugin.v1.ValidateRequest - (*ValidateResponse)(nil), // 21: silo.plugin.v1.ValidateResponse - nil, // 22: silo.plugin.v1.RequestDescriptor.ExternalIdsEntry - nil, // 23: silo.plugin.v1.ListConfigOptionsResponse.OptionsByFieldEntry - nil, // 24: silo.plugin.v1.ValidateResponse.FieldErrorsEntry - (*structpb.Struct)(nil), // 25: google.protobuf.Struct - (*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp + (*RequesterOption)(nil), // 2: silo.plugin.v1.RequesterOption + (*RequestRouterWording)(nil), // 3: silo.plugin.v1.RequestRouterWording + (*RequestStatusWording)(nil), // 4: silo.plugin.v1.RequestStatusWording + (*RouterConnection)(nil), // 5: silo.plugin.v1.RouterConnection + (*RequestedQuality)(nil), // 6: silo.plugin.v1.RequestedQuality + (*FulfillRequest)(nil), // 7: silo.plugin.v1.FulfillRequest + (*FulfillmentTarget)(nil), // 8: silo.plugin.v1.FulfillmentTarget + (*FulfillResponse)(nil), // 9: silo.plugin.v1.FulfillResponse + (*TargetRef)(nil), // 10: silo.plugin.v1.TargetRef + (*CheckStatusRequest)(nil), // 11: silo.plugin.v1.CheckStatusRequest + (*DownloadProgress)(nil), // 12: silo.plugin.v1.DownloadProgress + (*TargetStatus)(nil), // 13: silo.plugin.v1.TargetStatus + (*CheckStatusResponse)(nil), // 14: silo.plugin.v1.CheckStatusResponse + (*ConfigOption)(nil), // 15: silo.plugin.v1.ConfigOption + (*ConfigOptionList)(nil), // 16: silo.plugin.v1.ConfigOptionList + (*ListConfigOptionsRequest)(nil), // 17: silo.plugin.v1.ListConfigOptionsRequest + (*ListConfigOptionsResponse)(nil), // 18: silo.plugin.v1.ListConfigOptionsResponse + (*TestConnectionRequest)(nil), // 19: silo.plugin.v1.TestConnectionRequest + (*TestConnectionResponse)(nil), // 20: silo.plugin.v1.TestConnectionResponse + (*ValidateRequest)(nil), // 21: silo.plugin.v1.ValidateRequest + (*ValidateResponse)(nil), // 22: silo.plugin.v1.ValidateResponse + nil, // 23: silo.plugin.v1.RequestDescriptor.ExternalIdsEntry + nil, // 24: silo.plugin.v1.ListConfigOptionsResponse.OptionsByFieldEntry + nil, // 25: silo.plugin.v1.ValidateResponse.FieldErrorsEntry + (*structpb.Struct)(nil), // 26: google.protobuf.Struct + (*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp } var file_silo_plugin_v1_request_router_proto_depIdxs = []int32{ - 22, // 0: silo.plugin.v1.RequestDescriptor.external_ids:type_name -> silo.plugin.v1.RequestDescriptor.ExternalIdsEntry - 2, // 1: silo.plugin.v1.RequestRouterDescriptor.wording:type_name -> silo.plugin.v1.RequestRouterWording - 3, // 2: silo.plugin.v1.RequestRouterWording.queued:type_name -> silo.plugin.v1.RequestStatusWording - 3, // 3: silo.plugin.v1.RequestRouterWording.downloading:type_name -> silo.plugin.v1.RequestStatusWording - 25, // 4: silo.plugin.v1.RouterConnection.config:type_name -> google.protobuf.Struct - 0, // 5: silo.plugin.v1.FulfillRequest.request:type_name -> silo.plugin.v1.RequestDescriptor - 5, // 6: silo.plugin.v1.FulfillRequest.qualities:type_name -> silo.plugin.v1.RequestedQuality - 4, // 7: silo.plugin.v1.FulfillRequest.connections:type_name -> silo.plugin.v1.RouterConnection - 3, // 8: silo.plugin.v1.FulfillmentTarget.wording:type_name -> silo.plugin.v1.RequestStatusWording - 7, // 9: silo.plugin.v1.FulfillResponse.targets:type_name -> silo.plugin.v1.FulfillmentTarget - 0, // 10: silo.plugin.v1.CheckStatusRequest.request:type_name -> silo.plugin.v1.RequestDescriptor - 9, // 11: silo.plugin.v1.CheckStatusRequest.targets:type_name -> silo.plugin.v1.TargetRef - 4, // 12: silo.plugin.v1.CheckStatusRequest.connections:type_name -> silo.plugin.v1.RouterConnection - 26, // 13: silo.plugin.v1.DownloadProgress.estimated_completion:type_name -> google.protobuf.Timestamp - 11, // 14: silo.plugin.v1.TargetStatus.progress:type_name -> silo.plugin.v1.DownloadProgress - 3, // 15: silo.plugin.v1.TargetStatus.wording:type_name -> silo.plugin.v1.RequestStatusWording - 12, // 16: silo.plugin.v1.CheckStatusResponse.statuses:type_name -> silo.plugin.v1.TargetStatus - 14, // 17: silo.plugin.v1.ConfigOptionList.options:type_name -> silo.plugin.v1.ConfigOption - 4, // 18: silo.plugin.v1.ListConfigOptionsRequest.connection:type_name -> silo.plugin.v1.RouterConnection - 23, // 19: silo.plugin.v1.ListConfigOptionsResponse.options_by_field:type_name -> silo.plugin.v1.ListConfigOptionsResponse.OptionsByFieldEntry - 4, // 20: silo.plugin.v1.TestConnectionRequest.connection:type_name -> silo.plugin.v1.RouterConnection - 4, // 21: silo.plugin.v1.ValidateRequest.connection:type_name -> silo.plugin.v1.RouterConnection - 4, // 22: silo.plugin.v1.ValidateRequest.siblings:type_name -> silo.plugin.v1.RouterConnection - 24, // 23: silo.plugin.v1.ValidateResponse.field_errors:type_name -> silo.plugin.v1.ValidateResponse.FieldErrorsEntry - 15, // 24: silo.plugin.v1.ListConfigOptionsResponse.OptionsByFieldEntry.value:type_name -> silo.plugin.v1.ConfigOptionList - 6, // 25: silo.plugin.v1.RequestRouter.Fulfill:input_type -> silo.plugin.v1.FulfillRequest - 10, // 26: silo.plugin.v1.RequestRouter.CheckStatus:input_type -> silo.plugin.v1.CheckStatusRequest - 16, // 27: silo.plugin.v1.RequestRouter.ListConfigOptions:input_type -> silo.plugin.v1.ListConfigOptionsRequest - 18, // 28: silo.plugin.v1.RequestRouter.TestConnection:input_type -> silo.plugin.v1.TestConnectionRequest - 20, // 29: silo.plugin.v1.RequestRouter.Validate:input_type -> silo.plugin.v1.ValidateRequest - 8, // 30: silo.plugin.v1.RequestRouter.Fulfill:output_type -> silo.plugin.v1.FulfillResponse - 13, // 31: silo.plugin.v1.RequestRouter.CheckStatus:output_type -> silo.plugin.v1.CheckStatusResponse - 17, // 32: silo.plugin.v1.RequestRouter.ListConfigOptions:output_type -> silo.plugin.v1.ListConfigOptionsResponse - 19, // 33: silo.plugin.v1.RequestRouter.TestConnection:output_type -> silo.plugin.v1.TestConnectionResponse - 21, // 34: silo.plugin.v1.RequestRouter.Validate:output_type -> silo.plugin.v1.ValidateResponse - 30, // [30:35] is the sub-list for method output_type - 25, // [25:30] is the sub-list for method input_type - 25, // [25:25] is the sub-list for extension type_name - 25, // [25:25] is the sub-list for extension extendee - 0, // [0:25] is the sub-list for field type_name + 23, // 0: silo.plugin.v1.RequestDescriptor.external_ids:type_name -> silo.plugin.v1.RequestDescriptor.ExternalIdsEntry + 3, // 1: silo.plugin.v1.RequestRouterDescriptor.wording:type_name -> silo.plugin.v1.RequestRouterWording + 2, // 2: silo.plugin.v1.RequestRouterDescriptor.requester_options:type_name -> silo.plugin.v1.RequesterOption + 4, // 3: silo.plugin.v1.RequestRouterWording.queued:type_name -> silo.plugin.v1.RequestStatusWording + 4, // 4: silo.plugin.v1.RequestRouterWording.downloading:type_name -> silo.plugin.v1.RequestStatusWording + 26, // 5: silo.plugin.v1.RouterConnection.config:type_name -> google.protobuf.Struct + 0, // 6: silo.plugin.v1.FulfillRequest.request:type_name -> silo.plugin.v1.RequestDescriptor + 6, // 7: silo.plugin.v1.FulfillRequest.qualities:type_name -> silo.plugin.v1.RequestedQuality + 5, // 8: silo.plugin.v1.FulfillRequest.connections:type_name -> silo.plugin.v1.RouterConnection + 4, // 9: silo.plugin.v1.FulfillmentTarget.wording:type_name -> silo.plugin.v1.RequestStatusWording + 8, // 10: silo.plugin.v1.FulfillResponse.targets:type_name -> silo.plugin.v1.FulfillmentTarget + 0, // 11: silo.plugin.v1.CheckStatusRequest.request:type_name -> silo.plugin.v1.RequestDescriptor + 10, // 12: silo.plugin.v1.CheckStatusRequest.targets:type_name -> silo.plugin.v1.TargetRef + 5, // 13: silo.plugin.v1.CheckStatusRequest.connections:type_name -> silo.plugin.v1.RouterConnection + 27, // 14: silo.plugin.v1.DownloadProgress.estimated_completion:type_name -> google.protobuf.Timestamp + 12, // 15: silo.plugin.v1.TargetStatus.progress:type_name -> silo.plugin.v1.DownloadProgress + 4, // 16: silo.plugin.v1.TargetStatus.wording:type_name -> silo.plugin.v1.RequestStatusWording + 13, // 17: silo.plugin.v1.CheckStatusResponse.statuses:type_name -> silo.plugin.v1.TargetStatus + 15, // 18: silo.plugin.v1.ConfigOptionList.options:type_name -> silo.plugin.v1.ConfigOption + 5, // 19: silo.plugin.v1.ListConfigOptionsRequest.connection:type_name -> silo.plugin.v1.RouterConnection + 24, // 20: silo.plugin.v1.ListConfigOptionsResponse.options_by_field:type_name -> silo.plugin.v1.ListConfigOptionsResponse.OptionsByFieldEntry + 5, // 21: silo.plugin.v1.TestConnectionRequest.connection:type_name -> silo.plugin.v1.RouterConnection + 5, // 22: silo.plugin.v1.ValidateRequest.connection:type_name -> silo.plugin.v1.RouterConnection + 5, // 23: silo.plugin.v1.ValidateRequest.siblings:type_name -> silo.plugin.v1.RouterConnection + 25, // 24: silo.plugin.v1.ValidateResponse.field_errors:type_name -> silo.plugin.v1.ValidateResponse.FieldErrorsEntry + 16, // 25: silo.plugin.v1.ListConfigOptionsResponse.OptionsByFieldEntry.value:type_name -> silo.plugin.v1.ConfigOptionList + 7, // 26: silo.plugin.v1.RequestRouter.Fulfill:input_type -> silo.plugin.v1.FulfillRequest + 11, // 27: silo.plugin.v1.RequestRouter.CheckStatus:input_type -> silo.plugin.v1.CheckStatusRequest + 17, // 28: silo.plugin.v1.RequestRouter.ListConfigOptions:input_type -> silo.plugin.v1.ListConfigOptionsRequest + 19, // 29: silo.plugin.v1.RequestRouter.TestConnection:input_type -> silo.plugin.v1.TestConnectionRequest + 21, // 30: silo.plugin.v1.RequestRouter.Validate:input_type -> silo.plugin.v1.ValidateRequest + 9, // 31: silo.plugin.v1.RequestRouter.Fulfill:output_type -> silo.plugin.v1.FulfillResponse + 14, // 32: silo.plugin.v1.RequestRouter.CheckStatus:output_type -> silo.plugin.v1.CheckStatusResponse + 18, // 33: silo.plugin.v1.RequestRouter.ListConfigOptions:output_type -> silo.plugin.v1.ListConfigOptionsResponse + 20, // 34: silo.plugin.v1.RequestRouter.TestConnection:output_type -> silo.plugin.v1.TestConnectionResponse + 22, // 35: silo.plugin.v1.RequestRouter.Validate:output_type -> silo.plugin.v1.ValidateResponse + 31, // [31:36] is the sub-list for method output_type + 26, // [26:31] is the sub-list for method input_type + 26, // [26:26] is the sub-list for extension type_name + 26, // [26:26] is the sub-list for extension extendee + 0, // [0:26] is the sub-list for field type_name } func init() { file_silo_plugin_v1_request_router_proto_init() } @@ -1743,7 +1854,7 @@ func file_silo_plugin_v1_request_router_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_silo_plugin_v1_request_router_proto_rawDesc), len(file_silo_plugin_v1_request_router_proto_rawDesc)), NumEnums: 0, - NumMessages: 25, + NumMessages: 26, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/pluginsdk/manifest/manifest.go b/pkg/pluginsdk/manifest/manifest.go index 5d7291c..5295b05 100644 --- a/pkg/pluginsdk/manifest/manifest.go +++ b/pkg/pluginsdk/manifest/manifest.go @@ -331,6 +331,87 @@ func validateRequestRouterCapability(descriptor *pluginv1.CapabilityDescriptor) if err := ValidateRequestRouterWording(descriptor.GetRequestRouter().GetWording()); err != nil { return fmt.Errorf("plugin capability %q: %w", descriptor.GetId(), err) } + if err := validateRequesterOptions(descriptor); err != nil { + return fmt.Errorf("plugin capability %q: %w", descriptor.GetId(), err) + } + return nil +} + +// Media types a RequesterOption may name; they match +// RequestDescriptor.media_type. +const ( + RequesterOptionMediaTypeMovie = "movie" + RequesterOptionMediaTypeSeries = "series" +) + +// Values of a RequesterOption's chooser_field select: who chooses the option +// on a server. +const ( + // RequesterOptionChooserAdmin: nobody chooses; the saved value applies. + RequesterOptionChooserAdmin = "admin" + // RequesterOptionChooserRequester: the requester chooses when + // requesting, and an approving admin may change the pick. + RequesterOptionChooserRequester = "requester" + // RequesterOptionChooserApprover: the admin chooses when approving. + RequesterOptionChooserApprover = "approver" +) + +// validateRequesterOptions checks each requester option against the +// capability's admin forms: field must be a select with dynamic options, and +// chooser_field a select that lists its own options, each a chooser value, so +// a host can list the choices and read who chooses. A field may be listed +// once per media type. +func validateRequesterOptions(descriptor *pluginv1.CapabilityDescriptor) error { + options := descriptor.GetRequestRouter().GetRequesterOptions() + if len(options) == 0 { + return nil + } + fields := map[string]*pluginv1.AdminFormField{} + for _, schema := range descriptor.GetConfigSchema() { + for _, field := range schema.GetAdminForm().GetFields() { + fields[field.GetKey()] = field + } + } + seen := map[string]bool{} + for i, option := range options { + name := fmt.Sprintf("request_router requester_options[%d]", i) + key := option.GetField() + if key == "" { + return fmt.Errorf("%s: field is required", name) + } + field, ok := fields[key] + if !ok || field.GetControl() != pluginv1.AdminFormControl_ADMIN_FORM_CONTROL_SELECT || !field.GetDynamicOptions() { + return fmt.Errorf("%s: field %q must be a select with dynamic_options in the capability's admin form", name, key) + } + mediaType := option.GetMediaType() + switch mediaType { + case "", RequesterOptionMediaTypeMovie, RequesterOptionMediaTypeSeries: + default: + return fmt.Errorf("%s: media_type %q must be %q, %q or empty", name, mediaType, RequesterOptionMediaTypeMovie, RequesterOptionMediaTypeSeries) + } + // An option for every media type overlaps one for a single type. + if seen[key+"/"] || seen[key+"/"+mediaType] || (mediaType == "" && (seen[key+"/"+RequesterOptionMediaTypeMovie] || seen[key+"/"+RequesterOptionMediaTypeSeries])) { + return fmt.Errorf("%s: field %q is listed more than once for a media type", name, key) + } + seen[key+"/"+mediaType] = true + if err := validateWordingValue("label", option.GetLabel(), MaxRequestWordingLabelRunes); err != nil { + return fmt.Errorf("%s: %w", name, err) + } + if chooser := option.GetChooserField(); chooser != "" { + field, ok := fields[chooser] + if !ok || field.GetControl() != pluginv1.AdminFormControl_ADMIN_FORM_CONTROL_SELECT || field.GetDynamicOptions() || len(field.GetOptions()) == 0 { + return fmt.Errorf("%s: chooser_field %q must be a select that lists its options in the capability's admin form", name, chooser) + } + for _, choice := range field.GetOptions() { + switch choice.GetValue() { + case RequesterOptionChooserAdmin, RequesterOptionChooserRequester, RequesterOptionChooserApprover: + default: + return fmt.Errorf("%s: chooser_field %q option %q must be %q, %q or %q", name, chooser, choice.GetValue(), + RequesterOptionChooserAdmin, RequesterOptionChooserRequester, RequesterOptionChooserApprover) + } + } + } + } return nil } diff --git a/pkg/pluginsdk/manifest/request_router_test.go b/pkg/pluginsdk/manifest/request_router_test.go index 8c8fe51..a0e8b0c 100644 --- a/pkg/pluginsdk/manifest/request_router_test.go +++ b/pkg/pluginsdk/manifest/request_router_test.go @@ -225,3 +225,69 @@ func TestValidateRequestStatusWording(t *testing.T) { } } } + +// requesterOptionsManifest is a router whose form has a dynamic select, a +// plain select, a chooser select and a switch, with the given +// requester_options. +func requesterOptionsManifest(options string) []byte { + return []byte(`{ + "plugin_id":"silo.requests-seerr", "version":"1.0.0", "silo_api_version":"v1", + "capabilities":[{ + "type":"request_router.v1", "id":"seerr", "display_name":"Seerr", + "request_router":{"requester_options":[` + options + `]}, + "config_schema":[{"key":"connection", "title":"Seerr", "json_schema":"{\"type\":\"object\",\"properties\":{\"profile\":{\"type\":\"string\"},\"mode\":{\"type\":\"string\"},\"chooser\":{\"type\":\"string\"},\"allow\":{\"type\":\"boolean\"},\"name\":{\"type\":\"string\"}}}", "admin_form":{"fields":[ + {"key":"profile", "label":"Quality profile", "control":"ADMIN_FORM_CONTROL_SELECT", "dynamic_options":true}, + {"key":"mode", "label":"Mode", "control":"ADMIN_FORM_CONTROL_SELECT", "options":[{"value":"a", "label":"A"}]}, + {"key":"chooser", "label":"Chosen by", "control":"ADMIN_FORM_CONTROL_SELECT", "options":[{"value":"admin", "label":"Admin"}, {"value":"requester", "label":"Requester"}, {"value":"approver", "label":"Admin on approval"}]}, + {"key":"allow", "label":"Let requesters choose", "control":"ADMIN_FORM_CONTROL_SWITCH"}, + {"key":"name", "label":"Name", "control":"ADMIN_FORM_CONTROL_TEXT"} + ]}}] + }] + }`) +} + +func TestLoadRequestRouterDeclaresRequesterOptions(t *testing.T) { + manifest, err := publicmanifest.Load(requesterOptionsManifest(` + {"field":"profile", "media_type":"movie", "label":"Quality", "chooser_field":"chooser"}, + {"field":"profile", "media_type":"series"}`)) + if err != nil { + t.Fatal(err) + } + options := manifest.GetCapabilities()[0].GetRequestRouter().GetRequesterOptions() + if len(options) != 2 { + t.Fatalf("requester_options = %v, want 2", options) + } + first := options[0] + if first.GetField() != "profile" || first.GetMediaType() != "movie" || first.GetLabel() != "Quality" || first.GetChooserField() != "chooser" { + t.Fatalf("first option = %v", first) + } + if options[1].GetLabel() != "" || options[1].GetChooserField() != "" { + t.Fatalf("second option = %v, want no label and no chooser", options[1]) + } +} + +func TestLoadRequestRouterRejectsBadRequesterOptions(t *testing.T) { + for name, c := range map[string]struct{ options, want string }{ + "no field": {`{"media_type":"movie"}`, "field is required"}, + "unknown field": {`{"field":"folder"}`, "must be a select with dynamic_options"}, + "static select": {`{"field":"mode"}`, "must be a select with dynamic_options"}, + "not a select": {`{"field":"name"}`, "must be a select with dynamic_options"}, + "unknown media type": {`{"field":"profile", "media_type":"tv"}`, "media_type"}, + "listed twice": {`{"field":"profile", "media_type":"movie"}, {"field":"profile", "media_type":"movie"}`, "more than once"}, + "all after one": {`{"field":"profile", "media_type":"movie"}, {"field":"profile"}`, "more than once"}, + "one after all": {`{"field":"profile"}, {"field":"profile", "media_type":"series"}`, "more than once"}, + "long label": {`{"field":"profile", "label":"A label that is far too long to fit"}`, "exceeds 24 characters"}, + "padded label": {`{"field":"profile", "label":" Quality"}`, "leading or trailing whitespace"}, + "unknown chooser": {`{"field":"profile", "chooser_field":"nope"}`, "must be a select that lists its options"}, + "chooser is a switch": {`{"field":"profile", "chooser_field":"allow"}`, "must be a select that lists its options"}, + "chooser is dynamic": {`{"field":"profile", "chooser_field":"profile"}`, "must be a select that lists its options"}, + "chooser other values": {`{"field":"profile", "chooser_field":"mode"}`, `option "a" must be`}, + } { + t.Run(name, func(t *testing.T) { + _, err := publicmanifest.Load(requesterOptionsManifest(c.options)) + if err == nil || !strings.Contains(err.Error(), c.want) { + t.Fatalf("Load error = %v, want one containing %q", err, c.want) + } + }) + } +} diff --git a/proto/silo/plugin/v1/request_router.proto b/proto/silo/plugin/v1/request_router.proto index a1d48cb..3c581bf 100644 --- a/proto/silo/plugin/v1/request_router.proto +++ b/proto/silo/plugin/v1/request_router.proto @@ -73,6 +73,40 @@ message RequestRouterDescriptor { // base_url_optional declares that the plugin works without a base URL. The // host's admin form then saves and tests a server without one. bool base_url_optional = 5; + // requester_options lists the connection settings a requester may choose + // when making a request, such as a quality profile. Empty means requesters + // choose nothing, which is how hosts treat plugins built before this field. + repeated RequesterOption requester_options = 6; +} + +// RequesterOption lets the requester, or the admin who approves, choose one +// connection setting for a single request. The host offers the choices that +// ListConfigOptions returns for field on the server the request would go to, +// checks the pick against them, and passes it to Fulfill as that key of +// RouterConnection.config, over the server's own value and over a routing +// rule's. The plugin reads the config as it always does, so honouring a pick +// needs no code beyond the manifest. When nobody picks, the config stays as +// the admin set it. +message RequesterOption { + // field is the config key the requester sets. It must name a select field + // of the capability's admin form that has dynamic_options, so the host has + // a list to offer and to check a pick against. + string field = 1; + // media_type limits the option to requests of one media type: "movie" or + // "series". Empty offers it for both. + string media_type = 2; + // label names the choice to requesters, e.g. "Quality". Empty means the + // admin form field's label. At most 24 characters, on a single line + // without leading or trailing spaces. + string label = 3; + // chooser_field is the config key of a select in the capability's admin + // form that names who chooses on a server: "admin" (nobody; the saved value + // applies), "requester" (the requester when requesting; an approving admin + // may change it) or "approver" (the admin when approving). The select lists + // its options itself, each with one of those values. A server with any + // other value, or none, is "admin". Empty lets requesters choose on every + // server. + string chooser_field = 4; } // RequestRouterWording names the part of a request that a request router From 1fe3386123768c64e674163257d97d525b88bf42 Mon Sep 17 00:00:00 2001 From: Maik Groten Date: Thu, 12 Nov 2026 20:18:21 +0100 Subject: [PATCH 2/2] fix(request-router): require a string field for requester options and scope the compatibility note A requester option's pick is a ConfigOption value, which is a string. A select may sit on a numeric json_schema property, and setting the pick there would change the type the plugin reads. Manifest validation now refuses a requester option whose field is not a string property. The compatibility note said older hosts ignore the field. That holds for loading a manifest, which every SDK version does leniently. It now also names the two stricter paths: Silo's read of a bare binary's manifest, and stored capability metadata on an SDK older than v0.13.1. AI disclosure: written with Claude Fable 5.2 in Claude Code. go vet and go test pass locally; pkg/pluginproto was regenerated with buf. Co-Authored-By: Claude Fable 5.2 --- README.md | 10 ++++---- docs/compatibility.md | 14 +++++++---- .../silo/plugin/v1/request_router.pb.go | 4 +++- pkg/pluginsdk/manifest/manifest.go | 23 +++++++++++++++---- pkg/pluginsdk/manifest/request_router_test.go | 6 +++-- proto/silo/plugin/v1/request_router.proto | 4 +++- 6 files changed, 44 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 50adf8c..79737ce 100644 --- a/README.md +++ b/README.md @@ -304,8 +304,9 @@ config fields in its manifest: ``` - `field`: a select field of the capability's admin form with - `dynamic_options`. The host offers the choices `ListConfigOptions` returns - for it on the server the request would go to. + `dynamic_options`, over a string property of the `json_schema`. The host + offers the choices `ListConfigOptions` returns for it on the server the + request would go to, and sets the pick as that string. - `media_type`: `movie` or `series`; empty offers the option for both. A field may be listed once per media type. - `label`: what requesters see, at most 24 characters on a single line. Empty @@ -327,8 +328,9 @@ the listed choices and passes it to `Fulfill` as that key of When nobody picks, the config stays as the admin set it. Every choice `ListConfigOptions` returns for the field is open to every requester who may request, so list only fields whose choices are safe to hand out. -Hosts that predate the field ignore it; see -[docs/compatibility.md](docs/compatibility.md). +A host that predates the field ignores it when it installs the plugin from +an archive. [docs/compatibility.md](docs/compatibility.md) lists the two +cases where an older host rejects it. ### Wording diff --git a/docs/compatibility.md b/docs/compatibility.md index 1460788..64cc51d 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -187,11 +187,15 @@ plugin is next updated on a host that reads them. `RequestRouterDescriptor.requester_options` is a repeated message field read from the manifest. Empty, or an absent descriptor, means requesters choose nothing, which is the behaviour hosts had before the field existed. Hosts that -predate it drop it as an unknown field when they install a plugin archive, and -never offer the choice, so a plugin can declare options without raising its -minimum host version. Silo reads a bare plugin binary's manifest strictly, so a -Silo host that predates the field refuses to install a binary that declares -it; install it from an archive there. The plugin's RPCs do not change: a host +predate it drop it as an unknown field when they load a plugin archive's +manifest, which every SDK version does, and never offer the choice, so a +plugin can declare options without raising its minimum host version. Two +decoding paths are stricter. Silo reads a bare plugin binary's manifest +strictly, so a Silo host that predates the field refuses to install a binary +that declares it; install it from an archive there. And a host built on an SDK +older than v0.13.1 rejects stored capability metadata that carries a field it +does not know, so in a cluster that shares one database, upgrade such nodes +before a plugin that declares options is installed. The plugin's RPCs do not change: a host that reads the field passes a requester's or approving admin's pick as a key of `RouterConnection.config`, where the plugin already reads the admin's value. Hosts read the field from the capability metadata stored when the plugin was diff --git a/pkg/pluginproto/silo/plugin/v1/request_router.pb.go b/pkg/pluginproto/silo/plugin/v1/request_router.pb.go index 5cecfb9..617102f 100644 --- a/pkg/pluginproto/silo/plugin/v1/request_router.pb.go +++ b/pkg/pluginproto/silo/plugin/v1/request_router.pb.go @@ -272,7 +272,9 @@ type RequesterOption struct { state protoimpl.MessageState `protogen:"open.v1"` // field is the config key the requester sets. It must name a select field // of the capability's admin form that has dynamic_options, so the host has - // a list to offer and to check a pick against. + // a list to offer and to check a pick against. Its json_schema property + // must be a string: a pick is a ConfigOption value, and the host sets it + // as that string. Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` // media_type limits the option to requests of one media type: "movie" or // "series". Empty offers it for both. diff --git a/pkg/pluginsdk/manifest/manifest.go b/pkg/pluginsdk/manifest/manifest.go index 5295b05..75066ed 100644 --- a/pkg/pluginsdk/manifest/manifest.go +++ b/pkg/pluginsdk/manifest/manifest.go @@ -357,19 +357,29 @@ const ( ) // validateRequesterOptions checks each requester option against the -// capability's admin forms: field must be a select with dynamic options, and -// chooser_field a select that lists its own options, each a chooser value, so -// a host can list the choices and read who chooses. A field may be listed -// once per media type. +// capability's admin forms: field must be a select with dynamic options over +// a string property, and chooser_field a select that lists its own options, +// each a chooser value, so a host can list the choices and read who chooses. +// A field may be listed once per media type. func validateRequesterOptions(descriptor *pluginv1.CapabilityDescriptor) error { options := descriptor.GetRequestRouter().GetRequesterOptions() if len(options) == 0 { return nil } fields := map[string]*pluginv1.AdminFormField{} + // The json_schema type of each form field. A schema that does not parse + // is reported by the admin form validation. + types := map[string]string{} for _, schema := range descriptor.GetConfigSchema() { + var parsed struct { + Properties map[string]struct { + Type string `json:"type"` + } `json:"properties"` + } + _ = json.Unmarshal([]byte(schema.GetJsonSchema()), &parsed) for _, field := range schema.GetAdminForm().GetFields() { fields[field.GetKey()] = field + types[field.GetKey()] = parsed.Properties[field.GetKey()].Type } } seen := map[string]bool{} @@ -383,6 +393,11 @@ func validateRequesterOptions(descriptor *pluginv1.CapabilityDescriptor) error { if !ok || field.GetControl() != pluginv1.AdminFormControl_ADMIN_FORM_CONTROL_SELECT || !field.GetDynamicOptions() { return fmt.Errorf("%s: field %q must be a select with dynamic_options in the capability's admin form", name, key) } + // A pick is a ConfigOption value, which is a string. Set on a + // property of another type it would change the type the plugin reads. + if propertyType := types[key]; propertyType != "" && propertyType != "string" { + return fmt.Errorf("%s: field %q must be a string property in json_schema, not %s: a pick is passed as a string", name, key, propertyType) + } mediaType := option.GetMediaType() switch mediaType { case "", RequesterOptionMediaTypeMovie, RequesterOptionMediaTypeSeries: diff --git a/pkg/pluginsdk/manifest/request_router_test.go b/pkg/pluginsdk/manifest/request_router_test.go index a0e8b0c..0386a75 100644 --- a/pkg/pluginsdk/manifest/request_router_test.go +++ b/pkg/pluginsdk/manifest/request_router_test.go @@ -227,7 +227,7 @@ func TestValidateRequestStatusWording(t *testing.T) { } // requesterOptionsManifest is a router whose form has a dynamic select, a -// plain select, a chooser select and a switch, with the given +// dynamic select over an integer, a plain select, a chooser select and a switch, with the given // requester_options. func requesterOptionsManifest(options string) []byte { return []byte(`{ @@ -235,8 +235,9 @@ func requesterOptionsManifest(options string) []byte { "capabilities":[{ "type":"request_router.v1", "id":"seerr", "display_name":"Seerr", "request_router":{"requester_options":[` + options + `]}, - "config_schema":[{"key":"connection", "title":"Seerr", "json_schema":"{\"type\":\"object\",\"properties\":{\"profile\":{\"type\":\"string\"},\"mode\":{\"type\":\"string\"},\"chooser\":{\"type\":\"string\"},\"allow\":{\"type\":\"boolean\"},\"name\":{\"type\":\"string\"}}}", "admin_form":{"fields":[ + "config_schema":[{"key":"connection", "title":"Seerr", "json_schema":"{\"type\":\"object\",\"properties\":{\"profile\":{\"type\":\"string\"},\"mode\":{\"type\":\"string\"},\"chooser\":{\"type\":\"string\"},\"allow\":{\"type\":\"boolean\"},\"level\":{\"type\":\"integer\"},\"name\":{\"type\":\"string\"}}}", "admin_form":{"fields":[ {"key":"profile", "label":"Quality profile", "control":"ADMIN_FORM_CONTROL_SELECT", "dynamic_options":true}, + {"key":"level", "label":"Level", "control":"ADMIN_FORM_CONTROL_SELECT", "dynamic_options":true}, {"key":"mode", "label":"Mode", "control":"ADMIN_FORM_CONTROL_SELECT", "options":[{"value":"a", "label":"A"}]}, {"key":"chooser", "label":"Chosen by", "control":"ADMIN_FORM_CONTROL_SELECT", "options":[{"value":"admin", "label":"Admin"}, {"value":"requester", "label":"Requester"}, {"value":"approver", "label":"Admin on approval"}]}, {"key":"allow", "label":"Let requesters choose", "control":"ADMIN_FORM_CONTROL_SWITCH"}, @@ -272,6 +273,7 @@ func TestLoadRequestRouterRejectsBadRequesterOptions(t *testing.T) { "unknown field": {`{"field":"folder"}`, "must be a select with dynamic_options"}, "static select": {`{"field":"mode"}`, "must be a select with dynamic_options"}, "not a select": {`{"field":"name"}`, "must be a select with dynamic_options"}, + "numeric select": {`{"field":"level"}`, "must be a string property"}, "unknown media type": {`{"field":"profile", "media_type":"tv"}`, "media_type"}, "listed twice": {`{"field":"profile", "media_type":"movie"}, {"field":"profile", "media_type":"movie"}`, "more than once"}, "all after one": {`{"field":"profile", "media_type":"movie"}, {"field":"profile"}`, "more than once"}, diff --git a/proto/silo/plugin/v1/request_router.proto b/proto/silo/plugin/v1/request_router.proto index 3c581bf..589f917 100644 --- a/proto/silo/plugin/v1/request_router.proto +++ b/proto/silo/plugin/v1/request_router.proto @@ -90,7 +90,9 @@ message RequestRouterDescriptor { message RequesterOption { // field is the config key the requester sets. It must name a select field // of the capability's admin form that has dynamic_options, so the host has - // a list to offer and to check a pick against. + // a list to offer and to check a pick against. Its json_schema property + // must be a string: a pick is a ConfigOption value, and the host sets it + // as that string. string field = 1; // media_type limits the option to requests of one media type: "movie" or // "series". Empty offers it for both.