core-lightning/doc/schemas/notification/connect.schema.json
Erik De Smedt 83cc6c44e0 msggen: Schema for ConnectNotification + collisions
The schema in the docs for the `ConnectNotification` was faulty.
I've already fix this in https://github.com/ElementsProject/lightning/pull/7085

The new schema is

```
{
  "connect" :  {
    "address" : {
      "address" : "127.0.0.1",
      "port" : 38012,
      "type" : "ipv4"
  },
  "direction" : "in",
  "id" : "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59"
  }
}
```

The `address` in the `connect` field will be encoded in protobuf as
`ConnectAddress`. However, this collides with the `ConnectAddress` that
is defined in the `connect` rpc-method.

This commit
- Updates the schema in `doc/schemas/notification/connect.json`
- Changes `msggen` to include an override to `PeerConnect` for any
  notification typename that starts with `Connect`

Both have an `address` field which is a composite type. This results in
naming collisions

schema's: Updated schema for connect-notification

schema for connect notification + overrides

Override ConnectAddress to `PeerConnectAddress` in protobuf
for notifications
2024-05-16 14:00:18 +02:00

114 lines
2.6 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"added": "v24.05",
"required" : [
"id",
"direction",
"address"
],
"properties": {
"id": {
"type": "pubkey",
"description" : "The id of the peer which sent the custom message",
"added" : "v24.05"
},
"direction": {
"type": "string",
"enum": [
"in",
"out"
],
"added" : "v24.05"
},
"address": {
"type": "object",
"description": "Address information (mainly useful if **direction** is *out*)",
"additionalProperties": true,
"added" : "v24.05",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"added" : "v24.05",
"enum": [
"local socket",
"ipv4",
"ipv6",
"torv2",
"torv3"
],
"description": "Type of connection (*torv2*/*torv3* only if **direction** is *out*)"
}
},
"allOf": [
{
"if": {
"properties": {
"type": {
"type": "string",
"added" : "v24.05",
"enum": [
"local socket"
]
}
}
},
"then": {
"additionalProperties": false,
"required": [
"socket"
],
"properties": {
"type": {},
"socket": {
"type": "string",
"added" : "v24.05",
"description": "socket filename"
}
}
}
},
{
"if": {
"properties": {
"type": {
"type": "string",
"added" : "v24.05",
"enum": [
"ipv4",
"ipv6",
"torv2",
"torv3"
]
}
}
},
"then": {
"additionalProperties": false,
"required": [
"address",
"port"
],
"properties": {
"type": {},
"address": {
"type": "string",
"added" : "v24.05",
"description": "address in expected format for **type**"
},
"port": {
"type": "u16",
"added" : "v24.05",
"description": "port number"
}
}
}
}
]
}
}
}