Skip to content

Commit

Permalink
Update spec
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Sep 12, 2024
1 parent b6f92b9 commit 79d6741
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion docs/ballerina-to-oas/spec/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,26 @@ parameters:
nullable: true
```

The query parameter name in the schema is defaulted to the Ballerina parameter name. But this can be overridden using the `@http:Query` annotation.

```ballerina
service /api on new http:Listener(9090) {
resource function get path(@http:Query{name: "userName"} string param) {
// ...
}
}
```

```yml
parameters:
- name: userName
in: query
required: true
schema:
type: string
```

If the query parameter type is a `map` or `record` with `anydata` fields, then the query parameter schema is wrapped with `content` and `application/json` to indicate that the query parameter should be a JSON object which should be encoded properly.

```ballerina
Expand Down Expand Up @@ -836,6 +856,27 @@ parameters:
nullable: true
```

The header parameter name in the schema is defaulted to the Ballerina parameter name. But this can be overridden using the `@http:Header` annotation.

```ballerina
service /api on new http:Listener(9090) {
resource function get path(@http:Header{name: "xApiKeys"} string[] param) {
// ...
}
}
```

```yml
parameters:
- name: xApiKeys
in: header
schema:
type: array
items:
type: string
```

Additionally, the header parameter can be a closed `record` which contains the above basic types as fields. In that case, each field of this record represents a header parameter.

```ballerina
Expand Down Expand Up @@ -1029,7 +1070,7 @@ additionalProperties: false
</td>
</tr>
<tr>
<td><code>string:Char<code></td>
<td><code>string:Char</code></td>
<td>

```yml
Expand Down

0 comments on commit 79d6741

Please sign in to comment.