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

add response type hints to micro responses #183

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions adr/ADR-32.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ Services should respond to:
All discovery and status responses contain the following fields:

```typescript
/**
* An identifier of the message type for example io.nats.micro.v1.stats
*/
type: string,
aricart marked this conversation as resolved.
Show resolved Hide resolved
/**
* The kind of the service reporting the status
*/
Expand All @@ -115,6 +119,7 @@ Returns a JSON having the following structure:

```typescript
{
type: string,
name: string,
id: string,
version: string,
Expand All @@ -137,12 +142,15 @@ All the fields above map 1-1 to the metadata provided when the service was
created. Note that `subject` is the subject that the service is listening for
requests on.

The type for this is `io.nats.micro.v1.info_response`.

### PING

Returns the following schema (the standard response fields)

```typescript
{
type: string,
name: string,
id: string,
version: string,
Expand All @@ -152,13 +160,16 @@ Returns the following schema (the standard response fields)
The intention of `PING` is for clients to calculate RTT to a service and
discover services.

The type for this is `io.nats.micro.v1.ping_response`.

### SCHEMA

Returns a JSON having the following structure. Note that the `schema` struct is
only returned if the `schema` was specified when created.

```typescript
{
type: string,
name: string,
id: string,
version: string,
Expand All @@ -178,6 +189,8 @@ only returned if the `schema` was specified when created.
}
```

The type for this is `io.nats.micro.v1.schema_response`.

### STATS

```typescript
Expand Down Expand Up @@ -216,6 +229,8 @@ only returned if the `schema` was specified when created.
}
```

The type for this is `io.nats.micro.v1.stats_response`.
ripienaar marked this conversation as resolved.
Show resolved Hide resolved

## Error Handling

Services may communicate request errors back to the client as they see fit, but
Expand Down