MCPcopy Create free account
hub / github.com/baerwang/openapi-rs / demonstrate_query_method

Function demonstrate_query_method

examples/openapi_32_features.rs:268–361  ·  view source on GitHub ↗

Demonstrates the QUERY HTTP method

()

Source from the content-addressed store, hash-verified

266
267/// Demonstrates the QUERY HTTP method
268fn demonstrate_query_method() -> Result<()> {
269 let query_method_yaml = r#"
270openapi: 3.2.0
271info:
272 title: Resource Query API
273 summary: Demonstrates QUERY HTTP method
274 version: '1.0.0'
275paths:
276 /users:
277 get:
278 summary: List users (simple)
279 parameters:
280 - name: status
281 in: query
282 schema:
283 type: string
284 responses:
285 '200':
286 description: OK
287 query:
288 summary: Complex user query
289 description: Execute complex queries with filtering, sorting, and aggregation
290 operationId: queryUsers
291 parameters:
292 - name: include
293 in: query
294 schema:
295 type: array
296 items:
297 type: string
298 requestBody:
299 required: true
300 description: Query DSL
301 content:
302 application/json:
303 schema:
304 type: object
305 properties:
306 filter:
307 type: object
308 sort:
309 type: array
310 items:
311 type: object
312 pagination:
313 type: object
314 responses:
315 '200':
316 description: Query results
317 "#;
318
319 let openapi: OpenAPI = OpenAPI::yaml(query_method_yaml)?;
320
321 println!(" Endpoint: /users");
322 println!();
323
324 let users_path = openapi.paths.get("/users").unwrap();
325

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected