4. What is the operationId mainly used for?
- Choosing the HTTP method
- Setting the server URL
- Uniquely identifying an operation, for example as method names in generated code
- Defining security
Show answer
Answer: Uniquely identifying an operation, for example as method names in generated code
operationIds are unique identifiers that tools use for naming and linking.
Lesson: Paths and Operations
5. Which statement about path parameters in OpenAPI is true?
- They are optional by default
- They must be marked required: true and appear in the path template
- They are placed in the request body
- They cannot have a schema
Show answer
Answer: They must be marked required: true and appear in the path template
Path parameters are always required and must match a template variable in the path.
Lesson: Parameters: Path, Query, Header and Cookie
6. How are status codes written as keys in an OpenAPI responses object?
- As strings such as '200' or ranges such as '4XX', plus an optional default
- As unquoted numbers only
- As HTTP reason phrases
- They are not part of responses
Show answer
Answer: As strings such as '200' or ranges such as '4XX', plus an optional default
Response keys are status code strings, ranges like 4XX, or default.
Lesson: Request Bodies, Responses and Status Codes