C. Response code 200 should be a string '200', not a number
D. Path should start with a capital letter
Solution
Step 1: Check response code format
OpenAPI requires response codes as strings, e.g., '200', not numbers.
Step 2: Verify other fields
Summary is allowed; requestBody is optional; path case is flexible.
Final Answer:
Response code 200 should be a string '200', not a number -> Option C
Quick Check:
Response codes must be strings [OK]
Hint: Always quote response codes as strings in YAML [OK]
Common Mistakes:
Using numeric response codes
Assuming requestBody is mandatory
Thinking summary is invalid
5. You want to document an API that returns a list of products with optional filtering by category. Which OpenAPI feature helps you define the optional category filter parameter for the GET /products endpoint?
hard
A. Use a query parameter with required: false under the GET method
B. Add a path parameter named category in the URL
C. Include category in the requestBody schema
D. Define category as a header parameter
Solution
Step 1: Understand parameter types
Optional filters are usually query parameters, not path or header parameters.
Step 2: Define optional query parameter
Set required: false for the category query parameter under GET.
Final Answer:
Use a query parameter with required: false under the GET method -> Option A
Quick Check:
Optional filters = query params with required false [OK]
Hint: Filters usually go as optional query parameters [OK]
Common Mistakes:
Using path parameters for optional filters
Putting filters in requestBody for GET
Defining filters as headers
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.