Commit bda0d65
OpenAPI - Distinguish between stored procedure parameters and result set columns (#1551)
## Why make this change?
- Closes #1509
## What is this change?
- The OpenApiDocumentor service now correctly distinguishes between
input parameters and result set columns when documenting a stored
procedures REST endpoint. Previously, only the result set columns were
resolved. As a result, the OpenApi document that is generated now shows
input parameters as fields to be used in the request bodies of POST,
PUT, and PATCH. (GET and DELETE have no request bodies).
## How was this tested?
- [x] Integration Tests - Added tests with additional stored procedures
in our sql deployment script which demonstrates how parameters and
output result set columns (and their JSON data types) are resolved and
included in the open api doc.
## OpenAPI document example
An example OpenAPI document which helps visualize how the parsing works.
Irrelevant fields were removed.
```json
{
"openapi": "3.0.1",
"paths": {
"/sp1": {
"get": {"..."},
"post": {
"tags": [
"sp1"
],
"description": "Executes a stored procedure.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/sp1_sp_request"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": {
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/components/schemas/sp1_sp_response"
}
}
}
}
}
}
},
"400": {
"description": "BadRequest"
}
}
}
}
},
"components": {
"schemas": {
"sp1_sp_request": {
"type": "object",
"properties": {
"inputName": {
"type": "string",
"format": ""
}
}
},
"sp1_sp_response": {
"type": "object",
"properties": {
"outputName": {
"type": "string",
"format": ""
}
}
}
}
}
}
```
---------
Co-authored-by: Aniruddh Munde <[email protected]>1 parent 7c20fe2 commit bda0d65
File tree
9 files changed
+457
-42
lines changed- src
- Core/Services/OpenAPI
- Service.Tests
- Configuration
- OpenApiDocumentor
- Service/Controllers
9 files changed
+457
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| 82 | + | |
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
1709 | 1710 | | |
1710 | 1711 | | |
1711 | 1712 | | |
1712 | | - | |
| 1713 | + | |
1713 | 1714 | | |
1714 | 1715 | | |
1715 | 1716 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
Lines changed: 340 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
0 commit comments