{ "description": "", "formats": [ "oas2", "oas3", "oas3.0", "oas3.1" ], "aliases": { "API_Document": { "description": "The complete API specification document. This can be used to target any part of the OpenAPI document using **field**.\n\n*Use this if you don't find specific targets that cater to your usecase.* ", "targets": [ { "formats": [ "oas2" ], "given": [ "$" ] }, { "formats": [ "oas3" ], "given": [ "$" ] } ] }, "API_Description": { "description": "The top level description in an API document", "targets": [ { "formats": [ "oas2" ], "given": [ "$.info.description" ] }, { "formats": [ "oas3" ], "given": [ "$.info.description" ] } ] }, "Operation_Object": { "description": "The complete operation object. Use it in combo with field object.", "targets": [ { "formats": [ "oas2" ], "given": [ "#Path_Item[get,put,post,delete,options,head,patch,trace]" ] }, { "formats": [ "oas3" ], "given": [ "#Path_Item[get,put,post,delete,options,head,patch,trace]" ] } ] }, "Operation_Responses": { "description": "Responses for all operations including get, put, post, delete, options, head, patch, trace.", "targets": [ { "formats": [ "oas2" ], "given": [ "#Operation_Object.responses" ] }, { "formats": [ "oas3" ], "given": [ "#Operation_Object.responses" ] } ] }, "Path_Item": { "description": "", "targets": [ { "formats": [ "oas2" ], "given": [ "$.paths[*]" ] }, { "formats": [ "oas3" ], "given": [ "$.paths[*]" ] } ] }, "API_Contact": { "description": "The top level description in an API document", "targets": [ { "formats": [ "oas2" ], "given": [ "$.info.contact" ] }, { "formats": [ "oas3" ], "given": [ "$.info.contact" ] } ] }, "API_License": { "description": "The top level description in an API document", "targets": [ { "formats": [ "oas2" ], "given": [ "$.info.license" ] }, { "formats": [ "oas3" ], "given": [ "$.info.license" ] } ] }, "All_Markdown": { "description": "All markdown descriptions across the document.", "targets": [ { "formats": [ "oas2" ], "given": [ "$..[description,title]" ] }, { "formats": [ "oas3" ], "given": [ "$..[description,title]" ] } ] }, "API_Tags": { "description": "Tags on an API object", "targets": [ { "formats": [ "oas2" ], "given": [ "#Operation_Object.tags" ] }, { "formats": [ "oas3" ], "given": [ "#Operation_Object.tags" ] } ] }, "API_Server": { "description": "API hosts defined in the API specification", "targets": [ { "formats": [ "oas3" ], "given": [ "$.servers" ] }, { "formats": [ "oas2" ], "given": [ "$.host" ] } ] }, "Response_All_Object": { "description": "All responses (object) in an API", "targets": [ { "formats": [ "oas2" ], "given": [ "$.responses", "#Operation_Responses", "$..responses" ] }, { "formats": [ "oas3" ], "given": [ "$.components.responses", "#Operation_Responses", "$..responses" ] } ] }, "API_Server_URL": { "description": "API host urls defined in the API specification", "targets": [ { "formats": [ "oas3" ], "given": [ "$.servers[*].url" ] }, { "formats": [ "oas2" ], "given": [ "$.host" ] } ] }, "All_Ref": { "description": "All references throughout the API", "targets": [ { "formats": [ "oas2" ], "given": [ "$..[?(@property === '$ref')]" ] }, { "formats": [ "oas3" ], "given": [ "$..[?(@property === '$ref')]" ] } ] }, "All_Enum": { "description": "All references throughout the API", "targets": [ { "formats": [ "oas2" ], "given": [ "$..[?(@ && @.enum && @.type)]" ] }, { "formats": [ "oas3" ], "given": [ "$..[?(@ && @.enum && @.type)]" ] } ] }, "Request_Parameter_All": { "description": "All request parameters", "targets": [ { "formats": [ "oas2" ], "given": [ "$..parameters[*]" ] }, { "formats": [ "oas3" ], "given": [ "$..parameters[*]" ] } ] }, "Request_Parameter_Query": { "description": "All request query parameters", "targets": [ { "formats": [ "oas2" ], "given": [ "$..parameters[?(@.in==\"query\")]" ] }, { "formats": [ "oas3" ], "given": [ "$..parameters[?(@.in==\"query\")]" ] } ] }, "Request_Parameter_Header": { "description": "All request header parameters", "targets": [ { "formats": [ "oas2" ], "given": [ "$..parameters[?(@.in==\"header\")]" ] }, { "formats": [ "oas3" ], "given": [ "$..parameters[?(@.in==\"header\")]" ] } ] }, "Request_Parameter_Cookie": { "description": "All request cookie parameters", "targets": [ { "formats": [ "oas2" ], "given": [ "$..parameters[?(@.in==\"cookie\")]" ] }, { "formats": [ "oas3" ], "given": [ "$..parameters[?(@.in==\"cookie\")]" ] } ] }, "Request_Parameter_Path": { "description": "All request path parameters", "targets": [ { "formats": [ "oas2" ], "given": [ "$..parameters[?(@.in==\"path\")]" ] }, { "formats": [ "oas3" ], "given": [ "$..parameters[?(@.in==\"path\")]" ] } ] }, "Path_Object": { "description": "Path object. Usually used to target the Path key e.g. `/users/{userId}`", "targets": [ { "formats": [ "oas2" ], "given": [ "$.paths" ] }, { "formats": [ "oas3" ], "given": [ "$.paths" ] } ] }, "All_Example_Schema": { "description": "All examples for schemas", "targets": [ { "formats": [ "oas2" ], "given": [ "$..definitions..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]", "$..parameters..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]", "$..responses..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]" ] }, { "formats": [ "oas3" ], "given": [ "$.components.schemas..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]", "$..content..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]", "$..headers..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]", "$..parameters..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]" ] } ] }, "API_Document_RecursiveSearch": { "description": "The complete API specification document. This can be used to target any part of the OpenAPI document using **field**.\n\n*Use this if you don't find specific targets that cater to your usecase.* ", "targets": [ { "formats": [ "oas2" ], "given": [ "$.." ] }, { "formats": [ "oas3" ], "given": [ "$.." ] } ] }, "All_Example": { "description": "All examples across the API document", "targets": [ { "formats": [ "oas2" ], "given": [ "$..examples[*]" ] }, { "formats": [ "oas3" ], "given": [ "$.components.examples[*]", "$.paths[*][*]..content[*].examples[*]", "$.paths[*][*]..parameters[*].examples[*]", "$.components.parameters[*].examples[*]", "$.paths[*][*]..headers[*].examples[*]", "$.components.headers[*].examples[*]" ] } ] }, "All_Example_Media": { "description": "All examples for schemas", "targets": [ { "formats": [ "oas2" ], "given": [ "$..responses..[?(@ && @.schema && @.examples)]" ] }, { "formats": [ "oas3" ], "given": [ "$..content..[?(@ && @.schema && (@.example !== void 0 || @.examples))]", "$..headers..[?(@ && @.schema && (@.example !== void 0 || @.examples))]", "$..parameters..[?(@ && @.schema && (@.example !== void 0 || @.examples))]" ] } ] }, "API_Tags_Item": { "description": "Tags on an API object", "targets": [ { "formats": [ "oas2" ], "given": [ "$.tags[*]" ] }, { "formats": [ "oas3" ], "given": [ "$.tags[*]" ] } ] } }, "rules": { "contact-url": { "given": [ "#API_Contact" ], "severity": "warn", "then": { "function": "truthy", "field": "url" }, "description": "The `contact` object should have a valid organization URL. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"contact\": {\r\n ... ,\r\n \"url\": \"https://acme.com\",\r\n ... \r\n},\r\n```", "message": "Contact object should have \"url\"." }, "contact-email": { "given": [ "#API_Contact" ], "severity": "warn", "then": { "function": "truthy", "field": "email" }, "description": "The `contact` object should have a valid email. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"contact\": {\r\n ... ,\r\n ... ,\r\n \"email\": \"support.contact@acme.com\"\r\n},\r\n```", "message": "Contact object should have \"email\"" }, "info-contact": { "given": [ "#API_Document" ], "severity": "warn", "then": { "function": "truthy", "field": "info.contact" }, "description": "The `info' object should include a `contact` object.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"info\": {\r\n ... ,\r\n ... ,\r\n \"contact\": {\r\n \"name\": \"ACME Corporation\",\r\n \"url\": \"https://acme.com\",\r\n \"email\": \"support.contact@acme.com\"\r\n }\r\n } \r\n}\r\n```", "message": "Info object should have \"contact\" object." }, "info-description": { "given": [ "#API_Document" ], "severity": "warn", "then": { "function": "truthy", "field": "info.description" }, "description": "The `info` object should have a `description` object.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"info\": {\r\n ... ,\r\n ... ,\r\n \"description\": \"This describes my API.\",\r\n ... \r\n }\r\n } \r\n}\r\n```", "message": "Info object should have \"description\" object." }, "info-license": { "given": [ "#API_Document" ], "severity": "warn", "then": { "function": "truthy", "field": "info.license" }, "description": "The `info` object should have a `license` object. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"info\": {\r\n ... ,\r\n ... ,\r\n \"license\": {\r\n \"name\": \"Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)\",\r\n \"url\": \"https://creativecommons.org/licenses/by-sa/4.0/\"\r\n }\r\n } \r\n}\r\n```", "message": "Info object should have \"license\" object." }, "license-url": { "given": [ "#API_License" ], "severity": "warn", "then": { "function": "truthy", "field": "url" }, "description": "The `license` object should include a valid url.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"license\": {\r\n \"name\": \"Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)\",\r\n \"url\": \"https://creativecommons.org/licenses/by-sa/4.0/\"\r\n }\r\n}\r\n```", "message": "License object should include \"url\"." }, "no-eval-in-markdown": { "given": [ "#All_Markdown" ], "severity": "warn", "then": { "function": "pattern", "functionOptions": { "notMatch": "eval\\(" } }, "description": "Markdown descriptions should not contain [`eval()` functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval), which pose a security risk. \r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"info\": {\r\n ... ,\r\n ... , \r\n \"description\": \"API for users. eval()\"", "message": "Markdown descriptions must not have \"eval(\"." }, "no-script-tags-in-markdown": { "given": [ "#All_Markdown" ], "severity": "warn", "then": { "function": "pattern", "functionOptions": { "notMatch": "alert(\"You are Hacked\");',\"\r\n```", "message": "Markdown descriptions must not have \"