Complete the code to specify the OpenAPI version in the specification.
{
"openapi": "[1]",
"info": {
"title": "Sample API",
"version": "1.0.0"
}
}The openapi field specifies the OpenAPI version. Version 3.0.0 is the correct format for OpenAPI 3 specifications.
Complete the code to define the HTTP method for the API path.
"paths": { "/users": { "[1]": { "summary": "Get list of users", "responses": { "200": { "description": "A JSON array of user names" } } } } }
The HTTP method get is used to retrieve data, such as a list of users.
Fix the error in the response content type definition.
"responses": { "200": { "description": "Successful response", "content": { "[1]": { "schema": { "type": "array", "items": { "type": "string" } } } } } }
The content type application/json is used for JSON responses, which is standard for APIs returning arrays of strings.
Fill both blanks to define a parameter for a path variable named 'userId' of type string.
"parameters": [ { "name": "[1]", "in": "[2]", "required": true, "schema": { "type": "string" } } ]
The parameter name is userId and it is located in the path of the URL.
Fill all three blanks to define a schema property named 'age' of type integer with a minimum value of 0.
"properties": { "[1]": { "type": "[2]", "minimum": [3] } }
The property name is age, its type is integer, and the minimum allowed value is 0.