Reducing prescription re language mapping

This commit is contained in:
fryorcraken 2025-06-24 13:03:22 +10:00
parent d5c688a327
commit 95ebcd9ea0
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4

View File

@ -61,7 +61,10 @@ An alternative would be to choose a programming language. However, such choice m
- `struct`: object and other nested types - `struct`: object and other nested types
- `option`: a value that can be set or left null - `option`: a value that can be set or left null
- `array`: iterable object containing values of all the same type - `array`: iterable object containing values of all the same type
- `Multiaddr`: a libp2p multiaddress; may be an object or a string, most idiomatic approach depending on the language - `multiaddr`: a libp2p multiaddress; may be an object or a string, most idiomatic approach depending on the language
- `result`: an enum type that either contain a return value (success), or an error (failure). The error is left to the implementor
- `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language.
- The first parameter of a function MAY be considered as the object on which a method is called. It is left to the implementor on whether an objective programming approach is idiomatic to the language.
### Application ### Application
@ -85,28 +88,22 @@ language_mappings:
- functions: "snake_case" - functions: "snake_case"
- variables: "snake_case" - variables: "snake_case"
- types: "PascalCase" - types: "PascalCase"
error_handling: "Result<T, E>"
async_pattern: "tokio"
golang: golang:
naming_convention: naming_convention:
- functions: "snake_case" - functions: "snake_case"
- variables: "snake_case" - variables: "snake_case"
- types: "PascalCase" - types: "PascalCase"
error_handling: "error_return"
package_name: "waku"
c: c:
naming_convention: "snake_case" naming_convention: "snake_case"
prefix: "waku_" prefix: "waku_"
error_handling: "error_codes"
typescript: typescript:
naming_convention: naming_convention:
- functions: "camelCase" - functions: "camelCase"
- variables: "camelCase" - variables: "camelCase"
- types: "PascalCase" - types: "PascalCase"
error_handling: "Promise<T>"
module_type: "esm" module_type: "esm"
``` ```
@ -115,6 +112,10 @@ language_mappings:
```yaml ```yaml
types: types:
WakuNode:
type: struct
description: "A Waku node instance."
Config: Config:
type: struct type: struct
fields: fields:
@ -166,18 +167,16 @@ types:
### Initialise Waku Node ### Initialise Waku Node
TODO: define WakuNode?
```yaml ```yaml
functions: functions:
init: init:
description: "Initialise the waku node" description: "Initialise a Waku node instance"
parameters: parameters:
- name: config - name: config
type: Config type: Config
description: "The Waku node configuration." description: "The Waku node configuration."
returns: returns:
type: result<void, string> type: result<WakuNode, error>
``` ```
#### Functionality / Additional Information / Specific Behaviours #### Functionality / Additional Information / Specific Behaviours
@ -196,7 +195,7 @@ If the node is configured in `relay` mode, it MUST:
- Serve the [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) protocol. - Serve the [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) protocol.
`edge` mode SHOULD be used if node functions in resource restricted environment, `edge` mode SHOULD be used if node functions in resource restricted environment,
whereas `relay` SHOULD be used if node has no hard restrictions. whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restrictions.
#### Default Values #### Default Values