{ "_comment": "Error codes and descriptions for the API Response Validator plugin.", "error_codes": [ { "code": "SCHEMA_VALIDATION_FAILED", "description": "The API response failed validation against the provided JSON Schema.", "details": { "_comment": "Example details structure. 'errors' will contain schema validation errors.", "errors": [ { "dataPath": ".data.id", "schemaPath": "#/properties/id/type", "keyword": "type", "message": "should be string" } ] }, "severity": "ERROR", "resolution": "Review the API response and the JSON Schema to identify and correct any discrepancies. Ensure data types and required fields match the schema definition." }, { "code": "OPENAPI_VALIDATION_FAILED", "description": "The API response failed validation against the OpenAPI specification.", "details": { "_comment": "Example details structure. 'errors' will contain OpenAPI validation errors.", "errors": [ { "message": "Response body does not conform to schema for 200 response." } ], "operationId": "getUserById", "path": "/users/{userId}", "method": "GET" }, "severity": "ERROR", "resolution": "Review the API response and the OpenAPI specification to identify and correct any discrepancies. Check for missing or incorrect data types, required fields, and response codes." }, { "code": "CONTRACT_VALIDATION_FAILED", "description": "The API response failed validation against the custom contract rules.", "details": { "_comment": "Example details structure. 'failed_rules' contains information about the failed custom rules.", "failed_rules": [ { "rule_name": "response_time_limit", "message": "Response time exceeded the allowed limit of 500ms. Actual time: 750ms", "actual_value": 750, "expected_value": 500 } ] }, "severity": "WARNING", "resolution": "Review the API response and the custom contract rules to identify and correct any discrepancies. Adjust the rules or the API implementation as needed." }, { "code": "MISSING_CONTENT_TYPE", "description": "The API response is missing the 'Content-Type' header.", "details": null, "severity": "WARNING", "resolution": "Ensure the API response includes the 'Content-Type' header to properly identify the response format." }, { "code": "INVALID_JSON", "description": "The API response body is not valid JSON.", "details": { "_comment": "Details might include the parsing error message.", "error_message": "Unexpected token '}' at position 10." }, "severity": "ERROR", "resolution": "Ensure the API response returns a valid JSON payload. Check for syntax errors and proper formatting." }, { "code": "UNEXPECTED_STATUS_CODE", "description": "The API returned an unexpected HTTP status code.", "details": { "expected_status_code": 200, "actual_status_code": 500 }, "severity": "WARNING", "resolution": "Verify the expected HTTP status code against the actual status code returned by the API. Investigate the API logs for potential errors." } ] }