Skip to content

Commit 1987e69

Browse files
authored
feat: simplify parameter object (#935)
1 parent 242c0f6 commit 1987e69

File tree

1 file changed

+27
-53
lines changed

1 file changed

+27
-53
lines changed

spec/asyncapi.md

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,48 +1014,34 @@ location: $message.header#/replyTo
10141014

10151015
#### <a name="parametersObject"></a>Parameters Object
10161016

1017-
Describes a map of parameters included in a channel name.
1017+
Describes a map of parameters included in a channel address.
10181018

1019-
This map MUST contain all the parameters used in the parent channel name.
1019+
This map MUST contain all the parameters used in the parent channel address.
10201020

10211021
##### Patterned Fields
10221022

10231023
Field Pattern | Type | Description
10241024
---|:---:|---
1025-
<a name="parametersObjectName"></a>`^[A-Za-z0-9_\-]+$` | [Parameter Object](#parameterObject) &#124; [Reference Object](#referenceObject) | The key represents the name of the parameter. It MUST match the parameter name used in the parent channel name.
1025+
<a name="parametersObjectName"></a>`^[A-Za-z0-9_\-]+$` | [Parameter Object](#parameterObject) &#124; [Reference Object](#referenceObject) | The key represents the name of the parameter. It MUST match the parameter name used in the parent channel address.
10261026

10271027
##### Parameters Object Example
10281028

10291029
```json
10301030
{
1031-
"user/{userId}/signup": {
1032-
"parameters": {
1033-
"userId": {
1034-
"description": "Id of the user.",
1035-
"schema": {
1036-
"type": "string"
1037-
}
1038-
}
1039-
},
1040-
"subscribe": {
1041-
"message": {
1042-
"$ref": "#/components/messages/userSignedUp"
1043-
}
1031+
"address": "user/{userId}/signedup",
1032+
"parameters": {
1033+
"userId": {
1034+
"description": "Id of the user."
10441035
}
10451036
}
10461037
}
10471038
```
10481039

10491040
```yaml
1050-
user/{userId}/signup:
1051-
parameters:
1052-
userId:
1053-
description: Id of the user.
1054-
schema:
1055-
type: string
1056-
subscribe:
1057-
message:
1058-
$ref: "#/components/messages/userSignedUp"
1041+
address: user/{userId}/signedup
1042+
parameters:
1043+
userId:
1044+
description: Id of the user.
10591045
```
10601046

10611047

@@ -1064,52 +1050,40 @@ user/{userId}/signup:
10641050

10651051
#### <a name="parameterObject"></a>Parameter Object
10661052

1067-
Describes a parameter included in a channel name.
1053+
Describes a parameter included in a channel address.
10681054

10691055
##### Fixed Fields
10701056

10711057
Field Name | Type | Description
10721058
---|:---:|---
1073-
<a name="parameterObjectDescription"></a>description | `string` | A verbose explanation of the parameter. [CommonMark syntax](https://spec.commonmark.org/) can be used for rich text representation.
1074-
<a name="parameterObjectSchema"></a>schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | Definition of the parameter.
1075-
location | `string` | A [runtime expression](#runtimeExpression) that specifies the location of the parameter value. Even when a definition for the target field exists, it MUST NOT be used to validate this parameter but, instead, the `schema` property MUST be used.
1059+
<a name="parameterObjectEnum"></a>enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set.
1060+
<a name="parameterObjectDefault"></a>default | `string` | The default value to use for substitution, and to send, if an alternate value is _not_ supplied.
1061+
<a name="parameterObjectDescription"></a>description | `string` | An optional description for the parameter. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
1062+
<a name="parameterObjectExamples"></a>examples | [`string`] | An array of examples of the parameter value.
1063+
<a name="parameterObjectLocation"></a>location | `string` | A [runtime expression](#runtimeExpression) that specifies the location of the parameter value.
10761064

10771065
This object MAY be extended with [Specification Extensions](#specificationExtensions).
10781066

10791067
##### Parameter Object Example
10801068

10811069
```json
10821070
{
1083-
"user/{userId}/signup": {
1084-
"parameters": {
1085-
"userId": {
1086-
"description": "Id of the user.",
1087-
"schema": {
1088-
"type": "string"
1089-
},
1090-
"location": "$message.payload#/user/id"
1091-
}
1092-
},
1093-
"subscribe": {
1094-
"message": {
1095-
"$ref": "#/components/messages/userSignedUp"
1096-
}
1071+
"address": "user/{userId}/signedup",
1072+
"parameters": {
1073+
"userId": {
1074+
"description": "Id of the user.",
1075+
"location": "$message.payload#/user/id"
10971076
}
10981077
}
10991078
}
11001079
```
11011080

11021081
```yaml
1103-
user/{userId}/signup:
1104-
parameters:
1105-
userId:
1106-
description: Id of the user.
1107-
schema:
1108-
type: string
1109-
location: $message.payload#/user/id
1110-
subscribe:
1111-
message:
1112-
$ref: "#/components/messages/userSignedUp"
1082+
address: user/{userId}/signedup
1083+
parameters:
1084+
userId:
1085+
description: Id of the user.
1086+
location: $message.payload#/user/id
11131087
```
11141088

11151089

0 commit comments

Comments
 (0)