Demonstrates the querystring parameter type
()
| 166 | |
| 167 | /// Demonstrates the querystring parameter type |
| 168 | fn demonstrate_querystring_parameter() -> Result<()> { |
| 169 | let querystring_yaml = r#" |
| 170 | openapi: 3.2.0 |
| 171 | info: |
| 172 | title: Advanced Search API |
| 173 | summary: Complex search with structured parameters |
| 174 | version: '1.0.0' |
| 175 | paths: |
| 176 | /search: |
| 177 | get: |
| 178 | summary: Advanced search |
| 179 | parameters: |
| 180 | - name: filter |
| 181 | in: querystring |
| 182 | description: Complex filter object |
| 183 | required: false |
| 184 | content: |
| 185 | application/json: |
| 186 | schema: |
| 187 | type: object |
| 188 | properties: |
| 189 | status: |
| 190 | type: string |
| 191 | price: |
| 192 | type: object |
| 193 | properties: |
| 194 | min: |
| 195 | type: number |
| 196 | max: |
| 197 | type: number |
| 198 | - name: sort |
| 199 | in: querystring |
| 200 | description: Sort criteria |
| 201 | required: false |
| 202 | content: |
| 203 | application/json: |
| 204 | schema: |
| 205 | type: array |
| 206 | items: |
| 207 | type: object |
| 208 | properties: |
| 209 | field: |
| 210 | type: string |
| 211 | direction: |
| 212 | type: string |
| 213 | enum: [asc, desc] |
| 214 | - name: format |
| 215 | in: query |
| 216 | description: Response format |
| 217 | schema: |
| 218 | type: string |
| 219 | enum: [json, xml] |
| 220 | responses: |
| 221 | '200': |
| 222 | description: OK |
| 223 | "#; |
| 224 | |
| 225 | let openapi: OpenAPI = OpenAPI::yaml(querystring_yaml)?; |