Skip to content

Commit

Permalink
spec: Allow specifying service schema names & encodings (#563)
Browse files Browse the repository at this point in the history
Allows for customization of service schema names and schema encodings.

Partially fixes https://github.com/foxglove/studio/issues/6970 
Partially resolves FG-5280
  • Loading branch information
achim-k authored Nov 4, 2023
1 parent b904f81 commit 5635649
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,21 @@ Informs the client about available services. Only supported if the server declar
- `op`: string `"advertiseServices"`
- `services`: array of:
- `id`: number. The server may reuse ids when services disappear and reappear, but only if the services keeps the exact same name, type, and schema. Clients will use this unique id to cache schema info and deserialization routines.
- `name`: string
- `type`: string
- `requestSchema`: string
- `responseSchema`: string
- `name`: string, name used to identify the service.
- `type`: string, type of the service. May be used to derive request & response schema names if `request` or `response` are not given.
- `request`: object describing the request. Required if `requestSchema` is not given.
- `encoding`: string, type of encoding used for request message encoding.
- `schemaName`: string, name of the request schema.
- `schemaEncoding`: string, type of encoding used for schema encoding.
- `schema`: string, schema definition in a format matching the `schemaEncoding`.
- `response`: object describing the response. Required if `responseSchema` is not given.
- `encoding`: string, type of encoding used for response message encoding.
- `schemaName`: string, name of the response schema.
- `schemaEncoding`: string, type of encoding used for schema encoding.
- `schema`: string, schema definition in a format matching the `schemaEncoding`.
- `requestSchema`: string | undefined, request schema definition. The schema encoding will be derived from the [`supportedEncodings`](#server-info) sent by the server. Required if `request` is not given. Field is present for backwards compatibilty, prefer using `request` instead.
- `responseSchema`: string | undefined, response schema definition. The schema encoding will be derived from the [`supportedEncodings`](#server-info) sent by the server. Required if `response` is not given. Field is present for backwards compatibilty, prefer using `response` instead.


#### Example

Expand All @@ -218,9 +229,16 @@ Informs the client about available services. Only supported if the server declar
{
"id": 1,
"name": "foo",
"type": "std_srvs/srv/Empty",
"type": "std_srvs/Empty",
"requestSchema": "",
"responseSchema": ""
},
{
"id": 2,
"name": "set_bool",
"type": "std_srvs/SetBool",
"request": { "encoding": "ros1", "schemaName": "std_srvs/SetBool_Request", "schemaEncoding": "ros1msg", "schema": "bool data" },
"response": { "encoding": "ros1", "schemaName": "std_srvs/SetBool_Response", "schemaEncoding": "ros1msg", "schema": "bool success\nstring message" }
}
]
}
Expand Down

0 comments on commit 5635649

Please sign in to comment.