Commit daffcd6
authored
OpenAPI - Improved resolving of database types to json data types (#1568)
## Why make this change?
- Closes #1508
## What is this change?
- improves the mapping between SqlDbType <=> CLR/.NET Framwork (System)
types <=> JsonDataType so that OpenApi document generation resolves the
appropriate value types in REST endpoint result field value types and
input (request body) field value types.
- To view OpenApi document output, browse to the endpoint /swagger
### Before (Swagger view with default values based on resolved JSON data
type)
```json
{
"value": [
{
"typeid": 0,
"byte_types": "string",
"short_types": 0,
"int_types": 0,
"long_types": 0,
"string_types": "string",
"single_types": 0,
"float_types": 0,
"decimal_types": 0,
"boolean_types": true,
"date_types": "Unknown Type: undefined",
"datetime_types": "Unknown Type: undefined",
"datetime2_types": "Unknown Type: undefined",
"datetimeoffset_types": "Unknown Type: undefined",
"smalldatetime_types": "Unknown Type: undefined",
"bytearray_types": "string",
"guid_types": "string"
}
]
}
```
### After (Swagger view with default values based on resolved JSON data
type)
```json
{
"value": [
{
"typeid": 0,
"byte_types": "string",
"short_types": 0,
"int_types": 0,
"long_types": 0,
"string_types": "string",
"single_types": 0,
"float_types": 0,
"decimal_types": 0,
"boolean_types": true,
"date_types": "string",
"datetime_types": "string",
"datetime2_types": "string",
"datetimeoffset_types": "string",
"smalldatetime_types": "string",
"bytearray_types": "string",
"guid_types": "string"
}
]
}
```
## After: OpenApi document json
```json
"components": {
"schemas": {
"SupportedType": {
"type": "object",
"properties": {
"typeid": {
"type": "number",
"format": ""
},
"byte_types": {
"type": "string",
"format": ""
},
"short_types": {
"type": "number",
"format": ""
},
"int_types": {
"type": "number",
"format": ""
},
"long_types": {
"type": "number",
"format": ""
},
"string_types": {
"type": "string",
"format": ""
},
"single_types": {
"type": "number",
"format": ""
},
"float_types": {
"type": "number",
"format": ""
},
"decimal_types": {
"type": "number",
"format": ""
},
"boolean_types": {
"type": "boolean",
"format": ""
},
"date_types": {
"type": "string",
"format": ""
},
"datetime_types": {
"type": "string",
"format": ""
},
"datetime2_types": {
"type": "string",
"format": ""
},
"datetimeoffset_types": {
"type": "string",
"format": ""
},
"smalldatetime_types": {
"type": "string",
"format": ""
},
"bytearray_types": {
"type": "string",
"format": ""
},
"guid_types": {
"type": "string",
"format": ""
}
}
}
}
}
```
## How was this tested?
- [X] Unit Tests1 parent 6aad7db commit daffcd6
File tree
7 files changed
+318
-130
lines changed- src
- Core
- Models
- Services
- MetadataProviders
- OpenAPI
- Service.Tests
- Configuration
- OpenApiDocumentor
7 files changed
+318
-130
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
Lines changed: 4 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| |||
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
37 | | - | |
38 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 41 | + | |
88 | 42 | | |
89 | 43 | | |
90 | 44 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| 308 | + | |
308 | 309 | | |
309 | 310 | | |
310 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
556 | | - | |
| 556 | + | |
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
| |||
855 | 855 | | |
856 | 856 | | |
857 | 857 | | |
858 | | - | |
| 858 | + | |
859 | 859 | | |
860 | | - | |
| 860 | + | |
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
| 12 | + | |
11 | 13 | | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
| |||
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
66 | 60 | | |
67 | 61 | | |
68 | 62 | | |
| |||
82 | 76 | | |
83 | 77 | | |
84 | 78 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
100 | 117 | | |
101 | 118 | | |
102 | 119 | | |
103 | | - | |
104 | | - | |
105 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
106 | 124 | | |
107 | 125 | | |
108 | 126 | | |
109 | 127 | | |
110 | | - | |
| 128 | + | |
111 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
112 | 139 | | |
113 | 140 | | |
114 | 141 | | |
115 | 142 | | |
116 | 143 | | |
117 | | - | |
118 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
119 | 191 | | |
120 | 192 | | |
121 | 193 | | |
0 commit comments