Skip to content

Commit

Permalink
rpctypes: Add type hints definition (#51)
Browse files Browse the repository at this point in the history
* rpctypes: Add type hints definition

The type hints definition should be used to hint on the expected
parameter and result of the methods. It is designed to be parsed by
decision tree.

This commit also defines parameter and result type for all common RPC
methods definitions. It is included in the single table as a reference
for the 'dir' description of that method. The signals are also described
this way and thus their description united across the documentation.

The 'dir' method's result now directly references type descriptions as
the format to be used.

* rpctypes: add grammar

This makes the format more concrete and exact. It can also be used as a
reference for the parser implementation.

* github/workflow: remove fix-pagetoc branch condition

This was introduced in 9dba97e and is
clearly a left over from debugging.

* rpcmethods/broker: fix subscriptions listing examples

The old list based way of providing subscriptions was left in the
examples when we switched the format to the Map. This fixes these
examples.

This also fixes the documentation for the subscription field of
.broker/currentClient:info.

* rpcmethods/broker: convert client info from Map to IMap

This is incompatible change!

We do this because this way the API is consistent with others (such as
`*:dir`).

The effect should be minimal because this API is intended to be used by
broker administrators and not by applications. It might be used in some
test scenarios and thus those will be affected but this change might
benefit them more than not doing this change.
  • Loading branch information
Cynerd authored Jan 21, 2025
1 parent 54093b9 commit ffb964e
Show file tree
Hide file tree
Showing 11 changed files with 690 additions and 392 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mdbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Deploy mdBook site to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master", "fix-pagetoc"]
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
- [ChainPack](./chainpack.md)
- [CPON](./cpon.md)
- [RPC Message](./rpcmessage.md)
- [Complex RPC Types](./shv-types.md)
- [Common RPC methods](./rpcmethods.md)
- [Login sequence](./rpcmethods/login.md)
- [Discovering SHV paths and methods](./rpcmethods/discovery.md)
Expand All @@ -17,11 +16,12 @@
- [File nodes](./rpcmethods/file.md)
- [Bytes Exchange nodes](./rpcmethods/exchange.md)
- [History](./rpcmethods/history.md)
- [Types descriptions](./rpctypes.md)
- [RPC RI](./rpcri.md)
- [RPC Transport layers](./rpctransportlayer.md)
- [Stream transport layers](./rpctransportlayer/stream.md)
- [CAN Bus](./rpctransportlayer/can.md)
- [RPC URL](./rpcurl.md)
- [RPC RI](./rpcri.md)
- [Implementations](./implementations.md)
- [Tools](./tools.md)

Expand Down
60 changes: 18 additions & 42 deletions src/rpcmethods/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,103 +7,83 @@ than just a few requests.

## `.app:shvVersionMajor`

| Name | SHV Path | Flags | Access |
|-------------------|----------|--------|--------|
| `shvVersionMajor` | `.app` | Getter | Browse |
| Name | SHV Path | Flags | Param Type | Result Type | Access |
|-------------------|----------|--------|------------|-------------|--------|
| `shvVersionMajor` | `.app` | Getter | | `i` | Browse |

This method provides information about implemented SHV standard. Major version
number signal major changes in the standard and thus you are most likely
interested just in this number.

| Parameter | Result |
|-----------|--------|
| Null | Int |

```
=> <id:42, method:"shvVersionMajor", path:".app">i{}
<= <id:42>i{2:0}
```

## `.app:shvVersionMinor`

| Name | SHV Path | Flags | Access |
|-------------------|----------|--------|--------|
| `shvVersionMinor` | `.app` | Getter | Browse |
| Name | SHV Path | Flags | Param Type | Result Type | Access |
|-------------------|----------|--------|------------|-------------|--------|
| `shvVersionMinor` | `.app` | Getter | | `i` | Browse |

This method provides information about implemented SHV standard. Minor version
number signals new features added and thus if you wish to check for support of
these additions you can use this number.

| Parameter | Result |
|-----------|--------|
| Null | Int |

```
=> <id:42, method:"shvVersionMinor", path:".app">i{}
<= <id:42>i{2:1}
```

## `.app:name`

| Name | SHV Path | Flags | Access |
|--------|----------|--------|--------|
| `name` | `.app` | Getter | Browse |
| Name | SHV Path | Flags | Param Type | Result Type | Access |
|--------|----------|--------|------------|-------------|--------|
| `name` | `.app` | Getter | | `s` | Browse |

This method must provide the name of the application, or at least the SHV
implementation used in the application.

| Parameter | Result |
|-----------|--------|
| Null | String |

```
=> <id:42, method:"name", path:".app">i{}
<= <id:42>i{2:"SomeApp"}
```

## `.app:version`

| Name | SHV Path | Flags | Access |
|-----------|----------|--------|--------|
| `version` | `.app` | Getter | Browse |
| Name | SHV Path | Flags | Param Type | Result Type | Access |
|-----------|----------|--------|------------|-------------|--------|
| `version` | `.app` | Getter | | `s` | Browse |

This method must provide the application version, or at least the SHV
implementation used in the application (must be consistent with information in
`.app:appName`).

| Parameter | Result |
|-----------|--------|
| Null | String |

```
=> <id:42, method:"version", path:".app">i{}
<= <id:42>i{2:"1.4.2-s5vehx"}
```

## `.app:ping`

| Name | SHV Path | Flags | Access |
|--------|----------|-------|--------|
| `ping` | `.app` | | Browse |
| Name | SHV Path | Flags | Param Type | Result Type | Access |
|--------|----------|-------|------------|-------------|--------|
| `ping` | `.app` | | | | Browse |

This method should reliably do nothing and should always be successful. It is
used to check the connection (if message can be passed to and from client) as
well as to keep connection in case of SHV Broker.

| Parameter | Result |
|-----------|--------|
| Null | Null |

```
=> <id:42, method:"ping", path:".app">i{}
<= <id:42>i{}
```

## `.app:date`

| Name | SHV Path | Flags | Access |
|--------|----------|-------|--------|
| `date` | `.app` | | Browse |
| Name | SHV Path | Flags | Param Type | Result Type | Access |
|--------|----------|-------|------------|-------------|--------|
| `date` | `.app` | | | `t` | Browse |

This is an optional method that provides access to the date and time this
application is using (that includes time zone). Applications running on systems
Expand All @@ -120,10 +100,6 @@ Note that there is unspecified overhead of SHV RPC network in up to seconds for
transferring messages and thus precision of comparison with local time must
consider this.

| Parameter | Result |
|-----------|----------|
| Null | DateTime |

```
=> <id:42, method:"date", path:".app">i{}
<= <id:42>i{2:d"2017-05-03T15:52:31.123"}
Expand Down
Loading

0 comments on commit ffb964e

Please sign in to comment.