2868 lines
382 KiB
JSON
2868 lines
382 KiB
JSON
{
|
|
"name": "Seasonedshows",
|
|
"description": "",
|
|
"spectralExtends": [],
|
|
"formats": [
|
|
"oas2",
|
|
"oas3",
|
|
"oas3.0",
|
|
"oas3.1"
|
|
],
|
|
"aliases": {},
|
|
"rules": {},
|
|
"extends": [
|
|
"cHJqOjEyMzU4Ng@34"
|
|
],
|
|
"extendedStyleguides": [
|
|
{
|
|
"id": "cHJqOjEyMzU4Ng",
|
|
"name": "Stoplight Style Guide",
|
|
"slug": "stoplight-style-guide",
|
|
"workspace": {
|
|
"slug": "apistylebook",
|
|
"name": "API Stylebook"
|
|
},
|
|
"icon": "robot",
|
|
"color": "#3898ff",
|
|
"description": "Default rules for Stoplight projects",
|
|
"latestRelease": {
|
|
"release": 34
|
|
}
|
|
}
|
|
],
|
|
"inheritedRules": [
|
|
{
|
|
"given": [
|
|
"#API_Contact"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "url"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "contact-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\"."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Contact"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "email"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "contact-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\""
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "info.contact"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "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."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "info.description"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "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."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "info.license"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "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."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_License"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "url"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "license-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\"."
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Markdown"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "eval\\("
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "no-eval-in-markdown",
|
|
"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(\"."
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Markdown"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "<script"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "no-script-tags-in-markdown",
|
|
"description": "Markdown descriptions should not contain `script` tags, 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. <script>alert(\"You are Hacked\");</script>',\"\r\n```",
|
|
"message": "Markdown descriptions must not have \"<script>\" tags."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Tags"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "alphabetical",
|
|
"functionOptions": {
|
|
"keyedBy": "name"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "openapi-tags-alphabetical",
|
|
"description": "Global tags specified at the root OpenAPI Document level should be in alphabetical order based on the `name` property.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\":[\r\n {\r\n \"name\":\"Z Global Tag\"\r\n },\r\n {\r\n \"name\":\"A Global Tag\"\r\n }\r\n ]\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\":[\r\n {\r\n \"name\":\"A Global Tag\"\r\n },\r\n {\r\n \"name\":\"Z Global Tag\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "OpenAPI object should have alphabetical \"tags\"."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Tags"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "schema",
|
|
"functionOptions": {
|
|
"schema": {
|
|
"type": "array",
|
|
"minItems": 1
|
|
}
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "openapi-tags",
|
|
"description": "At least one global tag should be specified at the root OpenAPI Document level.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\":[\r\n {\r\n \"name\":\"Global Tag #1\"\r\n },\r\n {\r\n \"name\":\"Global Tag #2\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "OpenAPI object should have non-empty \"tags\" array."
|
|
},
|
|
{
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "description"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-description",
|
|
"description": "Each operation should have a description. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n \"description\": \"Get a list of users.\",\r\n ... ,\r\n ... ,\r\n }\r\n}\r\n```",
|
|
"message": "Operation \"description\" should be present and non-empty string."
|
|
},
|
|
{
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "operationId"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-operationId",
|
|
"description": "All operations should have an `operationId`.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n \"summary\": \"Get users\",\r\n ... ,\r\n \"operationId\": \"get-users\"\r\n }\r\n}\r\n```",
|
|
"message": "Operation should have \"operationId\"."
|
|
},
|
|
{
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"match": "^[A-Za-z0-9-._~:/?#\\[\\]@!\\$&'()*+,;=]*$"
|
|
},
|
|
"field": "operationId"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-operationId-valid-in-url",
|
|
"description": "Operation IDs must not contain characters that are invalid for URLs. \r\n\r\n**Invalid Example**\r\n\r\nThe `operationId` in this example includes a pipe and space, which are invalid for URLs.\r\n\r\n```json lineNumbers\r\n{\r\n \"/users\": {\r\n \"get\": {\r\n ... ,\r\n \"operationId\": \"invalid|operationID \",\r\n ... ,\r\n }\r\n }\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\nThis `operationId` is valid for URLs.\r\n\r\n```json lineNumbers\r\n{\r\n \"/users\": {\r\n \"get\": {\r\n ... ,\r\n \"operationId\": \"this-must-be-unique\",\r\n ... ,\r\n }\r\n }\r\n}\r\n```",
|
|
"message": "OperationId should not have characters that are invalid when used in URL."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Tags"
|
|
],
|
|
"severity": "off",
|
|
"then": {
|
|
"function": "length",
|
|
"functionOptions": {
|
|
"max": 1
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-singular-tag",
|
|
"description": "Operation should not have more than a single tag.",
|
|
"message": "Operation should not have more than a single tag."
|
|
},
|
|
{
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "length",
|
|
"functionOptions": {
|
|
"max": 999,
|
|
"min": 1
|
|
},
|
|
"field": "tags"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-tags",
|
|
"description": "At least one tag should be defined for each operation.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n ... ,\r\n \"tags\": [\r\n \"Users\"\r\n ],\r\n }\r\n}",
|
|
"message": "Operation should have non-empty \"tags\" array."
|
|
},
|
|
{
|
|
"given": [
|
|
"#Path_Item"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "{}"
|
|
},
|
|
"field": "@key"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "path-declarations-must-exist",
|
|
"description": "Path parameter declarations must not be empty.\r\n\r\n**Invalid Example**\r\n\r\n`/users/{}`\r\n\r\n**Valid Example**\r\n\r\n`/users/{userId}`",
|
|
"message": "Path parameter declarations must not be empty, ex.\"/given/{}\" is invalid."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Contact"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "name"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "contact-name",
|
|
"description": "The `contact` object should have an organization name. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"contact\": {\r\n \"name\": \"ACME Corporation\",\r\n ... ,\r\n ... \r\n},\r\n```\r\n",
|
|
"message": "Contact object should have \"name\""
|
|
},
|
|
{
|
|
"given": [
|
|
"#Path_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": ".+\\/$"
|
|
},
|
|
"field": "@key"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "path-keys-no-trailing-slash",
|
|
"description": "Path keys should not end in forward slashes. This is a best practice for working with web tooling, such as mock servers, code generators, application frameworks, and more).\r\n\r\n**Invalid Example**\r\n\r\n```json\r\n{\r\n \"/users/\": {\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json\r\n{\r\n \"/users\": {\r\n```",
|
|
"message": "Path should not end with slash."
|
|
},
|
|
{
|
|
"given": [
|
|
"#Path_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "\\?"
|
|
},
|
|
"field": "@key"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "path-not-include-query",
|
|
"description": "Paths should not include `query` string items. Instead, add them as parameters with `in: query`.\r\n\r\n**Invalid Example**\r\n\r\n```json\r\n{\r\n \"/users/{?id}\": {\r\n\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"description\": \"User's ID\"\r\n }\r\n ]\r\n}\r\n\r\n```",
|
|
"message": "Path should not include query string."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Tags_Item"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "description"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "tag-description",
|
|
"description": "Tags defined at the global level should have a description.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\": [\r\n {\r\n \"name\":\"Users\",\r\n \"description\":\"End-user information\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "Tag object should have \"description\"."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Server"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "schema",
|
|
"functionOptions": {
|
|
"schema": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"dialect": "draft7"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "api-servers",
|
|
"description": "A server should be defined at the root document level. This can be localhost, a development server, or a production server. \n\n**Valid OpenAPI V3 Example**\n\n```json\n{\n \"servers\": [\n {\n \"url\": \"https://staging.myprodserver.com/v1\",\n \"description\": \"Staging server\"\n },\n {\n \"url\": \"https://myprodserver.com/v1\",\n \"description\": \"Production server\"\n }\n ]\n}\n```\n\n**Valid OpenAPI V2 Example**\n\n```json\n{\n \"host\": \"myprodserver.com\",\n \"basePath\": \"/v2\",\n \"schemes\": [\n \"https\"\n ]\n}\n```\n\n",
|
|
"message": "Server should be present."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Server_URL"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "/$"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "server-trailing-slash",
|
|
"description": "Server URLs should not end in forward slashes. This is a best practice for working with web tooling, such as mock servers, code generators, application frameworks, and more).\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"servers\": [\r\n {\r\n ... ,\r\n \"url\": \"https://api.openweathermap.org/data/2.5/\"\r\n }\r\n ]\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"servers\": [\r\n {\r\n ... ,\r\n \"url\": \"https://api.openweathermap.org/data/2.5\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "Server URL should not have trailing slash"
|
|
},
|
|
{
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasOpSuccessResponse",
|
|
"field": "responses"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-success-response",
|
|
"description": "Operations should have at least one \"2xx\" or \"3xx\" response defined.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n \"responses\": {},\r\n }\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"OK\"\r\n }\r\n },\r\n }\r\n}\r\n```",
|
|
"message": "Operation should have at least one \"2xx\" or \"3xx\" response."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasPathParam"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "path-params",
|
|
"description": "Path parameters must be defined and valid in either the `path-parameters` or the `operation-parameters` object. Likewise, defined `path-parameters` or `operation-parameters` must be used in the `paths` string.\r\n\r\n**Valid Example**\r\n\r\nFor this path:\r\n\r\n`/users/{id}/{location}`\r\n\r\nThe following path parameters must be defined.\r\n\r\n```json lineNumbers\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"description\": \"This is the user's ID\"\r\n },\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"name\": \"location\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"description\": \"This is the user's location\"\r\n }\r\n ]\r\n }\r\n },\r\n ```",
|
|
"message": "{{error}}"
|
|
},
|
|
{
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasOpParams",
|
|
"field": "parameters"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-parameters",
|
|
"description": "Operation parameters should be unique and non-repeating:\r\n\r\n* `name` and `in` must be unique\r\n\r\nFor OAS2:\r\n\r\n* Operations should not have `in: body` and `in: formData` parameters.\r\n* Operations should have only one `in: body` parameter.\r\n\r\n**Invalid Example**\r\n\r\nIn this example, the query paramater `\"name\": \"last name\"` is repeated.\r\n\r\n```json lineNumbers\r\n{\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"in\": \"query\",\r\n \"name\": \"last name\",\r\n \"description\": \"User's last name\"\r\n },\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"in\": \"query\",\r\n \"name\": \"last name\",\r\n \"description\": \"User's last name\"\r\n }\r\n ],\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\nIn this example, query parameters are unique.\r\n\r\n```json lineNumbers\r\n{\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"in\": \"query\",\r\n \"name\": \"first name\",\r\n \"description\": \"User's first name\"\r\n },\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"in\": \"query\",\r\n \"name\": \"last name\",\r\n \"description\": \"User's last name\"\r\n }\r\n ],\r\n}\r\n```",
|
|
"message": "Operation parameters are unique and non-repeating."
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Enum"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "typedEnum"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "typed-enum",
|
|
"description": "All `enum' values should respect the specified type.\r\n\r\n**Invalid Example**\r\n\r\nIn this example, the `enum` type is `integer`, but the values are strings.\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"type\": \"integer\",\r\n \"enum\": [\r\n \"standard\",\r\n \"metric\",\r\n \"imperial\"\r\n ]\r\n },\r\n```\r\n\r\n**Valid Example**\r\n\r\nIn this example, the `enum` type is `string` and the values are strings.\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"standard\",\r\n \"metric\",\r\n \"imperial\"\r\n ]\r\n },",
|
|
"message": "{{error}}"
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasDocumentSchema"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-schema",
|
|
"description": "This Stoplight core rule validates the structure of OpenAPI v2 specification. This rule should never be disabled.",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasDocumentSchema"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas3-schema",
|
|
"description": "This Stoplight core rule validates the structure of OpenAPI v3.x specification. This rule should never be disabled.",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasUnusedComponent"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas3-unused-component",
|
|
"description": "A potentially shareable component is not being used. This may be expected, but you should review sharable components to avoid duplicate entry.",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasOpIdUnique"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-operationId-unique",
|
|
"description": "Every operation in a single document must have a unique `operationID`.\r\n\r\n**Valid Example**\r\n\r\nIn this example, the `operationId` is `get-users`. This `operationId` must be unique in an API document.\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n \"summary\": \"Get users\",\r\n ... ,\r\n \"operationId\": \"get-users\"\r\n }\r\n}\r\n```\r\n",
|
|
"message": "Every operation must have unique operationId"
|
|
},
|
|
{
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasOpFormDataConsumeCheck"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-operation-formData-consume-check",
|
|
"description": "Operations with an `in: formData` parameter must include a `consumes` property with one of these values:\r\n\r\n`application/x-www-form-urlencoded`\r\n\r\n`multipart/form-data`\r\n\r\n**Valid Example**\r\n\r\nIn this example, the `consumes` property correctly includes the `multipart/form-data` value.\r\n\r\n```json lineNumbers\r\n{\r\n \"post\":{\r\n \"summary\":\"Uploads a file\",\r\n \"consumes\":[\r\n \"multipart/form-data\"\r\n ],\r\n \"parameters\":[\r\n {\r\n \"name\":\"name\",\r\n \"in\":\"formData\",\r\n \"description\":\"Upload a file\",\r\n \"required\":false,\r\n \"type\":\"string\"\r\n }\r\n ]\r\n }\r\n}",
|
|
"message": "Operations with \"in: formData\" parameter must include \"application/x-www-form-urlencoded\" or \"multipart/form-data\" in their \"consumes\" property.",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasTagDefined"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "operation-tag-defined",
|
|
"description": "Tags defined at the operation level should also be defined at the global level. \r\n\r\n**Operation-level Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n ... ,\r\n \"tags\": [\r\n \"Users\"\r\n ],\r\n }\r\n} \r\n```\r\n\r\n**Global-level Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\": [\r\n {\r\n \"name\": \"Users\",\r\n ... ,\r\n }\r\n ],\r\n}\r\n\r\n```",
|
|
"message": "Operation tags must be defined in global tags"
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Ref"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "refSiblings"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "no-$ref-siblings",
|
|
"description": "Property must not be placed among $ref.",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3.0",
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasOpSecurityDefined",
|
|
"functionOptions": {
|
|
"schemesPath": [
|
|
"securityDefinitions"
|
|
]
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-operation-security-defined",
|
|
"description": "Operation `security` values must match a scheme defined in the global `securityDefinitions` object. Empty `security` values for operations are ignored if authentication is not explicity required or is optional.\r\n\r\n**Valid Example**\r\n\r\nFor this global security scheme:\r\n\r\n```json lineNumbers\r\n{\r\n \"securityDefinitions\": {\r\n \"API Key\": {\r\n \"name\": \"API Key\",\r\n \"type\": \"apiKey\",\r\n \"in\": \"query\"\r\n }\r\n }\r\n}\r\n```\r\n\r\nThis is a valid operation security value:\r\n\r\n```json lineNumbers\r\n{ \"operationId\": \"get-users-userId\",\r\n \"security\": [\r\n {\r\n \"API Key\": []\r\n }\r\n ]\r\n}\r\n```\r\n\r\n**Invalid Example**\r\n\r\nFor the same global security scheme, this is an invalid operation security value:\r\n\r\n```json lineNumbers\r\n{ \"operationId\": \"get-users-userId\",\r\n \"security\": [\r\n {\r\n \"oath2\": []\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasOpSecurityDefined",
|
|
"functionOptions": {
|
|
"schemesPath": [
|
|
"components",
|
|
"securitySchemes"
|
|
]
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas3-operation-security-defined",
|
|
"description": "Operation `security` values must match a scheme defined in the global `components.security.Schemes` object. \r\n\r\n**Valid Example**\r\n\r\nFor this global security scheme:\r\n\r\n```json lineNumbers\r\n{\r\n\"components\": {\r\n \"security\": [\r\n {\r\n \"app-id\": []\r\n }\r\n ]\r\n }\r\n}\r\n```\r\n\r\n`app-id` is a valid operation `security` value:\r\n\r\n```json lineNumbers\r\n{ \r\n \"get\": {\r\n \"security\": [\r\n {\r\n \"app-id\": []\r\n }\r\n ]\r\n }\r\n} \r\n```\r\n\r\n**Invalid Example**\r\n\r\nFor the same global security scheme, `oath2` is an invalid operation `security` value:\r\n\r\n```json lineNumbers\r\n{ \r\n \"get\": {\r\n \"security\": [\r\n {\r\n \"oath2\": []\r\n }\r\n ]\r\n }\r\n} \r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Enum"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasSchema",
|
|
"functionOptions": {
|
|
"schema": {
|
|
"type": "array",
|
|
"uniqueItems": true
|
|
}
|
|
},
|
|
"field": "enum"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "duplicated-entry-in-enum",
|
|
"description": "All enum values should be unique.\r\n\r\n**Invalid Example**\r\n\r\nThere are two `json` enum values.\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\":{\r\n \"type\":\"string\",\r\n \"enum\":[\r\n \"json\",\r\n \"json\",\r\n \"html\"\r\n ]\r\n }\r\n}\r\n```\r\n**Valid Example**\r\n\r\nAll enum values are unique.\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\":{\r\n \"type\":\"string\",\r\n \"enum\":[\r\n \"json\",\r\n \"xml\",\r\n \"html\"\r\n ]\r\n }\r\n}\r\n```",
|
|
"message": "{{error}}"
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "schema",
|
|
"functionOptions": {
|
|
"schema": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"dialect": "draft7"
|
|
},
|
|
"field": "schemes"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-api-schemes",
|
|
"description": "OpenAPI 2 host `schemes` reflect the transfer protocol of the API. Host schemes must be present and an array with one or more of these values: `http`, `https`, `ws`, or `wss`.\r\n\r\n**Valid Example**\r\n\r\nThis example shows that host schemes are `http` and `https`.\r\n\r\n```json\r\n{\r\n \"schemes\":[\r\n \"http\",\r\n \"https\"\r\n ]\r\n}\r\n \r\n```",
|
|
"message": "OpenAPI host \"schemes\" must be present and non-empty array",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasDiscriminator",
|
|
"field": "definitions[?(@.discriminator)]"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-discriminator",
|
|
"description": "Discriminator property must be defined and required",
|
|
"message": "Discriminator property must be defined and required",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Server_URL"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "example.com"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "server-not-example",
|
|
"description": "Server URLs must not direct to example.com. This helps ensure URLs are valid before you distribute your API document.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"servers\": [\r\n {\r\n ... ,\r\n \"url\": \"https://example.com\"\r\n }\r\n ]\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"servers\": [\r\n {\r\n ... ,\r\n \"url\": \"https://api.openweathermap.org/data/2.5\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "Server URL must not point at example.com."
|
|
},
|
|
{
|
|
"given": [
|
|
"#Request_Parameter_All"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "description"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "parameter-description",
|
|
"description": "All `parameter` objects should have a description.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"integer\"\r\n },\r\n ... ,\r\n ... ,\r\n \"description\": \"The number of days to include in the response.\"\r\n }\r\n}\r\n```\r\n",
|
|
"message": "Parameter objects must have \"description\"."
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document_RecursiveSearch"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "undefined",
|
|
"field": "anyOf"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-anyOf",
|
|
"description": "The `anyOf` keyword is not supported in OAS2. Only `allOf` is supported.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"anyOf\": [\r\n {\r\n \"properties\": {\r\n \"firstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"lastName\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n },\r\n {}\r\n ],\r\n }\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"firstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"lastName\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n }\r\n}\r\n```",
|
|
"message": "anyOf is not available in OpenAPI v2, it was added in OpenAPI v3",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#API_Document_RecursiveSearch"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "undefined",
|
|
"field": "oneOf"
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-oneOf",
|
|
"description": "The `oneOf` keyword is not supported in OAS2. Only `allOf` is supported.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"oneOf\": [\r\n {\r\n \"properties\": {\r\n \"firstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"lastName\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n },\r\n {}\r\n ],\r\n }\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"firstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"lastName\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n }\r\n}\r\n```",
|
|
"message": "oneOf is not available in OpenAPI v2, it was added in OpenAPI v3",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Example"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "xor",
|
|
"functionOptions": {
|
|
"properties": [
|
|
"externalValue",
|
|
"value"
|
|
]
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas3-examples-value-or-externalValue",
|
|
"description": "The `examples` object should include a `value` or `externalValue` field, but cannot include both.\r\n\r\n**Invalid Example**\r\n\r\nThis example includes both a `value` field and an `externalValue` field.\r\n\r\n```json lineNumbers\r\n{\r\n \"examples\": {\r\n \"example-1\": {\r\n \"value\": {\r\n \"id\": \"string\",\r\n \"name\": \"string\"\r\n },\r\n \"externalValue\": {\r\n \"id\": \"string\",\r\n \"name\": \"string\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\n**Valid Example** \r\n\r\nThis example includes only a `value` field.\r\n\r\n```json lineNumbers\r\n{\r\n \"examples\": {\r\n \"example-1\": {\r\n \"value\": {\r\n \"id\": \"string\",\r\n \"name\": \"string\"\r\n }\r\n }\r\n }\r\n}",
|
|
"message": "Examples must have either \"value\" or \"externalValue\" field.",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Example_Schema"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasExample",
|
|
"functionOptions": {
|
|
"oasVersion": "2",
|
|
"schemaField": "$",
|
|
"type": "schema"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-valid-schema-example",
|
|
"description": "Examples must be valid against their defined schema. \r\n\r\n**Valid Example**\r\n\r\nThe following schema includes the `name` and `petType` properties. \r\n\r\n```json lineNumbers\r\n{\r\n \"Pet\":{\r\n \"type\":\"object\",\r\n \"properties\":{\r\n \"name\":{\r\n \"type\":\"string\"\r\n },\r\n \"petType\":{\r\n \"type\":\"string\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\nWhen referenced in a response example, the property names on line 6 and 7 must match those in the schema (`petName` and `petType`).\r\n\r\n```json lineNumbers\r\n{\r\n \"responses\":{\r\n \"200\":{\r\n \"content\":{\r\n \"application/json\":{\r\n \"examples\":{\r\n \"Pet Example\":{\r\n \"petName\":\"Bubbles\",\r\n \"petType\":\"Dog\"\r\n }\r\n },\r\n \"schema\":{\r\n \"$ref\":\"#/definitions/Pet\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Example_Schema"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasExample",
|
|
"functionOptions": {
|
|
"oasVersion": "3",
|
|
"schemaField": "$",
|
|
"type": "schema"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas3-valid-schema-example",
|
|
"description": "Examples must be valid against their defined schema. \r\n\r\n**Valid Example**\r\n\r\nThe following schema includes the `name` and `petType` properties. \r\n\r\n```json lineNumbers\r\n{\r\n \"Pet\":{\r\n \"type\":\"object\",\r\n \"properties\":{\r\n \"name\":{\r\n \"type\":\"string\"\r\n },\r\n \"petType\":{\r\n \"type\":\"string\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\nWhen referenced in a response example, the property names on line 6 and 7 must match those in the schema (`petName` and `petType`).\r\n\r\n```json lineNumbers\r\n{\r\n \"responses\":{\r\n \"200\":{\r\n \"content\":{\r\n \"application/json\":{\r\n \"examples\":{\r\n \"Pet Example\":{\r\n \"petName\":\"Bubbles\",\r\n \"petType\":\"Dog\"\r\n }\r\n },\r\n \"schema\":{\r\n \"$ref\":\"#/definitions/Pet\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Example_Media"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasExample",
|
|
"functionOptions": {
|
|
"oasVersion": "2",
|
|
"schemaField": "schema",
|
|
"type": "media"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas2-valid-media-example",
|
|
"description": "Examples must be valid against their defined schema. Common reasons you may see errors if:\r\n\r\n* The value used for property examples is not the same type indicated in the schema (string vs. integer, for example).\r\n* Examples contain properties not included in the schema.\r\n\r\n**Valid Example**\r\n\r\nThe following schema indicates that the `id` property is a `string` type. \r\n\r\n```json lineNumbers\r\n\"User\":{\r\n \"title\":\"User\",\r\n \"type\":\"object\",\r\n \"properties\":{\r\n \"id\":{\r\n \"type\":\"string\"\r\n }\r\n }\r\n}\r\n```\r\nWhen the example is referenced in a response, the `id` property must be `string`.\r\n\r\n```json lineNumbers\r\n{\r\n \"responses\":{\r\n \"200\":{\r\n \"description\":\"User Found\",\r\n \"schema\":{\r\n \"$ref\":\"#/definitions/User\"\r\n },\r\n \"examples\":{\r\n \"Get User Alice Smith\":{\r\n \"id\": \"smith, alice\",\r\n }\r\n }\r\n },\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
{
|
|
"given": [
|
|
"#All_Example_Media"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasExample",
|
|
"functionOptions": {
|
|
"oasVersion": "3",
|
|
"schemaField": "schema",
|
|
"type": "media"
|
|
}
|
|
},
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oas3-valid-media-example",
|
|
"description": "The following schema includes the `name` and `petType` properties. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"Pet\":{\r\n \"type\":\"object\",\r\n \"properties\":{\r\n \"name\":{\r\n \"type\":\"string\"\r\n },\r\n \"petType\":{\r\n \"type\":\"string\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\nWhen referenced in a response example, the property names on line 6 and 7 must match those in the schema (`petName` and `petType`).\r\n\r\n```json lineNumbers\r\n{\r\n \"responses\":{\r\n \"200\":{\r\n \"content\":{\r\n \"application/json\":{\r\n \"examples\":{\r\n \"Pet Example\":{\r\n \"petName\":\"Bubbles\",\r\n \"petType\":\"Dog\"\r\n }\r\n },\r\n \"schema\":{\r\n \"$ref\":\"#/definitions/Pet\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
}
|
|
],
|
|
"inheritedTargets": [
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"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.* ",
|
|
"name": "API_Document",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "The top level description in an API document",
|
|
"name": "API_Description",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.info.description"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.info.description"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "The complete operation object. Use it in combo with field object.",
|
|
"name": "Operation_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]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "Responses for all operations including get, put, post, delete, options, head, patch, trace.",
|
|
"name": "Operation_Responses",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "#Operation_Object.responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "#Operation_Object.responses"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "Path_Item",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.paths[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths[*]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "The top level description in an API document",
|
|
"name": "API_Contact",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.info.contact"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.info.contact"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "The top level description in an API document",
|
|
"name": "API_License",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.info.license"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.info.license"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All markdown descriptions across the document.",
|
|
"name": "All_Markdown",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..[description,title]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..[description,title]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "Tags on an API object",
|
|
"name": "API_Tags",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "#Operation_Object.tags"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "#Operation_Object.tags"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "API hosts defined in the API specification",
|
|
"name": "API_Server",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.servers"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.host"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All responses (object) in an API",
|
|
"name": "Response_All_Object",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "#Operation_Responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.components.responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "#Operation_Responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..responses"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "API host urls defined in the API specification",
|
|
"name": "API_Server_URL",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.servers[*].url"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.host"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All references throughout the API",
|
|
"name": "All_Ref",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..[?(@property === '$ref')]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..[?(@property === '$ref')]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All references throughout the API",
|
|
"name": "All_Enum",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..[?(@ && @.enum && @.type)]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..[?(@ && @.enum && @.type)]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All request parameters",
|
|
"name": "Request_Parameter_All",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[*]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All request query parameters",
|
|
"name": "Request_Parameter_Query",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"query\")]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"query\")]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All request header parameters",
|
|
"name": "Request_Parameter_Header",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"header\")]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"header\")]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All request cookie parameters",
|
|
"name": "Request_Parameter_Cookie",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"cookie\")]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"cookie\")]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All request path parameters",
|
|
"name": "Request_Parameter_Path",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"path\")]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"path\")]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "Path object. Usually used to target the Path key e.g. `/users/{userId}`",
|
|
"name": "Path_Object",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.paths"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All examples for schemas",
|
|
"name": "All_Example_Schema",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..definitions..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..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))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..content..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..headers..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"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.* ",
|
|
"name": "API_Document_RecursiveSearch",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.."
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All examples across the API document",
|
|
"name": "All_Example",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.components.examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths[*][*]..content[*].examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths[*][*]..parameters[*].examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.components.parameters[*].examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths[*][*]..headers[*].examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.components.headers[*].examples[*]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "All examples for schemas",
|
|
"name": "All_Example_Media",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..responses..[?(@ && @.schema && @.examples)]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..content..[?(@ && @.schema && (@.example !== void 0 || @.examples))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..headers..[?(@ && @.schema && (@.example !== void 0 || @.examples))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters..[?(@ && @.schema && (@.example !== void 0 || @.examples))]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"description": "Tags on an API object",
|
|
"name": "API_Tags_Item",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.tags[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.tags[*]"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"inheritedFunctions": [
|
|
{
|
|
"id": "HLUBEmm9AX1boJf0ZrzkN",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasDocumentSchema",
|
|
"content": "import { createRulesetFunction } from '@stoplight/spectral-core';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport { oas2, oas3_1 } from '@stoplight/spectral-formats';\n\nconst OAS_2 = {\n title: 'A JSON Schema for Swagger 2.0 API.',\n $id: 'http://swagger.io/v2/schema.json#',\n $schema: 'http://json-schema.org/draft-07/schema#',\n type: 'object',\n required: ['swagger', 'info', 'paths'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n swagger: {\n type: 'string',\n enum: ['2.0'],\n description: 'The Swagger version of this document.',\n },\n info: {\n $ref: '#/definitions/info',\n },\n host: {\n type: 'string',\n pattern: '^[^{}/ :\\\\\\\\]+(?::\\\\d+)?$',\n description: \"The host (name or ip) of the API. Example: 'swagger.io'\",\n },\n basePath: {\n type: 'string',\n pattern: '^/',\n description: \"The base path to the API. Example: '/api'.\",\n },\n schemes: {\n $ref: '#/definitions/schemesList',\n },\n consumes: {\n description: 'A list of MIME types accepted by the API.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n produces: {\n description: 'A list of MIME types the API can produce.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n paths: {\n $ref: '#/definitions/paths',\n },\n definitions: {\n $ref: '#/definitions/definitions',\n },\n parameters: {\n $ref: '#/definitions/parameterDefinitions',\n },\n responses: {\n $ref: '#/definitions/responseDefinitions',\n },\n security: {\n $ref: '#/definitions/security',\n },\n securityDefinitions: {\n $ref: '#/definitions/securityDefinitions',\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/definitions/tag',\n },\n uniqueItems: true,\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n },\n definitions: {\n info: {\n type: 'object',\n description: 'General information about the API.',\n required: ['version', 'title'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n title: {\n type: 'string',\n description: 'A unique and precise title of the API.',\n },\n version: {\n type: 'string',\n description: 'A semantic version number of the API.',\n },\n description: {\n type: 'string',\n description:\n 'A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.',\n },\n termsOfService: {\n type: 'string',\n description: 'The terms of service for the API.',\n },\n contact: {\n $ref: '#/definitions/contact',\n },\n license: {\n $ref: '#/definitions/license',\n },\n },\n },\n contact: {\n type: 'object',\n description: 'Contact information for the owners of the API.',\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n description: 'The identifying name of the contact person/organization.',\n },\n url: {\n type: 'string',\n description: 'The URL pointing to the contact information.',\n format: 'uri',\n },\n email: {\n type: 'string',\n description: 'The email address of the contact person/organization.',\n format: 'email',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n license: {\n type: 'object',\n required: ['name'],\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n description: \"The name of the license type. It's encouraged to use an OSI compatible license.\",\n },\n url: {\n type: 'string',\n description: 'The URL pointing to the license.',\n format: 'uri',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n paths: {\n type: 'object',\n description: \"Relative paths to the individual endpoints. They must be relative to the 'basePath'.\",\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n '^/': {\n $ref: '#/definitions/pathItem',\n },\n },\n additionalProperties: false,\n },\n definitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/schema',\n },\n description: 'One or more JSON objects describing the schemas being consumed and produced by the API.',\n },\n parameterDefinitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/parameter',\n },\n description: 'One or more JSON representations for parameters',\n },\n responseDefinitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/response',\n },\n description: 'One or more JSON representations for responses',\n },\n externalDocs: {\n type: 'object',\n additionalProperties: false,\n description: 'information about external documentation',\n required: ['url'],\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n examples: {\n type: 'object',\n additionalProperties: true,\n },\n mimeType: {\n type: 'string',\n description: 'The MIME type of the HTTP message.',\n },\n operation: {\n type: 'object',\n required: ['responses'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n uniqueItems: true,\n },\n summary: {\n type: 'string',\n description: 'A brief summary of the operation.',\n },\n description: {\n type: 'string',\n description: 'A longer description of the operation, GitHub Flavored Markdown is allowed.',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n operationId: {\n type: 'string',\n description: 'A unique identifier of the operation.',\n },\n produces: {\n description: 'A list of MIME types the API can produce.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n consumes: {\n description: 'A list of MIME types the API can consume.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n parameters: {\n $ref: '#/definitions/parametersList',\n },\n responses: {\n $ref: '#/definitions/responses',\n },\n schemes: {\n $ref: '#/definitions/schemesList',\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n security: {\n $ref: '#/definitions/security',\n },\n },\n },\n pathItem: {\n type: 'object',\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n $ref: {\n type: 'string',\n },\n get: {\n $ref: '#/definitions/operation',\n },\n put: {\n $ref: '#/definitions/operation',\n },\n post: {\n $ref: '#/definitions/operation',\n },\n delete: {\n $ref: '#/definitions/operation',\n },\n options: {\n $ref: '#/definitions/operation',\n },\n head: {\n $ref: '#/definitions/operation',\n },\n patch: {\n $ref: '#/definitions/operation',\n },\n parameters: {\n $ref: '#/definitions/parametersList',\n },\n },\n },\n responses: {\n type: 'object',\n description: \"Response objects names can either be any valid HTTP status code or 'default'.\",\n minProperties: 1,\n additionalProperties: false,\n patternProperties: {\n '^([0-9]{3})$|^(default)$': {\n $ref: '#/definitions/responseValue',\n },\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n not: {\n type: 'object',\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n },\n responseValue: {\n oneOf: [\n {\n $ref: '#/definitions/response',\n },\n {\n $ref: '#/definitions/jsonReference',\n },\n ],\n },\n response: {\n type: 'object',\n required: ['description'],\n properties: {\n description: {\n type: 'string',\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n $ref: '#/definitions/fileSchema',\n },\n ],\n },\n headers: {\n $ref: '#/definitions/headers',\n },\n examples: {\n $ref: '#/definitions/examples',\n },\n },\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/header',\n },\n },\n header: {\n type: 'object',\n additionalProperties: false,\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['string', 'number', 'integer', 'boolean', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n vendorExtension: {\n description: 'Any property starting with x- is valid.',\n additionalProperties: true,\n additionalItems: true,\n },\n bodyParameter: {\n type: 'object',\n required: ['name', 'in', 'schema'],\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['body'],\n },\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n schema: {\n $ref: '#/definitions/schema',\n },\n },\n additionalProperties: false,\n },\n headerParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['header'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n queryParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['query'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n description: 'allows sending a parameter by name only or with an empty value.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormatWithMulti',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n formDataParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['formData'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n description: 'allows sending a parameter by name only or with an empty value.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array', 'file'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormatWithMulti',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n pathParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n required: ['required'],\n properties: {\n required: {\n type: 'boolean',\n enum: [true],\n description: 'Determines whether or not this parameter is required or optional.',\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['path'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n nonBodyParameter: {\n type: 'object',\n required: ['name', 'in', 'type'],\n oneOf: [\n {\n $ref: '#/definitions/headerParameterSubSchema',\n },\n {\n $ref: '#/definitions/formDataParameterSubSchema',\n },\n {\n $ref: '#/definitions/queryParameterSubSchema',\n },\n {\n $ref: '#/definitions/pathParameterSubSchema',\n },\n ],\n },\n parameter: {\n oneOf: [\n {\n $ref: '#/definitions/bodyParameter',\n },\n {\n $ref: '#/definitions/nonBodyParameter',\n },\n ],\n },\n schema: {\n type: 'object',\n description: 'A deterministic version of a JSON Schema object.',\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n $ref: {\n type: 'string',\n },\n format: {\n type: 'string',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n multipleOf: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/multipleOf',\n },\n maximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/maximum',\n },\n exclusiveMaximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum',\n },\n minimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/minimum',\n },\n exclusiveMinimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum',\n },\n maxLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n pattern: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/pattern',\n },\n maxItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n uniqueItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/uniqueItems',\n },\n maxProperties: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minProperties: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n required: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/stringArray',\n },\n enum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/enum',\n },\n additionalProperties: {\n anyOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n type: 'boolean',\n },\n ],\n default: {},\n },\n type: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/type',\n },\n items: {\n anyOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n ],\n default: {},\n },\n allOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n oneOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n anyOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n properties: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/schema',\n },\n default: {},\n },\n discriminator: {\n type: 'string',\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n xml: {\n $ref: '#/definitions/xml',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n example: {},\n },\n additionalProperties: false,\n },\n fileSchema: {\n type: 'object',\n description: 'A deterministic version of a JSON Schema object.',\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n required: ['type'],\n properties: {\n format: {\n type: 'string',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n required: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/stringArray',\n },\n type: {\n type: 'string',\n enum: ['file'],\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n example: {},\n },\n additionalProperties: false,\n },\n primitivesItems: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n enum: ['string', 'number', 'integer', 'boolean', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/securityRequirement',\n },\n uniqueItems: true,\n },\n securityRequirement: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n uniqueItems: true,\n },\n },\n xml: {\n type: 'object',\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n },\n namespace: {\n type: 'string',\n },\n prefix: {\n type: 'string',\n },\n attribute: {\n type: 'boolean',\n default: false,\n },\n wrapped: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n tag: {\n type: 'object',\n additionalProperties: false,\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n securityDefinitions: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/basicAuthenticationSecurity',\n },\n {\n $ref: '#/definitions/apiKeySecurity',\n },\n {\n $ref: '#/definitions/oauth2ImplicitSecurity',\n },\n {\n $ref: '#/definitions/oauth2PasswordSecurity',\n },\n {\n $ref: '#/definitions/oauth2ApplicationSecurity',\n },\n {\n $ref: '#/definitions/oauth2AccessCodeSecurity',\n },\n ],\n },\n errorMessage: {\n properties: {\n basic: 'Invalid basic authentication security definition',\n apiKey: 'Invalid apiKey authentication security definition',\n oauth2: 'Invalid oauth2 authentication security definition',\n },\n _: 'Invalid security securityDefinitions',\n },\n },\n basicAuthenticationSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['basic'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n apiKeySecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'name', 'in'],\n properties: {\n type: {\n type: 'string',\n enum: ['apiKey'],\n },\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n enum: ['header', 'query'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2ImplicitSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'authorizationUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['implicit'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n authorizationUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2PasswordSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['password'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2ApplicationSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['application'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2AccessCodeSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'authorizationUrl', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['accessCode'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n authorizationUrl: {\n type: 'string',\n format: 'uri',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2Scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n mediaTypeList: {\n type: 'array',\n items: {\n $ref: '#/definitions/mimeType',\n },\n uniqueItems: true,\n },\n parametersList: {\n type: 'array',\n description: 'The parameters needed to send a valid API call.',\n additionalItems: false,\n items: {\n oneOf: [\n {\n $ref: '#/definitions/parameter',\n },\n {\n $ref: '#/definitions/jsonReference',\n },\n ],\n },\n uniqueItems: true,\n },\n schemesList: {\n type: 'array',\n description: 'The transfer protocol of the API.',\n items: {\n type: 'string',\n enum: ['http', 'https', 'ws', 'wss'],\n },\n uniqueItems: true,\n },\n collectionFormat: {\n type: 'string',\n enum: ['csv', 'ssv', 'tsv', 'pipes'],\n default: 'csv',\n },\n collectionFormatWithMulti: {\n type: 'string',\n enum: ['csv', 'ssv', 'tsv', 'pipes', 'multi'],\n default: 'csv',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/maximum',\n },\n exclusiveMaximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum',\n },\n minimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/minimum',\n },\n exclusiveMinimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum',\n },\n maxLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n pattern: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/pattern',\n },\n maxItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n uniqueItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/uniqueItems',\n },\n enum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/enum',\n },\n jsonReference: {\n type: 'object',\n required: ['$ref'],\n additionalProperties: false,\n properties: {\n $ref: {\n type: 'string',\n },\n },\n },\n },\n};\n\nconst OAS_3 = {\n $id: 'https://spec.openapis.org/oas/3.0/schema/2019-04-02',\n $schema: 'http://json-schema.org/draft-07/schema#',\n description: 'Validation schema for OpenAPI Specification 3.0.X.',\n type: 'object',\n required: ['openapi', 'info', 'paths'],\n properties: {\n openapi: {\n type: 'string',\n pattern: '^3\\\\.0\\\\.\\\\d(-.+)?$',\n },\n info: {\n $ref: '#/definitions/Info',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/SecurityRequirement',\n },\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/definitions/Tag',\n },\n uniqueItems: true,\n },\n paths: {\n $ref: '#/definitions/Paths',\n },\n components: {\n $ref: '#/definitions/Components',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n definitions: {\n Reference: {\n type: 'object',\n required: ['$ref'],\n patternProperties: {\n '^\\\\$ref$': {\n type: 'string',\n format: 'uri-reference',\n },\n },\n },\n Info: {\n type: 'object',\n required: ['title', 'version'],\n properties: {\n title: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n termsOfService: {\n type: 'string',\n format: 'uri-reference',\n },\n contact: {\n $ref: '#/definitions/Contact',\n },\n license: {\n $ref: '#/definitions/License',\n },\n version: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Contact: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n email: {\n type: 'string',\n format: 'email',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n License: {\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Server: {\n type: 'object',\n required: ['url'],\n properties: {\n url: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n variables: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/ServerVariable',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ServerVariable: {\n type: 'object',\n required: ['default'],\n properties: {\n enum: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n default: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Components: {\n type: 'object',\n properties: {\n schemas: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n responses: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Response',\n },\n ],\n },\n },\n },\n parameters: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Parameter',\n },\n ],\n },\n },\n },\n examples: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Example',\n },\n ],\n },\n },\n },\n requestBodies: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/RequestBody',\n },\n ],\n },\n },\n },\n headers: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Header',\n },\n ],\n },\n },\n },\n securitySchemes: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/SecurityScheme',\n },\n ],\n },\n },\n },\n links: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Link',\n },\n ],\n },\n },\n },\n callbacks: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Callback',\n },\n ],\n },\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Schema: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n type: 'number',\n },\n exclusiveMaximum: {\n type: 'boolean',\n default: false,\n },\n minimum: {\n type: 'number',\n },\n exclusiveMinimum: {\n type: 'boolean',\n default: false,\n },\n maxLength: {\n type: 'integer',\n minimum: 0,\n },\n minLength: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n pattern: {\n type: 'string',\n format: 'regex',\n },\n maxItems: {\n type: 'integer',\n minimum: 0,\n },\n minItems: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n uniqueItems: {\n type: 'boolean',\n default: false,\n },\n maxProperties: {\n type: 'integer',\n minimum: 0,\n },\n minProperties: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n required: {\n type: 'array',\n items: {\n type: 'string',\n },\n minItems: 1,\n uniqueItems: true,\n },\n enum: {\n type: 'array',\n items: {},\n minItems: 1,\n uniqueItems: false,\n },\n type: {\n type: 'string',\n enum: ['array', 'boolean', 'integer', 'number', 'object', 'string'],\n },\n not: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n allOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n oneOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n anyOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n properties: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n {\n type: 'boolean',\n },\n ],\n default: true,\n },\n description: {\n type: 'string',\n },\n format: {\n type: 'string',\n },\n default: {},\n nullable: {\n type: 'boolean',\n default: false,\n },\n discriminator: {\n $ref: '#/definitions/Discriminator',\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n writeOnly: {\n type: 'boolean',\n default: false,\n },\n example: {},\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n xml: {\n $ref: '#/definitions/XML',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Discriminator: {\n type: 'object',\n required: ['propertyName'],\n properties: {\n propertyName: {\n type: 'string',\n },\n mapping: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n },\n XML: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n namespace: {\n type: 'string',\n format: 'uri',\n },\n prefix: {\n type: 'string',\n },\n attribute: {\n type: 'boolean',\n default: false,\n },\n wrapped: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Response: {\n type: 'object',\n required: ['description'],\n properties: {\n description: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Header',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n },\n links: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Link',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n MediaType: {\n type: 'object',\n properties: {\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n encoding: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/Encoding',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n ],\n },\n Example: {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n value: {},\n externalValue: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Header: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n required: {\n type: 'boolean',\n default: false,\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n },\n style: {\n type: 'string',\n enum: ['simple'],\n default: 'simple',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n minProperties: 1,\n maxProperties: 1,\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n {\n $ref: '#/definitions/SchemaXORContent',\n },\n ],\n },\n Paths: {\n type: 'object',\n patternProperties: {\n '^\\\\/': {\n $ref: '#/definitions/PathItem',\n },\n '^x-': {},\n },\n additionalProperties: false,\n },\n PathItem: {\n type: 'object',\n properties: {\n $ref: {\n type: 'string',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n parameters: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Parameter',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n uniqueItems: true,\n },\n },\n patternProperties: {\n '^(get|put|post|delete|options|head|patch|trace)$': {\n $ref: '#/definitions/Operation',\n },\n '^x-': {},\n },\n additionalProperties: false,\n },\n Operation: {\n type: 'object',\n required: ['responses'],\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n operationId: {\n type: 'string',\n },\n parameters: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Parameter',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n uniqueItems: true,\n },\n requestBody: {\n oneOf: [\n {\n $ref: '#/definitions/RequestBody',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n responses: {\n $ref: '#/definitions/Responses',\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Callback',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/SecurityRequirement',\n },\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Responses: {\n type: 'object',\n properties: {\n default: {\n oneOf: [\n {\n $ref: '#/definitions/Response',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n patternProperties: {\n '^[1-5](?:\\\\d{2}|XX)$': {\n oneOf: [\n {\n $ref: '#/definitions/Response',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n '^x-': {},\n },\n minProperties: 1,\n additionalProperties: false,\n },\n SecurityRequirement: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n Tag: {\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ExternalDocumentation: {\n type: 'object',\n required: ['url'],\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ExampleXORExamples: {\n description: 'Example and examples are mutually exclusive',\n not: {\n required: ['example', 'examples'],\n },\n },\n SchemaXORContent: {\n description: 'Schema and content are mutually exclusive, at least one is required',\n not: {\n required: ['schema', 'content'],\n },\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n description: 'Some properties are not allowed if content is present',\n allOf: [\n {\n not: {\n required: ['style'],\n },\n },\n {\n not: {\n required: ['explode'],\n },\n },\n {\n not: {\n required: ['allowReserved'],\n },\n },\n {\n not: {\n required: ['example'],\n },\n },\n {\n not: {\n required: ['examples'],\n },\n },\n ],\n },\n ],\n },\n Parameter: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n required: {\n type: 'boolean',\n default: false,\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n },\n style: {\n type: 'string',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n minProperties: 1,\n maxProperties: 1,\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n required: ['name', 'in'],\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n {\n $ref: '#/definitions/SchemaXORContent',\n },\n {\n $ref: '#/definitions/ParameterLocation',\n },\n ],\n },\n ParameterLocation: {\n description: 'Parameter location',\n oneOf: [\n {\n description: 'Parameter in path',\n required: ['required'],\n properties: {\n in: {\n enum: ['path'],\n },\n style: {\n enum: ['matrix', 'label', 'simple'],\n default: 'simple',\n },\n required: {\n enum: [true],\n },\n },\n },\n {\n description: 'Parameter in query',\n properties: {\n in: {\n enum: ['query'],\n },\n style: {\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n default: 'form',\n },\n },\n },\n {\n description: 'Parameter in header',\n properties: {\n in: {\n enum: ['header'],\n },\n style: {\n enum: ['simple'],\n default: 'simple',\n },\n },\n },\n {\n description: 'Parameter in cookie',\n properties: {\n in: {\n enum: ['cookie'],\n },\n style: {\n enum: ['form'],\n default: 'form',\n },\n },\n },\n ],\n },\n RequestBody: {\n type: 'object',\n required: ['content'],\n properties: {\n description: {\n type: 'string',\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n },\n required: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n SecurityScheme: {\n oneOf: [\n {\n $ref: '#/definitions/APIKeySecurityScheme',\n },\n {\n $ref: '#/definitions/HTTPSecurityScheme',\n },\n {\n $ref: '#/definitions/OAuth2SecurityScheme',\n },\n {\n $ref: '#/definitions/OpenIdConnectSecurityScheme',\n },\n ],\n },\n APIKeySecurityScheme: {\n type: 'object',\n required: ['type', 'name', 'in'],\n properties: {\n type: {\n type: 'string',\n enum: ['apiKey'],\n },\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n enum: ['header', 'query', 'cookie'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n HTTPSecurityScheme: {\n type: 'object',\n required: ['scheme', 'type'],\n properties: {\n scheme: {\n type: 'string',\n },\n bearerFormat: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n type: {\n type: 'string',\n enum: ['http'],\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n oneOf: [\n {\n description: 'Bearer',\n properties: {\n scheme: {\n enum: ['bearer'],\n },\n },\n },\n {\n description: 'Non Bearer',\n not: {\n required: ['bearerFormat'],\n },\n properties: {\n scheme: {\n not: {\n enum: ['bearer'],\n },\n },\n },\n },\n ],\n },\n OAuth2SecurityScheme: {\n type: 'object',\n required: ['type', 'flows'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flows: {\n $ref: '#/definitions/OAuthFlows',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n OpenIdConnectSecurityScheme: {\n type: 'object',\n required: ['type', 'openIdConnectUrl'],\n properties: {\n type: {\n type: 'string',\n enum: ['openIdConnect'],\n },\n openIdConnectUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n OAuthFlows: {\n type: 'object',\n properties: {\n implicit: {\n $ref: '#/definitions/ImplicitOAuthFlow',\n },\n password: {\n $ref: '#/definitions/PasswordOAuthFlow',\n },\n clientCredentials: {\n $ref: '#/definitions/ClientCredentialsFlow',\n },\n authorizationCode: {\n $ref: '#/definitions/AuthorizationCodeOAuthFlow',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ImplicitOAuthFlow: {\n type: 'object',\n required: ['authorizationUrl', 'scopes'],\n properties: {\n authorizationUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n PasswordOAuthFlow: {\n type: 'object',\n required: ['tokenUrl', 'scopes'],\n properties: {\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ClientCredentialsFlow: {\n type: 'object',\n required: ['tokenUrl', 'scopes'],\n properties: {\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n AuthorizationCodeOAuthFlow: {\n type: 'object',\n required: ['authorizationUrl', 'tokenUrl', 'scopes'],\n properties: {\n authorizationUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Link: {\n type: 'object',\n properties: {\n operationId: {\n type: 'string',\n },\n operationRef: {\n type: 'string',\n format: 'uri-reference',\n },\n parameters: {\n type: 'object',\n additionalProperties: {},\n },\n requestBody: {},\n description: {\n type: 'string',\n },\n server: {\n $ref: '#/definitions/Server',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n not: {\n description: 'Operation Id and Operation Ref are mutually exclusive',\n required: ['operationId', 'operationRef'],\n },\n },\n Callback: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/PathItem',\n },\n patternProperties: {\n '^x-': {},\n },\n },\n Encoding: {\n type: 'object',\n properties: {\n contentType: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/Header',\n },\n },\n style: {\n type: 'string',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n },\n additionalProperties: false,\n },\n },\n};\n\nconst OAS_3_1 = {\n $id: 'https://spec.openapis.org/oas/3.1/schema/2021-09-28',\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n type: 'object',\n properties: {\n openapi: {\n type: 'string',\n pattern: '^3\\\\.1\\\\.\\\\d+(-.+)?$',\n },\n info: {\n $ref: '#/$defs/info',\n },\n jsonSchemaDialect: {\n type: 'string',\n format: 'uri',\n default: 'https://spec.openapis.org/oas/3.1/dialect/base',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n paths: {\n $ref: '#/$defs/paths',\n },\n webhooks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n components: {\n $ref: '#/$defs/components',\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/$defs/security-requirement',\n },\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/$defs/tag',\n },\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n },\n required: ['openapi', 'info'],\n anyOf: [\n {\n required: ['paths'],\n errorMessage: 'The document must have either \"paths\", \"webhooks\" or \"components\"',\n },\n {\n required: ['components'],\n },\n {\n required: ['webhooks'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n $defs: {\n info: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n termsOfService: {\n type: 'string',\n },\n contact: {\n $ref: '#/$defs/contact',\n },\n license: {\n $ref: '#/$defs/license',\n },\n version: {\n type: 'string',\n },\n },\n required: ['title', 'version'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n contact: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n },\n email: {\n type: 'string',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n license: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n identifier: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['name'],\n oneOf: [\n {\n required: ['identifier'],\n },\n {\n required: ['url'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n server: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n format: 'uri-template',\n },\n description: {\n type: 'string',\n },\n variables: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/server-variable',\n },\n },\n },\n required: ['url'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'server-variable': {\n type: 'object',\n properties: {\n enum: {\n type: 'array',\n items: {\n type: 'string',\n },\n minItems: 1,\n },\n default: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n required: ['default'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n components: {\n type: 'object',\n properties: {\n schemas: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/schema',\n },\n },\n responses: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/response-or-reference',\n },\n },\n parameters: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n examples: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/example-or-reference',\n },\n },\n requestBodies: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/request-body-or-reference',\n },\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n securitySchemes: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/security-scheme-or-reference',\n },\n },\n links: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/link-or-reference',\n },\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/callbacks-or-reference',\n },\n },\n pathItems: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n },\n patternProperties: {\n '^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$': {\n $comment:\n 'Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected',\n propertyNames: {\n pattern: '^[a-zA-Z0-9._-]+$',\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n paths: {\n type: 'object',\n patternProperties: {\n '^/': {\n $ref: '#/$defs/path-item',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'path-item': {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n parameters: {\n type: 'array',\n items: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n },\n patternProperties: {\n '^(get|put|post|delete|options|head|patch|trace)$': {\n $ref: '#/$defs/operation',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'path-item-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/path-item',\n },\n },\n operation: {\n type: 'object',\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n operationId: {\n type: 'string',\n },\n parameters: {\n type: 'array',\n items: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n requestBody: {\n $ref: '#/$defs/request-body-or-reference',\n },\n responses: {\n $ref: '#/$defs/responses',\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/callbacks-or-reference',\n },\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/$defs/security-requirement',\n },\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'external-documentation': {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['url'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n parameter: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n in: {\n enum: ['query', 'header', 'path', 'cookie'],\n },\n description: {\n type: 'string',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n allowEmptyValue: {\n default: false,\n type: 'boolean',\n },\n schema: {\n $ref: '#/$defs/schema',\n },\n content: {\n $ref: '#/$defs/content',\n },\n },\n required: ['in'],\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n },\n ],\n dependentSchemas: {\n schema: {\n properties: {\n style: {\n type: 'string',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n default: false,\n type: 'boolean',\n },\n },\n allOf: [\n {\n $ref: '#/$defs/examples',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form',\n },\n ],\n $defs: {\n 'styles-for-path': {\n if: {\n properties: {\n in: {\n const: 'path',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n name: {\n pattern: '[^/#?]+$',\n },\n style: {\n default: 'simple',\n enum: ['matrix', 'label', 'simple'],\n },\n required: {\n const: true,\n },\n },\n required: ['required'],\n },\n },\n 'styles-for-header': {\n if: {\n properties: {\n in: {\n const: 'header',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'simple',\n const: 'simple',\n },\n },\n },\n },\n 'styles-for-query': {\n if: {\n properties: {\n in: {\n const: 'query',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'form',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n },\n },\n },\n 'styles-for-cookie': {\n if: {\n properties: {\n in: {\n const: 'cookie',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'form',\n const: 'form',\n },\n },\n },\n },\n 'styles-for-form': {\n if: {\n properties: {\n style: {\n const: 'form',\n },\n },\n required: ['style'],\n },\n then: {\n properties: {\n explode: {\n default: true,\n },\n },\n },\n else: {\n properties: {\n explode: {\n default: false,\n },\n },\n },\n },\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'parameter-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/parameter',\n },\n },\n 'request-body': {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n content: {\n $ref: '#/$defs/content',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n },\n required: ['content'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'request-body-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/request-body',\n },\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/media-type',\n },\n propertyNames: {\n format: 'media-range',\n },\n },\n 'media-type': {\n type: 'object',\n properties: {\n schema: {\n $ref: '#/$defs/schema',\n },\n encoding: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/encoding',\n },\n },\n },\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/examples',\n },\n ],\n unevaluatedProperties: false,\n },\n encoding: {\n type: 'object',\n properties: {\n contentType: {\n type: 'string',\n format: 'media-range',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n style: {\n default: 'form',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n default: false,\n type: 'boolean',\n },\n },\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/encoding/$defs/explode-default',\n },\n ],\n unevaluatedProperties: false,\n $defs: {\n 'explode-default': {\n if: {\n properties: {\n style: {\n const: 'form',\n },\n },\n required: ['style'],\n },\n then: {\n properties: {\n explode: {\n default: true,\n },\n },\n },\n else: {\n properties: {\n explode: {\n default: false,\n },\n },\n },\n },\n },\n },\n responses: {\n type: 'object',\n properties: {\n default: {\n $ref: '#/$defs/response-or-reference',\n },\n },\n patternProperties: {\n '^[1-5](?:[0-9]{2}|XX)$': {\n $ref: '#/$defs/response-or-reference',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n response: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n content: {\n $ref: '#/$defs/content',\n },\n links: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/link-or-reference',\n },\n },\n },\n required: ['description'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'response-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/response',\n },\n },\n callbacks: {\n type: 'object',\n $ref: '#/$defs/specification-extensions',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n 'callbacks-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/callbacks',\n },\n },\n example: {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n value: true,\n externalValue: {\n type: 'string',\n format: 'uri',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'example-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/example',\n },\n },\n link: {\n type: 'object',\n properties: {\n operationRef: {\n type: 'string',\n format: 'uri-reference',\n },\n operationId: true,\n parameters: {\n $ref: '#/$defs/map-of-strings',\n },\n requestBody: true,\n description: {\n type: 'string',\n },\n body: {\n $ref: '#/$defs/server',\n },\n },\n oneOf: [\n {\n required: ['operationRef'],\n },\n {\n required: ['operationId'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'link-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/link',\n },\n },\n header: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n schema: {\n $ref: '#/$defs/schema',\n },\n content: {\n $ref: '#/$defs/content',\n },\n },\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n },\n ],\n dependentSchemas: {\n schema: {\n properties: {\n style: {\n default: 'simple',\n const: 'simple',\n },\n explode: {\n default: false,\n type: 'boolean',\n },\n },\n $ref: '#/$defs/examples',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'header-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/header',\n },\n },\n tag: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n },\n required: ['name'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n reference: {\n type: 'object',\n properties: {\n $ref: {\n type: 'string',\n format: 'uri-reference',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n unevaluatedProperties: false,\n },\n schema: {\n $dynamicAnchor: 'meta',\n type: ['object', 'boolean'],\n },\n 'security-scheme': {\n type: 'object',\n properties: {\n type: {\n enum: ['apiKey', 'http', 'mutualTLS', 'oauth2', 'openIdConnect'],\n },\n description: {\n type: 'string',\n },\n },\n required: ['type'],\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-apikey',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-http',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-http-bearer',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-oauth2',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-oidc',\n },\n ],\n unevaluatedProperties: false,\n $defs: {\n 'type-apikey': {\n if: {\n properties: {\n type: {\n const: 'apiKey',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n name: {\n type: 'string',\n },\n in: {\n enum: ['query', 'header', 'cookie'],\n },\n },\n required: ['name', 'in'],\n },\n },\n 'type-http': {\n if: {\n properties: {\n type: {\n const: 'http',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n scheme: {\n type: 'string',\n },\n },\n required: ['scheme'],\n },\n },\n 'type-http-bearer': {\n if: {\n properties: {\n type: {\n const: 'http',\n },\n scheme: {\n type: 'string',\n pattern: '^[Bb][Ee][Aa][Rr][Ee][Rr]$',\n },\n },\n required: ['type', 'scheme'],\n },\n then: {\n properties: {\n bearerFormat: {\n type: 'string',\n },\n },\n },\n },\n 'type-oauth2': {\n if: {\n properties: {\n type: {\n const: 'oauth2',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n flows: {\n $ref: '#/$defs/oauth-flows',\n },\n },\n required: ['flows'],\n },\n },\n 'type-oidc': {\n if: {\n properties: {\n type: {\n const: 'openIdConnect',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n openIdConnectUrl: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['openIdConnectUrl'],\n },\n },\n },\n },\n 'security-scheme-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/security-scheme',\n },\n },\n 'oauth-flows': {\n type: 'object',\n properties: {\n implicit: {\n $ref: '#/$defs/oauth-flows/$defs/implicit',\n },\n password: {\n $ref: '#/$defs/oauth-flows/$defs/password',\n },\n clientCredentials: {\n $ref: '#/$defs/oauth-flows/$defs/client-credentials',\n },\n authorizationCode: {\n $ref: '#/$defs/oauth-flows/$defs/authorization-code',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n $defs: {\n implicit: {\n type: 'object',\n properties: {\n authorizationUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['authorizationUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n password: {\n type: 'object',\n properties: {\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'client-credentials': {\n type: 'object',\n properties: {\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'authorization-code': {\n type: 'object',\n properties: {\n authorizationUrl: {\n type: 'string',\n },\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['authorizationUrl', 'tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n },\n },\n 'security-requirement': {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n 'specification-extensions': {\n patternProperties: {\n '^x-': true,\n },\n },\n examples: {\n properties: {\n example: true,\n examples: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/example-or-reference',\n },\n },\n },\n },\n 'map-of-strings': {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n};\n\nconst OAS_SCHEMAS = {\n '2.0': OAS_2,\n '3.0': OAS_3,\n 3.1: OAS_3_1,\n};\n\nfunction shouldIgnoreError(error) {\n return (\n // oneOf is a fairly error as we have 2 options to choose from for most of the time.\n error.keyword === 'oneOf' ||\n // the required $ref is entirely useless, since oas-schema rules operate on resolved content, so there won't be any $refs in the document\n (error.keyword === 'required' && error.params.missingProperty === '$ref')\n );\n}\n\n// this is supposed to cover edge cases we need to cover manually, when it's impossible to detect the most appropriate error, i.e. oneOf consisting of more than 3 members, etc.\n// note, more errors can be included if certain messages reported by AJV are not quite meaningful\nconst ERROR_MAP = [\n {\n path: /^components\\/securitySchemes\\/[^/]+$/,\n message: 'Invalid security scheme',\n },\n];\n\n// The function removes irrelevant (aka misleading, confusing, useless, whatever you call it) errors.\n// There are a few exceptions, i.e. security components I covered manually,\n// yet apart from them we usually deal with a relatively simple scenario that can be literally expressed as: \"either proper value of $ref property\".\n// The $ref part is never going to be interesting for us, because both oas-schema rules operate on resolved content, so we won't have any $refs left.\n// As you can see, what we deal here wit is actually not really oneOf anymore - it's always the first member of oneOf we match against.\n// That being said, we always strip both oneOf and $ref, since we are always interested in the first error.\nexport function prepareResults(errors) {\n // Update additionalProperties errors to make them more precise and prevent them from being treated as duplicates\n for (const error of errors) {\n if (error.keyword === 'additionalProperties') {\n error.instancePath = `${error.instancePath}/${String(error.params['additionalProperty'])}`;\n }\n }\n\n for (let i = 0; i < errors.length; i++) {\n const error = errors[i];\n\n if (i + 1 < errors.length && errors[i + 1].instancePath === error.instancePath) {\n errors.splice(i + 1, 1);\n i--;\n } else if (i > 0 && shouldIgnoreError(error) && errors[i - 1].instancePath.startsWith(error.instancePath)) {\n errors.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction applyManualReplacements(errors) {\n for (const error of errors) {\n if (error.path === void 0) continue;\n\n const joinedPath = error.path.join('/');\n\n for (const mappedError of ERROR_MAP) {\n if (mappedError.path.test(joinedPath)) {\n error.message = mappedError.message;\n break;\n }\n }\n }\n}\n\nexport default createRulesetFunction(\n {\n input: null,\n options: null,\n },\n function oasDocumentSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n if (formats === null || formats === void 0) return;\n\n const schema = formats.has(oas2)\n ? OAS_SCHEMAS['2.0']\n : formats.has(oas3_1)\n ? OAS_SCHEMAS['3.1']\n : OAS_SCHEMAS['3.0'];\n\n const errors = schemaFn(targetVal, { allErrors: true, schema, prepareResults }, context);\n\n if (Array.isArray(errors)) {\n applyManualReplacements(errors);\n }\n\n return errors;\n },\n);\n"
|
|
},
|
|
{
|
|
"id": "TCBHm5OxPc41eilAPNn_C",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasDiscriminator",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nexport const oasDiscriminator = (schema, _opts, { path }) => {\n /**\n * This function verifies:\n *\n * 1. The discriminator property name is defined at this schema.\n * 2. The discriminator property is in the required property list.\n */\n\n if (!isObject(schema)) return;\n\n if (typeof schema.discriminator !== 'string') return;\n\n const discriminatorName = schema.discriminator;\n\n const results = [];\n\n if (!isObject(schema.properties) || !Object.keys(schema.properties).some(k => k === discriminatorName)) {\n results.push({\n message: `The discriminator property must be defined in this schema.`,\n path: [...path, 'properties'],\n });\n }\n\n if (!Array.isArray(schema.required) || !schema.required.some(n => n === discriminatorName)) {\n results.push({\n message: `The discriminator property must be in the required property list.`,\n path: [...path, 'required'],\n });\n }\n\n return results;\n};\n\nexport default oasDiscriminator;\n"
|
|
},
|
|
{
|
|
"id": "OtlFJeCa6BT2018oIbRcT",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasExample",
|
|
"content": "import { isPlainObject, pointerToPath } from '@stoplight/json';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas2, oas3_1, extractDraftVersion, oas3_0 } from '@stoplight/spectral-formats';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport traverse from 'json-schema-traverse';\n\nconst MEDIA_VALIDATION_ITEMS = {\n 2: [\n {\n field: 'examples',\n multiple: true,\n keyed: false,\n },\n ],\n 3: [\n {\n field: 'example',\n multiple: false,\n keyed: false,\n },\n {\n field: 'examples',\n multiple: true,\n keyed: true,\n },\n ],\n};\n\nconst SCHEMA_VALIDATION_ITEMS = {\n 2: ['example', 'x-example', 'default'],\n 3: ['example', 'default'],\n};\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction rewriteNullable(schema, errors) {\n for (const error of errors) {\n if (error.keyword !== 'type') continue;\n const value = getSchemaProperty(schema, error.schemaPath);\n if (isPlainObject(value) && value.nullable === true) {\n error.message += ',null';\n }\n }\n}\n\nconst visitOAS2 = schema => {\n if (schema['x-nullable'] === true) {\n schema.nullable = true;\n delete schema['x-nullable'];\n }\n};\n\nfunction getSchemaProperty(schema, schemaPath) {\n const path = pointerToPath(schemaPath);\n let value = schema;\n\n for (const fragment of path.slice(0, -1)) {\n if (!isPlainObject(value)) {\n return;\n }\n\n value = value[fragment];\n }\n\n return value;\n}\n\nconst oasSchema = createRulesetFunction(\n {\n input: null,\n options: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n },\n },\n additionalProperties: false,\n },\n },\n function oasSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n\n let { schema } = opts;\n\n let dialect = 'draft4';\n let prepareResults;\n\n if (!formats) {\n dialect = 'auto';\n } else if (formats.has(oas3_1)) {\n if (isPlainObject(context.document.data) && typeof context.document.data.jsonSchemaDialect === 'string') {\n dialect = extractDraftVersion(context.document.data.jsonSchemaDialect) ?? 'draft2020-12';\n } else {\n dialect = 'draft2020-12';\n }\n } else if (formats.has(oas3_0)) {\n prepareResults = rewriteNullable.bind(null, schema);\n } else if (formats.has(oas2)) {\n const clonedSchema = JSON.parse(JSON.stringify(schema));\n traverse(clonedSchema, visitOAS2);\n schema = clonedSchema;\n prepareResults = rewriteNullable.bind(null, clonedSchema);\n }\n\n return schemaFn(\n targetVal,\n {\n ...opts,\n schema,\n prepareResults,\n dialect,\n },\n context,\n );\n },\n);\n\nfunction* getMediaValidationItems(items, targetVal, givenPath, oasVersion) {\n for (const { field, keyed, multiple } of items) {\n if (!(field in targetVal)) {\n continue;\n }\n\n const value = targetVal[field];\n\n if (multiple) {\n if (!isObject(value)) continue;\n\n for (const exampleKey of Object.keys(value)) {\n const exampleValue = value[exampleKey];\n if (oasVersion === 3 && keyed && (!isObject(exampleValue) || 'externalValue' in exampleValue)) {\n // should be covered by oas3-examples-value-or-externalValue\n continue;\n }\n\n const targetPath = [...givenPath, field, exampleKey];\n\n if (keyed) {\n targetPath.push('value');\n }\n\n yield {\n value: keyed && isObject(exampleValue) ? exampleValue.value : exampleValue,\n path: targetPath,\n };\n }\n\n return;\n } else {\n return yield {\n value,\n path: [...givenPath, field],\n };\n }\n }\n}\n\nfunction* getSchemaValidationItems(fields, targetVal, givenPath) {\n for (const field of fields) {\n if (!(field in targetVal)) {\n continue;\n }\n\n yield {\n value: targetVal[field],\n path: [...givenPath, field],\n };\n }\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n },\n options: {\n type: 'object',\n properties: {\n oasVersion: {\n enum: ['2', '3'],\n },\n schemaField: {\n type: 'string',\n },\n type: {\n enum: ['media', 'schema'],\n },\n },\n additionalProperties: false,\n },\n },\n function oasExample(targetVal, opts, context) {\n const formats = context.document.formats;\n const schemaOpts = {\n schema: opts.schemaField === '$' ? targetVal : targetVal[opts.schemaField],\n };\n\n let results = void 0;\n let oasVersion = parseInt(opts.oasVersion);\n\n const validationItems =\n opts.type === 'schema'\n ? getSchemaValidationItems(SCHEMA_VALIDATION_ITEMS[oasVersion], targetVal, context.path)\n : getMediaValidationItems(MEDIA_VALIDATION_ITEMS[oasVersion], targetVal, context.path, oasVersion);\n\n if (formats?.has(oas2) && 'required' in schemaOpts.schema && typeof schemaOpts.schema.required === 'boolean') {\n schemaOpts.schema = { ...schemaOpts.schema };\n delete schemaOpts.schema.required;\n }\n\n for (const validationItem of validationItems) {\n const result = oasSchema(validationItem.value, schemaOpts, {\n ...context,\n path: validationItem.path,\n });\n\n if (Array.isArray(result)) {\n if (results === void 0) results = [];\n results.push(...result);\n }\n }\n\n return results;\n },\n);\n"
|
|
},
|
|
{
|
|
"id": "N47XoAa8S4_ygYIvmbIwT",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasOpFormDataConsumeCheck",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validConsumeValue = /(application\\/x-www-form-urlencoded|multipart\\/form-data)/;\n\nexport const oasOpFormDataConsumeCheck = targetVal => {\n if (!isObject(targetVal)) return;\n\n const parameters = targetVal.parameters;\n const consumes = targetVal.consumes;\n\n if (!Array.isArray(parameters) || !Array.isArray(consumes)) {\n return;\n }\n\n if (parameters.some(p => isObject(p) && p.in === 'formData') && !validConsumeValue.test(consumes?.join(','))) {\n return [\n {\n message: 'Consumes must include urlencoded, multipart, or form-data media type when using formData parameter.',\n },\n ];\n }\n\n return;\n};\n\nexport default oasOpFormDataConsumeCheck;\n"
|
|
},
|
|
{
|
|
"id": "Z8l4HbUPAu471CXgDdLSf",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasOpIdUnique",
|
|
"content": "import { isPlainObject } from '@stoplight/json';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nexport const oasOpIdUnique = targetVal => {\n if (!isObject(targetVal) || !isObject(targetVal.paths)) return;\n\n const results = [];\n\n const { paths } = targetVal;\n\n const seenIds = [];\n\n for (const { path, operation } of getAllOperations(paths)) {\n const pathValue = paths[path];\n\n if (!isObject(pathValue)) continue;\n\n const operationValue = pathValue[operation];\n\n if (!isObject(operationValue) || !('operationId' in operationValue)) {\n continue;\n }\n\n const { operationId } = operationValue;\n\n if (seenIds.includes(operationId)) {\n results.push({\n message: 'operationId must be unique.',\n path: ['paths', path, operation, 'operationId'],\n });\n } else {\n seenIds.push(operationId);\n }\n }\n\n return results;\n};\n\nexport default oasOpIdUnique;\n"
|
|
},
|
|
{
|
|
"id": "OWzpCDMNCSWnS-6EFqEcQ",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasOpParams",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction computeFingerprint(param) {\n return `${String(param.in)}-${String(param.name)}`;\n}\n\nexport const oasOpParams = (params, _opts, { path }) => {\n /**\n * This function verifies:\n *\n * 1. Operations must have unique `name` + `in` parameters.\n * 2. Operation cannot have both `in:body` and `in:formData` parameters\n * 3. Operation must have only one `in:body` parameter.\n */\n\n if (!Array.isArray(params)) return;\n\n if (params.length < 2) return;\n\n const results = [];\n\n const count = {\n body: [],\n formData: [],\n };\n const list = [];\n const duplicates = [];\n\n let index = -1;\n\n for (const param of params) {\n index++;\n\n if (!isObject(param)) continue;\n\n // skip params that are refs\n if ('$ref' in param) continue;\n\n // Operations must have unique `name` + `in` parameters.\n const fingerprint = computeFingerprint(param);\n if (list.includes(fingerprint)) {\n duplicates.push(index);\n } else {\n list.push(fingerprint);\n }\n\n if (typeof param.in === 'string' && param.in in count) {\n count[param.in].push(index);\n }\n }\n\n if (duplicates.length > 0) {\n for (const i of duplicates) {\n results.push({\n message: 'A parameter in this operation already exposes the same combination of \"name\" and \"in\" values.',\n path: [...path, i],\n });\n }\n }\n\n if (count.body.length > 0 && count.formData.length > 0) {\n results.push({\n message: 'Operation must not have both \"in:body\" and \"in:formData\" parameters.',\n });\n }\n\n if (count.body.length > 1) {\n for (let i = 1; i < count.body.length; i++) {\n results.push({\n message: 'Operation must not have more than a single instance of the \"in:body\" parameter.',\n path: [...path, count.body[i]],\n });\n }\n }\n\n return results;\n};\n\nexport default oasOpParams;\n"
|
|
},
|
|
{
|
|
"id": "w9d3YjBzUJM1-AByzQe0g",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasOpSecurityDefined",
|
|
"content": "import { isPlainObject } from '@stoplight/json';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nfunction _get(value, path) {\n for (const segment of path) {\n if (!isObject(value)) {\n break;\n }\n\n value = value[segment];\n }\n\n return value;\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n paths: {\n type: 'object',\n },\n security: {\n type: 'array',\n },\n },\n },\n options: {\n type: 'object',\n properties: {\n schemesPath: {\n type: 'array',\n items: {\n type: ['string', 'number'],\n },\n },\n },\n },\n },\n function oasOpSecurityDefined(targetVal, { schemesPath }) {\n const { paths } = targetVal;\n\n const results = [];\n\n const schemes = _get(targetVal, schemesPath);\n const allDefs = isObject(schemes) ? Object.keys(schemes) : [];\n\n // Check global security requirements\n\n const { security } = targetVal;\n\n if (Array.isArray(security)) {\n for (const [index, value] of security.entries()) {\n if (!isObject(value)) {\n continue;\n }\n\n const securityKeys = Object.keys(value);\n\n for (const securityKey of securityKeys) {\n if (!allDefs.includes(securityKey)) {\n results.push({\n message: `API \"security\" values must match a scheme defined in the \"${schemesPath.join('.')}\" object.`,\n path: ['security', index, securityKey],\n });\n }\n }\n }\n }\n\n for (const { path, operation, value } of getAllOperations(paths)) {\n if (!isObject(value)) continue;\n\n const { security } = value;\n\n if (!Array.isArray(security)) {\n continue;\n }\n\n for (const [index, value] of security.entries()) {\n if (!isObject(value)) {\n continue;\n }\n\n const securityKeys = Object.keys(value);\n\n for (const securityKey of securityKeys) {\n if (!allDefs.includes(securityKey)) {\n results.push({\n message: `Operation \"security\" values must match a scheme defined in the \"${schemesPath.join(\n '.',\n )}\" object.`,\n path: ['paths', path, operation, 'security', index, securityKey],\n });\n }\n }\n }\n }\n\n return results;\n },\n);\n"
|
|
},
|
|
{
|
|
"id": "F8ywz19bs2Pt47eDmY4As",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasOpSuccessResponse",
|
|
"content": "import { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas3 } from '@stoplight/spectral-formats';\n\nexport const oasOpSuccessResponse = createRulesetFunction(\n {\n input: {\n type: 'object',\n },\n options: null,\n },\n (input, opts, context) => {\n const isOAS3X = context.document.formats?.has(oas3) === true;\n\n for (const response of Object.keys(input)) {\n if (isOAS3X && (response === '2XX' || response === '3XX')) {\n return;\n }\n\n if (Number(response) >= 200 && Number(response) < 400) {\n return;\n }\n }\n\n return [\n {\n message: 'Operation must define at least a single 2xx or 3xx response',\n },\n ];\n },\n);\n\nexport default oasOpSuccessResponse;\n"
|
|
},
|
|
{
|
|
"id": "716_HvToVqNqtvt_dOpSV",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasPathParam",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst pathRegex = /(\\{;?\\??[a-zA-Z0-9_-]+\\*?\\})/g;\n\nconst isNamedPathParam = p => {\n return p.in !== void 0 && p.in === 'path' && p.name !== void 0;\n};\n\nconst isUnknownNamedPathParam = (p, path, results, seen) => {\n if (!isNamedPathParam(p)) {\n return false;\n }\n\n if (p.required !== true) {\n results.push(generateResult(requiredMessage(p.name), path));\n }\n\n if (p.name in seen) {\n results.push(generateResult(uniqueDefinitionMessage(p.name), path));\n return false;\n }\n\n return true;\n};\n\nconst ensureAllDefinedPathParamsAreUsedInPath = (path, params, expected, results) => {\n for (const p of Object.keys(params)) {\n if (!params[p]) {\n continue;\n }\n\n if (!expected.includes(p)) {\n const resPath = params[p];\n results.push(generateResult(`Parameter \"${p}\" must be used in path \"${path}\".`, resPath));\n }\n }\n};\n\nconst ensureAllExpectedParamsInPathAreDefined = (path, params, expected, operationPath, results) => {\n for (const p of expected) {\n if (!(p in params)) {\n results.push(\n generateResult(`Operation must define parameter \"{${p}}\" as expected by path \"${path}\".`, operationPath),\n );\n }\n }\n};\n\nexport const oasPathParam = targetVal => {\n /**\n * This rule verifies:\n *\n * 1. for every param referenced in the path string ie /users/{userId}, var must be defined in either\n * path.parameters, or operation.parameters object\n * 2. every path.parameters + operation.parameters property must be used in the path string\n */\n\n if (!isObject(targetVal) || !isObject(targetVal.paths)) {\n return;\n }\n\n const results = [];\n\n // keep track of normalized paths for verifying paths are unique\n const uniquePaths = {};\n const validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\n for (const path of Object.keys(targetVal.paths)) {\n const pathValue = targetVal.paths[path];\n if (!isObject(pathValue)) continue;\n\n // verify normalized paths are functionally unique (ie `/path/{one}` vs `/path/{two}` are\n // different but equivalent within the context of OAS)\n const normalized = path.replace(pathRegex, '%'); // '%' is used here since its invalid in paths\n if (normalized in uniquePaths) {\n results.push(\n generateResult(`Paths \"${String(uniquePaths[normalized])}\" and \"${path}\" must not be equivalent.`, [\n 'paths',\n path,\n ]),\n );\n } else {\n uniquePaths[normalized] = path;\n }\n\n // find all templated path parameters\n const pathElements = [];\n let match;\n\n while ((match = pathRegex.exec(path))) {\n const p = match[0].replace(/[{}?*;]/g, '');\n if (pathElements.includes(p)) {\n results.push(generateResult(`Path \"${path}\" must not use parameter \"{${p}}\" multiple times.`, ['paths', path]));\n } else {\n pathElements.push(p);\n }\n }\n\n // find parameters set within the top-level 'parameters' object\n const topParams = {};\n if (Array.isArray(pathValue.parameters)) {\n for (const [i, value] of pathValue.parameters.entries()) {\n if (!isObject(value)) continue;\n\n const fullParameterPath = ['paths', path, 'parameters', i];\n\n if (isUnknownNamedPathParam(value, fullParameterPath, results, topParams)) {\n topParams[value.name] = fullParameterPath;\n }\n }\n }\n\n if (isObject(targetVal.paths[path])) {\n // find parameters set within the operation's 'parameters' object\n for (const op of Object.keys(pathValue)) {\n const operationValue = pathValue[op];\n if (!isObject(operationValue)) continue;\n\n if (op === 'parameters' || !validOperationKeys.includes(op)) {\n continue;\n }\n\n const operationParams = {};\n const { parameters } = operationValue;\n const operationPath = ['paths', path, op];\n\n if (Array.isArray(parameters)) {\n for (const [i, p] of parameters.entries()) {\n if (!isObject(p)) continue;\n\n const fullParameterPath = [...operationPath, 'parameters', i];\n\n if (isUnknownNamedPathParam(p, fullParameterPath, results, operationParams)) {\n operationParams[p.name] = fullParameterPath;\n }\n }\n }\n\n const definedParams = { ...topParams, ...operationParams };\n ensureAllDefinedPathParamsAreUsedInPath(path, definedParams, pathElements, results);\n ensureAllExpectedParamsInPathAreDefined(path, definedParams, pathElements, operationPath, results);\n }\n }\n }\n\n return results;\n};\n\nfunction generateResult(message, path) {\n return {\n message,\n path,\n };\n}\n\nconst requiredMessage = name => `Path parameter \"${name}\" must have \"required\" property that is set to \"true\".`;\n\nconst uniqueDefinitionMessage = name => `Path parameter \"${name}\" must not be defined multiple times.`;\n\nexport default oasPathParam;\n"
|
|
},
|
|
{
|
|
"id": "kLV9Ie1sT_DshNjeLC9Pd",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasSchema",
|
|
"content": "import traverse from 'json-schema-traverse';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas2, oas3_1, extractDraftVersion, oas3_0 } from '@stoplight/spectral-formats';\nimport { isPlainObject, pointerToPath } from '@stoplight/json';\n\nfunction rewriteNullable(schema, errors) {\n for (const error of errors) {\n if (error.keyword !== 'type') continue;\n const value = getSchemaProperty(schema, error.schemaPath);\n if (isPlainObject(value) && value.nullable === true) {\n error.message += ',null';\n }\n }\n}\n\nexport default createRulesetFunction(\n {\n input: null,\n options: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n },\n },\n additionalProperties: false,\n },\n },\n function oasSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n\n let { schema } = opts;\n\n let dialect = 'draft4';\n let prepareResults;\n\n if (!formats) {\n dialect = 'auto';\n } else if (formats.has(oas3_1)) {\n if (isPlainObject(context.document.data) && typeof context.document.data.jsonSchemaDialect === 'string') {\n dialect = extractDraftVersion(context.document.data.jsonSchemaDialect) ?? 'draft2020-12';\n } else {\n dialect = 'draft2020-12';\n }\n } else if (formats.has(oas3_0)) {\n prepareResults = rewriteNullable.bind(null, schema);\n } else if (formats.has(oas2)) {\n const clonedSchema = JSON.parse(JSON.stringify(schema));\n traverse(clonedSchema, visitOAS2);\n schema = clonedSchema;\n prepareResults = rewriteNullable.bind(null, clonedSchema);\n }\n\n return schemaFn(\n targetVal,\n {\n ...opts,\n schema,\n prepareResults,\n dialect,\n },\n context,\n );\n },\n);\n\nconst visitOAS2 = schema => {\n if (schema['x-nullable'] === true) {\n schema.nullable = true;\n delete schema['x-nullable'];\n }\n};\n\nfunction getSchemaProperty(schema, schemaPath) {\n const path = pointerToPath(schemaPath);\n let value = schema;\n\n for (const fragment of path.slice(0, -1)) {\n if (!isPlainObject(value)) {\n return;\n }\n\n value = value[fragment];\n }\n\n return value;\n}\n"
|
|
},
|
|
{
|
|
"id": "nATVDZtz8naWcq1JhUBOi",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasTagDefined",
|
|
"content": "// This function will check an API doc to verify that any tag that appears on\n// an operation is also present in the global tags array.\nimport { isPlainObject } from '@stoplight/json';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nexport const oasTagDefined = targetVal => {\n if (!isObject(targetVal)) return;\n const results = [];\n\n const globalTags = [];\n\n if (Array.isArray(targetVal.tags)) {\n for (const tag of targetVal.tags) {\n if (isObject(tag) && typeof tag.name === 'string') {\n globalTags.push(tag.name);\n }\n }\n }\n\n const { paths } = targetVal;\n\n for (const { path, operation, value } of getAllOperations(paths)) {\n if (!isObject(value)) continue;\n\n const { tags } = value;\n\n if (!Array.isArray(tags)) {\n continue;\n }\n\n for (const [i, tag] of tags.entries()) {\n if (!globalTags.includes(tag)) {\n results.push({\n message: 'Operation tags must be defined in global tags.',\n path: ['paths', path, operation, 'tags', i],\n });\n }\n }\n }\n\n return results;\n};\n\nexport default oasTagDefined;\n"
|
|
},
|
|
{
|
|
"id": "RggENMui8iFd1JmiGYAeF",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "oasUnusedComponent",
|
|
"content": "import { unreferencedReusableObject } from '@stoplight/spectral-functions';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n components: {\n type: 'object',\n },\n },\n required: ['components'],\n },\n options: null,\n },\n function oasUnusedComponent(targetVal, opts, context) {\n const results = [];\n const componentTypes = [\n 'schemas',\n 'responses',\n 'parameters',\n 'examples',\n 'requestBodies',\n 'headers',\n 'links',\n 'callbacks',\n ];\n\n for (const type of componentTypes) {\n const value = targetVal.components[type];\n if (!isObject(value)) continue;\n\n const resultsForType = unreferencedReusableObject(\n value,\n { reusableObjectsLocation: `#/components/${type}` },\n context,\n );\n if (resultsForType !== void 0 && Array.isArray(resultsForType)) {\n results.push(...resultsForType);\n }\n }\n\n return results;\n },\n);\n"
|
|
},
|
|
{
|
|
"id": "ubvEsPYf_Lnx8ctZBQPHe",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "refSiblings",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction getParentValue(document, path) {\n if (path.length === 0) {\n return null;\n }\n\n let piece = document;\n\n for (let i = 0; i < path.length - 1; i += 1) {\n if (!isObject(piece)) {\n return null;\n }\n\n piece = piece[path[i]];\n }\n\n return piece;\n}\n\nconst refSiblings = (targetVal, opts, { document, path }) => {\n const value = getParentValue(document.data, path);\n\n if (!isObject(value)) {\n return;\n }\n\n const keys = Object.keys(value);\n if (keys.length === 1) {\n return;\n }\n\n const results = [];\n const actualObjPath = path.slice(0, -1);\n\n for (const key of keys) {\n if (key === '$ref') {\n continue;\n }\n results.push({\n message: '$ref must not be placed next to any other properties',\n path: [...actualObjPath, key],\n });\n }\n\n return results;\n};\n\nexport default refSiblings;\n"
|
|
},
|
|
{
|
|
"id": "4O4KI34UWu1h_P5u518lD",
|
|
"extendedFrom": "cHJqOjEyMzU4Ng@34",
|
|
"name": "typedEnum",
|
|
"content": "import { oas2, oas3_0 } from '@stoplight/spectral-formats';\nimport { printValue } from '@stoplight/spectral-runtime';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction getDataType(input, checkForInteger) {\n const type = typeof input;\n switch (type) {\n case 'string':\n case 'boolean':\n return type;\n case 'number':\n if (checkForInteger && Number.isInteger(input)) {\n return 'integer';\n }\n\n return 'number';\n case 'object':\n if (input === null) {\n return 'null';\n }\n\n return Array.isArray(input) ? 'array' : 'object';\n default:\n throw TypeError('Unknown input type');\n }\n}\n\nfunction getTypes(input, formats) {\n const { type } = input;\n\n if (\n (input.nullable === true && formats?.has(oas3_0) === true) ||\n (input['x-nullable'] === true && formats?.has(oas2) === true)\n ) {\n return Array.isArray(type) ? [...type, 'null'] : [type, 'null'];\n }\n\n return type;\n}\n\nexport const typedEnum = createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n enum: {\n type: 'array',\n },\n type: {\n oneOf: [\n {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n {\n type: 'string',\n },\n ],\n },\n },\n required: ['enum', 'type'],\n },\n options: null,\n },\n function (input, opts, context) {\n const { enum: enumValues } = input;\n const type = getTypes(input, context.document.formats);\n const checkForInteger = type === 'integer' || (Array.isArray(type) && type.includes('integer'));\n\n let results;\n\n enumValues.forEach((value, i) => {\n const valueType = getDataType(value, checkForInteger);\n\n if (valueType === type || (Array.isArray(type) && type.includes(valueType))) {\n return;\n }\n\n results ??= [];\n results.push({\n message: `Enum value ${printValue(enumValues[i])} must be \"${String(type)}\".`,\n path: [...context.path, 'enum', i],\n });\n });\n\n return results;\n },\n);\n\nexport default typedEnum;\n"
|
|
}
|
|
],
|
|
"library": {
|
|
"cHJqOjEyMzU4Ng@34": {
|
|
"name": "Stoplight Style Guide",
|
|
"description": "## Stoplight Style Guide\n\nStoplight's built-in style guide contains style and validation rules for OAS (OpenAPI specification) 2 and 3.x. \n\nThis built-in style guide is always initially enabled for Stoplight API projects. \n\nYou can:\n\n- Use the style guide as-is to [automatically lint](https://meta.stoplight.io/docs/platform/7975f76a794c4-validation-and-linting) your API files\n- [Disable individual rules](https://meta.stoplight.io/docs/platform/3f80fd36750e3-disable-inherited-rules) that do not follow your organization's standards\n- [Disable the entire style guide](https://meta.stoplight.io/docs/platform/ff8502dfbe156-enable-a-style-guide#disable-a-style-guide)\n- [Reuse and customtize rules](https://meta.stoplight.io/docs/platform/2331c5241ddfc) to meet your needs\n\n> For best results, never disable the `oas2-schema` and `oas3-schema` rules. These rules validate the structure of your API document against the OpenAPI specification.",
|
|
"spectralExtends": [],
|
|
"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.* ",
|
|
"name": "API_Document",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$"
|
|
}
|
|
]
|
|
},
|
|
"API_Description": {
|
|
"description": "The top level description in an API document",
|
|
"name": "API_Description",
|
|
"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.",
|
|
"name": "Operation_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.",
|
|
"name": "Operation_Responses",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "#Operation_Object.responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "#Operation_Object.responses"
|
|
}
|
|
]
|
|
},
|
|
"Path_Item": {
|
|
"name": "Path_Item",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.paths[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths[*]"
|
|
}
|
|
]
|
|
},
|
|
"API_Contact": {
|
|
"description": "The top level description in an API document",
|
|
"name": "API_Contact",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.info.contact"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.info.contact"
|
|
}
|
|
]
|
|
},
|
|
"API_License": {
|
|
"description": "The top level description in an API document",
|
|
"name": "API_License",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.info.license"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.info.license"
|
|
}
|
|
]
|
|
},
|
|
"All_Markdown": {
|
|
"description": "All markdown descriptions across the document.",
|
|
"name": "All_Markdown",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..[description,title]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..[description,title]"
|
|
}
|
|
]
|
|
},
|
|
"API_Tags": {
|
|
"description": "Tags on an API object",
|
|
"name": "API_Tags",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "#Operation_Object.tags"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "#Operation_Object.tags"
|
|
}
|
|
]
|
|
},
|
|
"API_Server": {
|
|
"description": "API hosts defined in the API specification",
|
|
"name": "API_Server",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.servers"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.host"
|
|
}
|
|
]
|
|
},
|
|
"Response_All_Object": {
|
|
"description": "All responses (object) in an API",
|
|
"name": "Response_All_Object",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "#Operation_Responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.components.responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "#Operation_Responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..responses"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..responses"
|
|
}
|
|
]
|
|
},
|
|
"API_Server_URL": {
|
|
"description": "API host urls defined in the API specification",
|
|
"name": "API_Server_URL",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.servers[*].url"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.host"
|
|
}
|
|
]
|
|
},
|
|
"All_Ref": {
|
|
"description": "All references throughout the API",
|
|
"name": "All_Ref",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..[?(@property === '$ref')]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..[?(@property === '$ref')]"
|
|
}
|
|
]
|
|
},
|
|
"All_Enum": {
|
|
"description": "All references throughout the API",
|
|
"name": "All_Enum",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..[?(@ && @.enum && @.type)]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..[?(@ && @.enum && @.type)]"
|
|
}
|
|
]
|
|
},
|
|
"Request_Parameter_All": {
|
|
"description": "All request parameters",
|
|
"name": "Request_Parameter_All",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[*]"
|
|
}
|
|
]
|
|
},
|
|
"Request_Parameter_Query": {
|
|
"description": "All request query parameters",
|
|
"name": "Request_Parameter_Query",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"query\")]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"query\")]"
|
|
}
|
|
]
|
|
},
|
|
"Request_Parameter_Header": {
|
|
"description": "All request header parameters",
|
|
"name": "Request_Parameter_Header",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"header\")]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"header\")]"
|
|
}
|
|
]
|
|
},
|
|
"Request_Parameter_Cookie": {
|
|
"description": "All request cookie parameters",
|
|
"name": "Request_Parameter_Cookie",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"cookie\")]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters[?(@.in==\"cookie\")]"
|
|
}
|
|
]
|
|
},
|
|
"Request_Parameter_Path": {
|
|
"description": "All request path parameters",
|
|
"name": "Request_Parameter_Path",
|
|
"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}`",
|
|
"name": "Path_Object",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.paths"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths"
|
|
}
|
|
]
|
|
},
|
|
"All_Example_Schema": {
|
|
"description": "All examples for schemas",
|
|
"name": "All_Example_Schema",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..definitions..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..parameters..[?(@property !== 'properties' && @ && (@.example !== void 0 || @['x-example'] !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..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))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..content..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..headers..[?(@property !== 'properties' && @ && (@ && @.example !== void 0 || @.default !== void 0) && (@.enum || @.type || @.format || @.$ref || @.properties || @.items))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..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.* ",
|
|
"name": "API_Document_RecursiveSearch",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.."
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.."
|
|
}
|
|
]
|
|
},
|
|
"All_Example": {
|
|
"description": "All examples across the API document",
|
|
"name": "All_Example",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.components.examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths[*][*]..content[*].examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths[*][*]..parameters[*].examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.components.parameters[*].examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.paths[*][*]..headers[*].examples[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.components.headers[*].examples[*]"
|
|
}
|
|
]
|
|
},
|
|
"All_Example_Media": {
|
|
"description": "All examples for schemas",
|
|
"name": "All_Example_Media",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$..responses..[?(@ && @.schema && @.examples)]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..content..[?(@ && @.schema && (@.example !== void 0 || @.examples))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..headers..[?(@ && @.schema && (@.example !== void 0 || @.examples))]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$..parameters..[?(@ && @.schema && (@.example !== void 0 || @.examples))]"
|
|
}
|
|
]
|
|
},
|
|
"API_Tags_Item": {
|
|
"description": "Tags on an API object",
|
|
"name": "API_Tags_Item",
|
|
"targets": [
|
|
{
|
|
"formats": [
|
|
"oas2"
|
|
],
|
|
"given": "$.tags[*]"
|
|
},
|
|
{
|
|
"formats": [
|
|
"oas3"
|
|
],
|
|
"given": "$.tags[*]"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"rules": {
|
|
"contact-url": {
|
|
"given": [
|
|
"#API_Contact"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "url"
|
|
},
|
|
"name": "contact-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"
|
|
},
|
|
"name": "contact-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"
|
|
},
|
|
"name": "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"
|
|
},
|
|
"name": "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"
|
|
},
|
|
"name": "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"
|
|
},
|
|
"name": "license-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\\("
|
|
}
|
|
},
|
|
"name": "no-eval-in-markdown",
|
|
"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": "<script"
|
|
}
|
|
},
|
|
"name": "no-script-tags-in-markdown",
|
|
"description": "Markdown descriptions should not contain `script` tags, 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. <script>alert(\"You are Hacked\");</script>',\"\r\n```",
|
|
"message": "Markdown descriptions must not have \"<script>\" tags."
|
|
},
|
|
"openapi-tags-alphabetical": {
|
|
"given": [
|
|
"#API_Tags"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "alphabetical",
|
|
"functionOptions": {
|
|
"keyedBy": "name"
|
|
}
|
|
},
|
|
"name": "openapi-tags-alphabetical",
|
|
"description": "Global tags specified at the root OpenAPI Document level should be in alphabetical order based on the `name` property.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\":[\r\n {\r\n \"name\":\"Z Global Tag\"\r\n },\r\n {\r\n \"name\":\"A Global Tag\"\r\n }\r\n ]\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\":[\r\n {\r\n \"name\":\"A Global Tag\"\r\n },\r\n {\r\n \"name\":\"Z Global Tag\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "OpenAPI object should have alphabetical \"tags\"."
|
|
},
|
|
"openapi-tags": {
|
|
"given": [
|
|
"#API_Tags"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "schema",
|
|
"functionOptions": {
|
|
"schema": {
|
|
"type": "array",
|
|
"minItems": 1
|
|
}
|
|
}
|
|
},
|
|
"name": "openapi-tags",
|
|
"description": "At least one global tag should be specified at the root OpenAPI Document level.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\":[\r\n {\r\n \"name\":\"Global Tag #1\"\r\n },\r\n {\r\n \"name\":\"Global Tag #2\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "OpenAPI object should have non-empty \"tags\" array."
|
|
},
|
|
"operation-description": {
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "description"
|
|
},
|
|
"name": "operation-description",
|
|
"description": "Each operation should have a description. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n \"description\": \"Get a list of users.\",\r\n ... ,\r\n ... ,\r\n }\r\n}\r\n```",
|
|
"message": "Operation \"description\" should be present and non-empty string."
|
|
},
|
|
"operation-operationId": {
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "operationId"
|
|
},
|
|
"name": "operation-operationId",
|
|
"description": "All operations should have an `operationId`.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n \"summary\": \"Get users\",\r\n ... ,\r\n \"operationId\": \"get-users\"\r\n }\r\n}\r\n```",
|
|
"message": "Operation should have \"operationId\"."
|
|
},
|
|
"operation-operationId-valid-in-url": {
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"match": "^[A-Za-z0-9-._~:/?#\\[\\]@!\\$&'()*+,;=]*$"
|
|
},
|
|
"field": "operationId"
|
|
},
|
|
"name": "operation-operationId-valid-in-url",
|
|
"description": "Operation IDs must not contain characters that are invalid for URLs. \r\n\r\n**Invalid Example**\r\n\r\nThe `operationId` in this example includes a pipe and space, which are invalid for URLs.\r\n\r\n```json lineNumbers\r\n{\r\n \"/users\": {\r\n \"get\": {\r\n ... ,\r\n \"operationId\": \"invalid|operationID \",\r\n ... ,\r\n }\r\n }\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\nThis `operationId` is valid for URLs.\r\n\r\n```json lineNumbers\r\n{\r\n \"/users\": {\r\n \"get\": {\r\n ... ,\r\n \"operationId\": \"this-must-be-unique\",\r\n ... ,\r\n }\r\n }\r\n}\r\n```",
|
|
"message": "OperationId should not have characters that are invalid when used in URL."
|
|
},
|
|
"operation-singular-tag": {
|
|
"given": [
|
|
"#API_Tags"
|
|
],
|
|
"severity": "off",
|
|
"then": {
|
|
"function": "length",
|
|
"functionOptions": {
|
|
"max": 1
|
|
}
|
|
},
|
|
"name": "operation-singular-tag",
|
|
"description": "Operation should not have more than a single tag.",
|
|
"message": "Operation should not have more than a single tag."
|
|
},
|
|
"operation-tags": {
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "length",
|
|
"functionOptions": {
|
|
"max": 999,
|
|
"min": 1
|
|
},
|
|
"field": "tags"
|
|
},
|
|
"name": "operation-tags",
|
|
"description": "At least one tag should be defined for each operation.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n ... ,\r\n \"tags\": [\r\n \"Users\"\r\n ],\r\n }\r\n}",
|
|
"message": "Operation should have non-empty \"tags\" array."
|
|
},
|
|
"path-declarations-must-exist": {
|
|
"given": [
|
|
"#Path_Item"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "{}"
|
|
},
|
|
"field": "@key"
|
|
},
|
|
"name": "path-declarations-must-exist",
|
|
"description": "Path parameter declarations must not be empty.\r\n\r\n**Invalid Example**\r\n\r\n`/users/{}`\r\n\r\n**Valid Example**\r\n\r\n`/users/{userId}`",
|
|
"message": "Path parameter declarations must not be empty, ex.\"/given/{}\" is invalid."
|
|
},
|
|
"contact-name": {
|
|
"given": [
|
|
"#API_Contact"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "name"
|
|
},
|
|
"name": "contact-name",
|
|
"description": "The `contact` object should have an organization name. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"contact\": {\r\n \"name\": \"ACME Corporation\",\r\n ... ,\r\n ... \r\n},\r\n```\r\n",
|
|
"message": "Contact object should have \"name\""
|
|
},
|
|
"path-keys-no-trailing-slash": {
|
|
"given": [
|
|
"#Path_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": ".+\\/$"
|
|
},
|
|
"field": "@key"
|
|
},
|
|
"name": "path-keys-no-trailing-slash",
|
|
"description": "Path keys should not end in forward slashes. This is a best practice for working with web tooling, such as mock servers, code generators, application frameworks, and more).\r\n\r\n**Invalid Example**\r\n\r\n```json\r\n{\r\n \"/users/\": {\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json\r\n{\r\n \"/users\": {\r\n```",
|
|
"message": "Path should not end with slash."
|
|
},
|
|
"path-not-include-query": {
|
|
"given": [
|
|
"#Path_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "\\?"
|
|
},
|
|
"field": "@key"
|
|
},
|
|
"name": "path-not-include-query",
|
|
"description": "Paths should not include `query` string items. Instead, add them as parameters with `in: query`.\r\n\r\n**Invalid Example**\r\n\r\n```json\r\n{\r\n \"/users/{?id}\": {\r\n\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"description\": \"User's ID\"\r\n }\r\n ]\r\n}\r\n\r\n```",
|
|
"message": "Path should not include query string."
|
|
},
|
|
"tag-description": {
|
|
"given": [
|
|
"#API_Tags_Item"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "description"
|
|
},
|
|
"name": "tag-description",
|
|
"description": "Tags defined at the global level should have a description.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\": [\r\n {\r\n \"name\":\"Users\",\r\n \"description\":\"End-user information\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "Tag object should have \"description\"."
|
|
},
|
|
"api-servers": {
|
|
"given": [
|
|
"#API_Server"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "schema",
|
|
"functionOptions": {
|
|
"schema": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"dialect": "draft7"
|
|
}
|
|
},
|
|
"name": "api-servers",
|
|
"description": "A server should be defined at the root document level. This can be localhost, a development server, or a production server. \n\n**Valid OpenAPI V3 Example**\n\n```json\n{\n \"servers\": [\n {\n \"url\": \"https://staging.myprodserver.com/v1\",\n \"description\": \"Staging server\"\n },\n {\n \"url\": \"https://myprodserver.com/v1\",\n \"description\": \"Production server\"\n }\n ]\n}\n```\n\n**Valid OpenAPI V2 Example**\n\n```json\n{\n \"host\": \"myprodserver.com\",\n \"basePath\": \"/v2\",\n \"schemes\": [\n \"https\"\n ]\n}\n```\n\n",
|
|
"message": "Server should be present."
|
|
},
|
|
"server-trailing-slash": {
|
|
"given": [
|
|
"#API_Server_URL"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "/$"
|
|
}
|
|
},
|
|
"name": "server-trailing-slash",
|
|
"description": "Server URLs should not end in forward slashes. This is a best practice for working with web tooling, such as mock servers, code generators, application frameworks, and more).\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"servers\": [\r\n {\r\n ... ,\r\n \"url\": \"https://api.openweathermap.org/data/2.5/\"\r\n }\r\n ]\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"servers\": [\r\n {\r\n ... ,\r\n \"url\": \"https://api.openweathermap.org/data/2.5\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "Server URL should not have trailing slash"
|
|
},
|
|
"operation-success-response": {
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasOpSuccessResponse",
|
|
"field": "responses"
|
|
},
|
|
"name": "operation-success-response",
|
|
"description": "Operations should have at least one \"2xx\" or \"3xx\" response defined.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n \"responses\": {},\r\n }\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"OK\"\r\n }\r\n },\r\n }\r\n}\r\n```",
|
|
"message": "Operation should have at least one \"2xx\" or \"3xx\" response."
|
|
},
|
|
"path-params": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasPathParam"
|
|
},
|
|
"name": "path-params",
|
|
"description": "Path parameters must be defined and valid in either the `path-parameters` or the `operation-parameters` object. Likewise, defined `path-parameters` or `operation-parameters` must be used in the `paths` string.\r\n\r\n**Valid Example**\r\n\r\nFor this path:\r\n\r\n`/users/{id}/{location}`\r\n\r\nThe following path parameters must be defined.\r\n\r\n```json lineNumbers\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"description\": \"This is the user's ID\"\r\n },\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"name\": \"location\",\r\n \"in\": \"path\",\r\n \"required\": true,\r\n \"description\": \"This is the user's location\"\r\n }\r\n ]\r\n }\r\n },\r\n ```",
|
|
"message": "{{error}}"
|
|
},
|
|
"operation-parameters": {
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasOpParams",
|
|
"field": "parameters"
|
|
},
|
|
"name": "operation-parameters",
|
|
"description": "Operation parameters should be unique and non-repeating:\r\n\r\n* `name` and `in` must be unique\r\n\r\nFor OAS2:\r\n\r\n* Operations should not have `in: body` and `in: formData` parameters.\r\n* Operations should have only one `in: body` parameter.\r\n\r\n**Invalid Example**\r\n\r\nIn this example, the query paramater `\"name\": \"last name\"` is repeated.\r\n\r\n```json lineNumbers\r\n{\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"in\": \"query\",\r\n \"name\": \"last name\",\r\n \"description\": \"User's last name\"\r\n },\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"in\": \"query\",\r\n \"name\": \"last name\",\r\n \"description\": \"User's last name\"\r\n }\r\n ],\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\nIn this example, query parameters are unique.\r\n\r\n```json lineNumbers\r\n{\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"in\": \"query\",\r\n \"name\": \"first name\",\r\n \"description\": \"User's first name\"\r\n },\r\n {\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"in\": \"query\",\r\n \"name\": \"last name\",\r\n \"description\": \"User's last name\"\r\n }\r\n ],\r\n}\r\n```",
|
|
"message": "Operation parameters are unique and non-repeating."
|
|
},
|
|
"typed-enum": {
|
|
"given": [
|
|
"#All_Enum"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "typedEnum"
|
|
},
|
|
"name": "typed-enum",
|
|
"description": "All `enum' values should respect the specified type.\r\n\r\n**Invalid Example**\r\n\r\nIn this example, the `enum` type is `integer`, but the values are strings.\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"type\": \"integer\",\r\n \"enum\": [\r\n \"standard\",\r\n \"metric\",\r\n \"imperial\"\r\n ]\r\n },\r\n```\r\n\r\n**Valid Example**\r\n\r\nIn this example, the `enum` type is `string` and the values are strings.\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"standard\",\r\n \"metric\",\r\n \"imperial\"\r\n ]\r\n },",
|
|
"message": "{{error}}"
|
|
},
|
|
"oas2-schema": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasDocumentSchema"
|
|
},
|
|
"name": "oas2-schema",
|
|
"description": "This Stoplight core rule validates the structure of OpenAPI v2 specification. This rule should never be disabled.",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"oas3-schema": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasDocumentSchema"
|
|
},
|
|
"name": "oas3-schema",
|
|
"description": "This Stoplight core rule validates the structure of OpenAPI v3.x specification. This rule should never be disabled.",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
"oas3-unused-component": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasUnusedComponent"
|
|
},
|
|
"name": "oas3-unused-component",
|
|
"description": "A potentially shareable component is not being used. This may be expected, but you should review sharable components to avoid duplicate entry.",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
"operation-operationId-unique": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasOpIdUnique"
|
|
},
|
|
"name": "operation-operationId-unique",
|
|
"description": "Every operation in a single document must have a unique `operationID`.\r\n\r\n**Valid Example**\r\n\r\nIn this example, the `operationId` is `get-users`. This `operationId` must be unique in an API document.\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n \"summary\": \"Get users\",\r\n ... ,\r\n \"operationId\": \"get-users\"\r\n }\r\n}\r\n```\r\n",
|
|
"message": "Every operation must have unique operationId"
|
|
},
|
|
"oas2-operation-formData-consume-check": {
|
|
"given": [
|
|
"#Operation_Object"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasOpFormDataConsumeCheck"
|
|
},
|
|
"name": "oas2-operation-formData-consume-check",
|
|
"description": "Operations with an `in: formData` parameter must include a `consumes` property with one of these values:\r\n\r\n`application/x-www-form-urlencoded`\r\n\r\n`multipart/form-data`\r\n\r\n**Valid Example**\r\n\r\nIn this example, the `consumes` property correctly includes the `multipart/form-data` value.\r\n\r\n```json lineNumbers\r\n{\r\n \"post\":{\r\n \"summary\":\"Uploads a file\",\r\n \"consumes\":[\r\n \"multipart/form-data\"\r\n ],\r\n \"parameters\":[\r\n {\r\n \"name\":\"name\",\r\n \"in\":\"formData\",\r\n \"description\":\"Upload a file\",\r\n \"required\":false,\r\n \"type\":\"string\"\r\n }\r\n ]\r\n }\r\n}",
|
|
"message": "Operations with \"in: formData\" parameter must include \"application/x-www-form-urlencoded\" or \"multipart/form-data\" in their \"consumes\" property.",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"operation-tag-defined": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasTagDefined"
|
|
},
|
|
"name": "operation-tag-defined",
|
|
"description": "Tags defined at the operation level should also be defined at the global level. \r\n\r\n**Operation-level Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"get\": {\r\n ... ,\r\n ... ,\r\n \"tags\": [\r\n \"Users\"\r\n ],\r\n }\r\n} \r\n```\r\n\r\n**Global-level Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"tags\": [\r\n {\r\n \"name\": \"Users\",\r\n ... ,\r\n }\r\n ],\r\n}\r\n\r\n```",
|
|
"message": "Operation tags must be defined in global tags"
|
|
},
|
|
"no-$ref-siblings": {
|
|
"given": [
|
|
"#All_Ref"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "refSiblings"
|
|
},
|
|
"name": "no-$ref-siblings",
|
|
"description": "Property must not be placed among $ref.",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3.0",
|
|
"oas2"
|
|
]
|
|
},
|
|
"oas2-operation-security-defined": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasOpSecurityDefined",
|
|
"functionOptions": {
|
|
"schemesPath": [
|
|
"securityDefinitions"
|
|
]
|
|
}
|
|
},
|
|
"name": "oas2-operation-security-defined",
|
|
"description": "Operation `security` values must match a scheme defined in the global `securityDefinitions` object. Empty `security` values for operations are ignored if authentication is not explicity required or is optional.\r\n\r\n**Valid Example**\r\n\r\nFor this global security scheme:\r\n\r\n```json lineNumbers\r\n{\r\n \"securityDefinitions\": {\r\n \"API Key\": {\r\n \"name\": \"API Key\",\r\n \"type\": \"apiKey\",\r\n \"in\": \"query\"\r\n }\r\n }\r\n}\r\n```\r\n\r\nThis is a valid operation security value:\r\n\r\n```json lineNumbers\r\n{ \"operationId\": \"get-users-userId\",\r\n \"security\": [\r\n {\r\n \"API Key\": []\r\n }\r\n ]\r\n}\r\n```\r\n\r\n**Invalid Example**\r\n\r\nFor the same global security scheme, this is an invalid operation security value:\r\n\r\n```json lineNumbers\r\n{ \"operationId\": \"get-users-userId\",\r\n \"security\": [\r\n {\r\n \"oath2\": []\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"oas3-operation-security-defined": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasOpSecurityDefined",
|
|
"functionOptions": {
|
|
"schemesPath": [
|
|
"components",
|
|
"securitySchemes"
|
|
]
|
|
}
|
|
},
|
|
"name": "oas3-operation-security-defined",
|
|
"description": "Operation `security` values must match a scheme defined in the global `components.security.Schemes` object. \r\n\r\n**Valid Example**\r\n\r\nFor this global security scheme:\r\n\r\n```json lineNumbers\r\n{\r\n\"components\": {\r\n \"security\": [\r\n {\r\n \"app-id\": []\r\n }\r\n ]\r\n }\r\n}\r\n```\r\n\r\n`app-id` is a valid operation `security` value:\r\n\r\n```json lineNumbers\r\n{ \r\n \"get\": {\r\n \"security\": [\r\n {\r\n \"app-id\": []\r\n }\r\n ]\r\n }\r\n} \r\n```\r\n\r\n**Invalid Example**\r\n\r\nFor the same global security scheme, `oath2` is an invalid operation `security` value:\r\n\r\n```json lineNumbers\r\n{ \r\n \"get\": {\r\n \"security\": [\r\n {\r\n \"oath2\": []\r\n }\r\n ]\r\n }\r\n} \r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
"duplicated-entry-in-enum": {
|
|
"given": [
|
|
"#All_Enum"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "oasSchema",
|
|
"functionOptions": {
|
|
"schema": {
|
|
"type": "array",
|
|
"uniqueItems": true
|
|
}
|
|
},
|
|
"field": "enum"
|
|
},
|
|
"name": "duplicated-entry-in-enum",
|
|
"description": "All enum values should be unique.\r\n\r\n**Invalid Example**\r\n\r\nThere are two `json` enum values.\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\":{\r\n \"type\":\"string\",\r\n \"enum\":[\r\n \"json\",\r\n \"json\",\r\n \"html\"\r\n ]\r\n }\r\n}\r\n```\r\n**Valid Example**\r\n\r\nAll enum values are unique.\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\":{\r\n \"type\":\"string\",\r\n \"enum\":[\r\n \"json\",\r\n \"xml\",\r\n \"html\"\r\n ]\r\n }\r\n}\r\n```",
|
|
"message": "{{error}}"
|
|
},
|
|
"oas2-api-schemes": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "schema",
|
|
"functionOptions": {
|
|
"schema": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"dialect": "draft7"
|
|
},
|
|
"field": "schemes"
|
|
},
|
|
"name": "oas2-api-schemes",
|
|
"description": "OpenAPI 2 host `schemes` reflect the transfer protocol of the API. Host schemes must be present and an array with one or more of these values: `http`, `https`, `ws`, or `wss`.\r\n\r\n**Valid Example**\r\n\r\nThis example shows that host schemes are `http` and `https`.\r\n\r\n```json\r\n{\r\n \"schemes\":[\r\n \"http\",\r\n \"https\"\r\n ]\r\n}\r\n \r\n```",
|
|
"message": "OpenAPI host \"schemes\" must be present and non-empty array",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"oas2-discriminator": {
|
|
"given": [
|
|
"#API_Document"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasDiscriminator",
|
|
"field": "definitions[?(@.discriminator)]"
|
|
},
|
|
"name": "oas2-discriminator",
|
|
"description": "Discriminator property must be defined and required",
|
|
"message": "Discriminator property must be defined and required",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"server-not-example": {
|
|
"given": [
|
|
"#API_Server_URL"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "pattern",
|
|
"functionOptions": {
|
|
"notMatch": "example.com"
|
|
}
|
|
},
|
|
"name": "server-not-example",
|
|
"description": "Server URLs must not direct to example.com. This helps ensure URLs are valid before you distribute your API document.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"servers\": [\r\n {\r\n ... ,\r\n \"url\": \"https://example.com\"\r\n }\r\n ]\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{ \r\n \"servers\": [\r\n {\r\n ... ,\r\n \"url\": \"https://api.openweathermap.org/data/2.5\"\r\n }\r\n ]\r\n}\r\n```",
|
|
"message": "Server URL must not point at example.com."
|
|
},
|
|
"parameter-description": {
|
|
"given": [
|
|
"#Request_Parameter_All"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "truthy",
|
|
"field": "description"
|
|
},
|
|
"name": "parameter-description",
|
|
"description": "All `parameter` objects should have a description.\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"parameters\": [\r\n {\r\n \"schema\": {\r\n \"type\": \"integer\"\r\n },\r\n ... ,\r\n ... ,\r\n \"description\": \"The number of days to include in the response.\"\r\n }\r\n}\r\n```\r\n",
|
|
"message": "Parameter objects must have \"description\"."
|
|
},
|
|
"oas2-anyOf": {
|
|
"given": [
|
|
"#API_Document_RecursiveSearch"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "undefined",
|
|
"field": "anyOf"
|
|
},
|
|
"name": "oas2-anyOf",
|
|
"description": "The `anyOf` keyword is not supported in OAS2. Only `allOf` is supported.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"anyOf\": [\r\n {\r\n \"properties\": {\r\n \"firstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"lastName\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n },\r\n {}\r\n ],\r\n }\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"firstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"lastName\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n }\r\n}\r\n```",
|
|
"message": "anyOf is not available in OpenAPI v2, it was added in OpenAPI v3",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"oas2-oneOf": {
|
|
"given": [
|
|
"#API_Document_RecursiveSearch"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "undefined",
|
|
"field": "oneOf"
|
|
},
|
|
"name": "oas2-oneOf",
|
|
"description": "The `oneOf` keyword is not supported in OAS2. Only `allOf` is supported.\r\n\r\n**Invalid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"oneOf\": [\r\n {\r\n \"properties\": {\r\n \"firstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"lastName\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n },\r\n {}\r\n ],\r\n }\r\n}\r\n```\r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"schema\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"firstName\": {\r\n \"type\": \"string\"\r\n },\r\n \"lastName\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n }\r\n}\r\n```",
|
|
"message": "oneOf is not available in OpenAPI v2, it was added in OpenAPI v3",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"oas3-examples-value-or-externalValue": {
|
|
"given": [
|
|
"#All_Example"
|
|
],
|
|
"severity": "warn",
|
|
"then": {
|
|
"function": "xor",
|
|
"functionOptions": {
|
|
"properties": [
|
|
"externalValue",
|
|
"value"
|
|
]
|
|
}
|
|
},
|
|
"name": "oas3-examples-value-or-externalValue",
|
|
"description": "The `examples` object should include a `value` or `externalValue` field, but cannot include both.\r\n\r\n**Invalid Example**\r\n\r\nThis example includes both a `value` field and an `externalValue` field.\r\n\r\n```json lineNumbers\r\n{\r\n \"examples\": {\r\n \"example-1\": {\r\n \"value\": {\r\n \"id\": \"string\",\r\n \"name\": \"string\"\r\n },\r\n \"externalValue\": {\r\n \"id\": \"string\",\r\n \"name\": \"string\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\n**Valid Example** \r\n\r\nThis example includes only a `value` field.\r\n\r\n```json lineNumbers\r\n{\r\n \"examples\": {\r\n \"example-1\": {\r\n \"value\": {\r\n \"id\": \"string\",\r\n \"name\": \"string\"\r\n }\r\n }\r\n }\r\n}",
|
|
"message": "Examples must have either \"value\" or \"externalValue\" field.",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
"oas2-valid-schema-example": {
|
|
"given": [
|
|
"#All_Example_Schema"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasExample",
|
|
"functionOptions": {
|
|
"oasVersion": "2",
|
|
"schemaField": "$",
|
|
"type": "schema"
|
|
}
|
|
},
|
|
"name": "oas2-valid-schema-example",
|
|
"description": "Examples must be valid against their defined schema. \r\n\r\n**Valid Example**\r\n\r\nThe following schema includes the `name` and `petType` properties. \r\n\r\n```json lineNumbers\r\n{\r\n \"Pet\":{\r\n \"type\":\"object\",\r\n \"properties\":{\r\n \"name\":{\r\n \"type\":\"string\"\r\n },\r\n \"petType\":{\r\n \"type\":\"string\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\nWhen referenced in a response example, the property names on line 6 and 7 must match those in the schema (`petName` and `petType`).\r\n\r\n```json lineNumbers\r\n{\r\n \"responses\":{\r\n \"200\":{\r\n \"content\":{\r\n \"application/json\":{\r\n \"examples\":{\r\n \"Pet Example\":{\r\n \"petName\":\"Bubbles\",\r\n \"petType\":\"Dog\"\r\n }\r\n },\r\n \"schema\":{\r\n \"$ref\":\"#/definitions/Pet\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"oas3-valid-schema-example": {
|
|
"given": [
|
|
"#All_Example_Schema"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasExample",
|
|
"functionOptions": {
|
|
"oasVersion": "3",
|
|
"schemaField": "$",
|
|
"type": "schema"
|
|
}
|
|
},
|
|
"name": "oas3-valid-schema-example",
|
|
"description": "Examples must be valid against their defined schema. \r\n\r\n**Valid Example**\r\n\r\nThe following schema includes the `name` and `petType` properties. \r\n\r\n```json lineNumbers\r\n{\r\n \"Pet\":{\r\n \"type\":\"object\",\r\n \"properties\":{\r\n \"name\":{\r\n \"type\":\"string\"\r\n },\r\n \"petType\":{\r\n \"type\":\"string\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\nWhen referenced in a response example, the property names on line 6 and 7 must match those in the schema (`petName` and `petType`).\r\n\r\n```json lineNumbers\r\n{\r\n \"responses\":{\r\n \"200\":{\r\n \"content\":{\r\n \"application/json\":{\r\n \"examples\":{\r\n \"Pet Example\":{\r\n \"petName\":\"Bubbles\",\r\n \"petType\":\"Dog\"\r\n }\r\n },\r\n \"schema\":{\r\n \"$ref\":\"#/definitions/Pet\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
},
|
|
"oas2-valid-media-example": {
|
|
"given": [
|
|
"#All_Example_Media"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasExample",
|
|
"functionOptions": {
|
|
"oasVersion": "2",
|
|
"schemaField": "schema",
|
|
"type": "media"
|
|
}
|
|
},
|
|
"name": "oas2-valid-media-example",
|
|
"description": "Examples must be valid against their defined schema. Common reasons you may see errors if:\r\n\r\n* The value used for property examples is not the same type indicated in the schema (string vs. integer, for example).\r\n* Examples contain properties not included in the schema.\r\n\r\n**Valid Example**\r\n\r\nThe following schema indicates that the `id` property is a `string` type. \r\n\r\n```json lineNumbers\r\n\"User\":{\r\n \"title\":\"User\",\r\n \"type\":\"object\",\r\n \"properties\":{\r\n \"id\":{\r\n \"type\":\"string\"\r\n }\r\n }\r\n}\r\n```\r\nWhen the example is referenced in a response, the `id` property must be `string`.\r\n\r\n```json lineNumbers\r\n{\r\n \"responses\":{\r\n \"200\":{\r\n \"description\":\"User Found\",\r\n \"schema\":{\r\n \"$ref\":\"#/definitions/User\"\r\n },\r\n \"examples\":{\r\n \"Get User Alice Smith\":{\r\n \"id\": \"smith, alice\",\r\n }\r\n }\r\n },\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas2"
|
|
]
|
|
},
|
|
"oas3-valid-media-example": {
|
|
"given": [
|
|
"#All_Example_Media"
|
|
],
|
|
"severity": "error",
|
|
"then": {
|
|
"function": "oasExample",
|
|
"functionOptions": {
|
|
"oasVersion": "3",
|
|
"schemaField": "schema",
|
|
"type": "media"
|
|
}
|
|
},
|
|
"name": "oas3-valid-media-example",
|
|
"description": "The following schema includes the `name` and `petType` properties. \r\n\r\n**Valid Example**\r\n\r\n```json lineNumbers\r\n{\r\n \"Pet\":{\r\n \"type\":\"object\",\r\n \"properties\":{\r\n \"name\":{\r\n \"type\":\"string\"\r\n },\r\n \"petType\":{\r\n \"type\":\"string\"\r\n }\r\n }\r\n }\r\n}\r\n```\r\n\r\nWhen referenced in a response example, the property names on line 6 and 7 must match those in the schema (`petName` and `petType`).\r\n\r\n```json lineNumbers\r\n{\r\n \"responses\":{\r\n \"200\":{\r\n \"content\":{\r\n \"application/json\":{\r\n \"examples\":{\r\n \"Pet Example\":{\r\n \"petName\":\"Bubbles\",\r\n \"petType\":\"Dog\"\r\n }\r\n },\r\n \"schema\":{\r\n \"$ref\":\"#/definitions/Pet\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n```",
|
|
"message": "{{error}}",
|
|
"formats": [
|
|
"oas3"
|
|
]
|
|
}
|
|
},
|
|
"x-embeddedFunctions": [
|
|
{
|
|
"id": "7vlMlWLJeLfv6M_PHO36r",
|
|
"extendedFrom": "",
|
|
"name": "oasDocumentSchema",
|
|
"content": "import { createRulesetFunction } from '@stoplight/spectral-core';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport { oas2, oas3_1 } from '@stoplight/spectral-formats';\n\nconst OAS_2 = {\n title: 'A JSON Schema for Swagger 2.0 API.',\n $id: 'http://swagger.io/v2/schema.json#',\n $schema: 'http://json-schema.org/draft-07/schema#',\n type: 'object',\n required: ['swagger', 'info', 'paths'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n swagger: {\n type: 'string',\n enum: ['2.0'],\n description: 'The Swagger version of this document.',\n },\n info: {\n $ref: '#/definitions/info',\n },\n host: {\n type: 'string',\n pattern: '^[^{}/ :\\\\\\\\]+(?::\\\\d+)?$',\n description: \"The host (name or ip) of the API. Example: 'swagger.io'\",\n },\n basePath: {\n type: 'string',\n pattern: '^/',\n description: \"The base path to the API. Example: '/api'.\",\n },\n schemes: {\n $ref: '#/definitions/schemesList',\n },\n consumes: {\n description: 'A list of MIME types accepted by the API.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n produces: {\n description: 'A list of MIME types the API can produce.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n paths: {\n $ref: '#/definitions/paths',\n },\n definitions: {\n $ref: '#/definitions/definitions',\n },\n parameters: {\n $ref: '#/definitions/parameterDefinitions',\n },\n responses: {\n $ref: '#/definitions/responseDefinitions',\n },\n security: {\n $ref: '#/definitions/security',\n },\n securityDefinitions: {\n $ref: '#/definitions/securityDefinitions',\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/definitions/tag',\n },\n uniqueItems: true,\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n },\n definitions: {\n info: {\n type: 'object',\n description: 'General information about the API.',\n required: ['version', 'title'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n title: {\n type: 'string',\n description: 'A unique and precise title of the API.',\n },\n version: {\n type: 'string',\n description: 'A semantic version number of the API.',\n },\n description: {\n type: 'string',\n description:\n 'A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.',\n },\n termsOfService: {\n type: 'string',\n description: 'The terms of service for the API.',\n },\n contact: {\n $ref: '#/definitions/contact',\n },\n license: {\n $ref: '#/definitions/license',\n },\n },\n },\n contact: {\n type: 'object',\n description: 'Contact information for the owners of the API.',\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n description: 'The identifying name of the contact person/organization.',\n },\n url: {\n type: 'string',\n description: 'The URL pointing to the contact information.',\n format: 'uri',\n },\n email: {\n type: 'string',\n description: 'The email address of the contact person/organization.',\n format: 'email',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n license: {\n type: 'object',\n required: ['name'],\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n description: \"The name of the license type. It's encouraged to use an OSI compatible license.\",\n },\n url: {\n type: 'string',\n description: 'The URL pointing to the license.',\n format: 'uri',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n paths: {\n type: 'object',\n description: \"Relative paths to the individual endpoints. They must be relative to the 'basePath'.\",\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n '^/': {\n $ref: '#/definitions/pathItem',\n },\n },\n additionalProperties: false,\n },\n definitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/schema',\n },\n description: 'One or more JSON objects describing the schemas being consumed and produced by the API.',\n },\n parameterDefinitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/parameter',\n },\n description: 'One or more JSON representations for parameters',\n },\n responseDefinitions: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/response',\n },\n description: 'One or more JSON representations for responses',\n },\n externalDocs: {\n type: 'object',\n additionalProperties: false,\n description: 'information about external documentation',\n required: ['url'],\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n examples: {\n type: 'object',\n additionalProperties: true,\n },\n mimeType: {\n type: 'string',\n description: 'The MIME type of the HTTP message.',\n },\n operation: {\n type: 'object',\n required: ['responses'],\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n uniqueItems: true,\n },\n summary: {\n type: 'string',\n description: 'A brief summary of the operation.',\n },\n description: {\n type: 'string',\n description: 'A longer description of the operation, GitHub Flavored Markdown is allowed.',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n operationId: {\n type: 'string',\n description: 'A unique identifier of the operation.',\n },\n produces: {\n description: 'A list of MIME types the API can produce.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n consumes: {\n description: 'A list of MIME types the API can consume.',\n allOf: [\n {\n $ref: '#/definitions/mediaTypeList',\n },\n ],\n },\n parameters: {\n $ref: '#/definitions/parametersList',\n },\n responses: {\n $ref: '#/definitions/responses',\n },\n schemes: {\n $ref: '#/definitions/schemesList',\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n security: {\n $ref: '#/definitions/security',\n },\n },\n },\n pathItem: {\n type: 'object',\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n $ref: {\n type: 'string',\n },\n get: {\n $ref: '#/definitions/operation',\n },\n put: {\n $ref: '#/definitions/operation',\n },\n post: {\n $ref: '#/definitions/operation',\n },\n delete: {\n $ref: '#/definitions/operation',\n },\n options: {\n $ref: '#/definitions/operation',\n },\n head: {\n $ref: '#/definitions/operation',\n },\n patch: {\n $ref: '#/definitions/operation',\n },\n parameters: {\n $ref: '#/definitions/parametersList',\n },\n },\n },\n responses: {\n type: 'object',\n description: \"Response objects names can either be any valid HTTP status code or 'default'.\",\n minProperties: 1,\n additionalProperties: false,\n patternProperties: {\n '^([0-9]{3})$|^(default)$': {\n $ref: '#/definitions/responseValue',\n },\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n not: {\n type: 'object',\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n },\n responseValue: {\n oneOf: [\n {\n $ref: '#/definitions/response',\n },\n {\n $ref: '#/definitions/jsonReference',\n },\n ],\n },\n response: {\n type: 'object',\n required: ['description'],\n properties: {\n description: {\n type: 'string',\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n $ref: '#/definitions/fileSchema',\n },\n ],\n },\n headers: {\n $ref: '#/definitions/headers',\n },\n examples: {\n $ref: '#/definitions/examples',\n },\n },\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/header',\n },\n },\n header: {\n type: 'object',\n additionalProperties: false,\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['string', 'number', 'integer', 'boolean', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n vendorExtension: {\n description: 'Any property starting with x- is valid.',\n additionalProperties: true,\n additionalItems: true,\n },\n bodyParameter: {\n type: 'object',\n required: ['name', 'in', 'schema'],\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['body'],\n },\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n schema: {\n $ref: '#/definitions/schema',\n },\n },\n additionalProperties: false,\n },\n headerParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['header'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n queryParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['query'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n description: 'allows sending a parameter by name only or with an empty value.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormatWithMulti',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n formDataParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n required: {\n type: 'boolean',\n description: 'Determines whether or not this parameter is required or optional.',\n default: false,\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['formData'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n description: 'allows sending a parameter by name only or with an empty value.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array', 'file'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormatWithMulti',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n pathParameterSubSchema: {\n additionalProperties: false,\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n required: ['required'],\n properties: {\n required: {\n type: 'boolean',\n enum: [true],\n description: 'Determines whether or not this parameter is required or optional.',\n },\n in: {\n type: 'string',\n description: 'Determines the location of the parameter.',\n enum: ['path'],\n },\n description: {\n type: 'string',\n description:\n 'A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.',\n },\n name: {\n type: 'string',\n description: 'The name of the parameter.',\n },\n type: {\n type: 'string',\n enum: ['string', 'number', 'boolean', 'integer', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n },\n nonBodyParameter: {\n type: 'object',\n required: ['name', 'in', 'type'],\n oneOf: [\n {\n $ref: '#/definitions/headerParameterSubSchema',\n },\n {\n $ref: '#/definitions/formDataParameterSubSchema',\n },\n {\n $ref: '#/definitions/queryParameterSubSchema',\n },\n {\n $ref: '#/definitions/pathParameterSubSchema',\n },\n ],\n },\n parameter: {\n oneOf: [\n {\n $ref: '#/definitions/bodyParameter',\n },\n {\n $ref: '#/definitions/nonBodyParameter',\n },\n ],\n },\n schema: {\n type: 'object',\n description: 'A deterministic version of a JSON Schema object.',\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n properties: {\n $ref: {\n type: 'string',\n },\n format: {\n type: 'string',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n multipleOf: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/multipleOf',\n },\n maximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/maximum',\n },\n exclusiveMaximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum',\n },\n minimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/minimum',\n },\n exclusiveMinimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum',\n },\n maxLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n pattern: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/pattern',\n },\n maxItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n uniqueItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/uniqueItems',\n },\n maxProperties: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minProperties: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n required: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/stringArray',\n },\n enum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/enum',\n },\n additionalProperties: {\n anyOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n type: 'boolean',\n },\n ],\n default: {},\n },\n type: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/type',\n },\n items: {\n anyOf: [\n {\n $ref: '#/definitions/schema',\n },\n {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n ],\n default: {},\n },\n allOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n oneOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n anyOf: {\n type: 'array',\n minItems: 1,\n items: {\n $ref: '#/definitions/schema',\n },\n },\n properties: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/schema',\n },\n default: {},\n },\n discriminator: {\n type: 'string',\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n xml: {\n $ref: '#/definitions/xml',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n example: {},\n },\n additionalProperties: false,\n },\n fileSchema: {\n type: 'object',\n description: 'A deterministic version of a JSON Schema object.',\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n required: ['type'],\n properties: {\n format: {\n type: 'string',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n required: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/stringArray',\n },\n type: {\n type: 'string',\n enum: ['file'],\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n example: {},\n },\n additionalProperties: false,\n },\n primitivesItems: {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n enum: ['string', 'number', 'integer', 'boolean', 'array'],\n },\n format: {\n type: 'string',\n },\n items: {\n $ref: '#/definitions/primitivesItems',\n },\n collectionFormat: {\n $ref: '#/definitions/collectionFormat',\n },\n default: {\n $ref: '#/definitions/default',\n },\n maximum: {\n $ref: '#/definitions/maximum',\n },\n exclusiveMaximum: {\n $ref: '#/definitions/exclusiveMaximum',\n },\n minimum: {\n $ref: '#/definitions/minimum',\n },\n exclusiveMinimum: {\n $ref: '#/definitions/exclusiveMinimum',\n },\n maxLength: {\n $ref: '#/definitions/maxLength',\n },\n minLength: {\n $ref: '#/definitions/minLength',\n },\n pattern: {\n $ref: '#/definitions/pattern',\n },\n maxItems: {\n $ref: '#/definitions/maxItems',\n },\n minItems: {\n $ref: '#/definitions/minItems',\n },\n uniqueItems: {\n $ref: '#/definitions/uniqueItems',\n },\n enum: {\n $ref: '#/definitions/enum',\n },\n multipleOf: {\n $ref: '#/definitions/multipleOf',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/securityRequirement',\n },\n uniqueItems: true,\n },\n securityRequirement: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n uniqueItems: true,\n },\n },\n xml: {\n type: 'object',\n additionalProperties: false,\n properties: {\n name: {\n type: 'string',\n },\n namespace: {\n type: 'string',\n },\n prefix: {\n type: 'string',\n },\n attribute: {\n type: 'boolean',\n default: false,\n },\n wrapped: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n tag: {\n type: 'object',\n additionalProperties: false,\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/externalDocs',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n securityDefinitions: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/basicAuthenticationSecurity',\n },\n {\n $ref: '#/definitions/apiKeySecurity',\n },\n {\n $ref: '#/definitions/oauth2ImplicitSecurity',\n },\n {\n $ref: '#/definitions/oauth2PasswordSecurity',\n },\n {\n $ref: '#/definitions/oauth2ApplicationSecurity',\n },\n {\n $ref: '#/definitions/oauth2AccessCodeSecurity',\n },\n ],\n },\n errorMessage: {\n properties: {\n basic: 'Invalid basic authentication security definition',\n apiKey: 'Invalid apiKey authentication security definition',\n oauth2: 'Invalid oauth2 authentication security definition',\n },\n _: 'Invalid security securityDefinitions',\n },\n },\n basicAuthenticationSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['basic'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n apiKeySecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'name', 'in'],\n properties: {\n type: {\n type: 'string',\n enum: ['apiKey'],\n },\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n enum: ['header', 'query'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2ImplicitSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'authorizationUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['implicit'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n authorizationUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2PasswordSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['password'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2ApplicationSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['application'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2AccessCodeSecurity: {\n type: 'object',\n additionalProperties: false,\n required: ['type', 'flow', 'authorizationUrl', 'tokenUrl', 'scopes'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flow: {\n type: 'string',\n enum: ['accessCode'],\n },\n scopes: {\n $ref: '#/definitions/oauth2Scopes',\n },\n authorizationUrl: {\n type: 'string',\n format: 'uri',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {\n $ref: '#/definitions/vendorExtension',\n },\n },\n },\n oauth2Scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n mediaTypeList: {\n type: 'array',\n items: {\n $ref: '#/definitions/mimeType',\n },\n uniqueItems: true,\n },\n parametersList: {\n type: 'array',\n description: 'The parameters needed to send a valid API call.',\n additionalItems: false,\n items: {\n oneOf: [\n {\n $ref: '#/definitions/parameter',\n },\n {\n $ref: '#/definitions/jsonReference',\n },\n ],\n },\n uniqueItems: true,\n },\n schemesList: {\n type: 'array',\n description: 'The transfer protocol of the API.',\n items: {\n type: 'string',\n enum: ['http', 'https', 'ws', 'wss'],\n },\n uniqueItems: true,\n },\n collectionFormat: {\n type: 'string',\n enum: ['csv', 'ssv', 'tsv', 'pipes'],\n default: 'csv',\n },\n collectionFormatWithMulti: {\n type: 'string',\n enum: ['csv', 'ssv', 'tsv', 'pipes', 'multi'],\n default: 'csv',\n },\n title: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/title',\n },\n description: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/description',\n },\n default: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/default',\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/maximum',\n },\n exclusiveMaximum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum',\n },\n minimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/minimum',\n },\n exclusiveMinimum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum',\n },\n maxLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minLength: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n pattern: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/pattern',\n },\n maxItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveInteger',\n },\n minItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0',\n },\n uniqueItems: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/uniqueItems',\n },\n enum: {\n $ref: 'http://json-schema.org/draft-04/schema#/properties/enum',\n },\n jsonReference: {\n type: 'object',\n required: ['$ref'],\n additionalProperties: false,\n properties: {\n $ref: {\n type: 'string',\n },\n },\n },\n },\n};\n\nconst OAS_3 = {\n $id: 'https://spec.openapis.org/oas/3.0/schema/2019-04-02',\n $schema: 'http://json-schema.org/draft-07/schema#',\n description: 'Validation schema for OpenAPI Specification 3.0.X.',\n type: 'object',\n required: ['openapi', 'info', 'paths'],\n properties: {\n openapi: {\n type: 'string',\n pattern: '^3\\\\.0\\\\.\\\\d(-.+)?$',\n },\n info: {\n $ref: '#/definitions/Info',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/SecurityRequirement',\n },\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/definitions/Tag',\n },\n uniqueItems: true,\n },\n paths: {\n $ref: '#/definitions/Paths',\n },\n components: {\n $ref: '#/definitions/Components',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n definitions: {\n Reference: {\n type: 'object',\n required: ['$ref'],\n patternProperties: {\n '^\\\\$ref$': {\n type: 'string',\n format: 'uri-reference',\n },\n },\n },\n Info: {\n type: 'object',\n required: ['title', 'version'],\n properties: {\n title: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n termsOfService: {\n type: 'string',\n format: 'uri-reference',\n },\n contact: {\n $ref: '#/definitions/Contact',\n },\n license: {\n $ref: '#/definitions/License',\n },\n version: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Contact: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n email: {\n type: 'string',\n format: 'email',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n License: {\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Server: {\n type: 'object',\n required: ['url'],\n properties: {\n url: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n variables: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/ServerVariable',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ServerVariable: {\n type: 'object',\n required: ['default'],\n properties: {\n enum: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n default: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Components: {\n type: 'object',\n properties: {\n schemas: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n responses: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Response',\n },\n ],\n },\n },\n },\n parameters: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Parameter',\n },\n ],\n },\n },\n },\n examples: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Example',\n },\n ],\n },\n },\n },\n requestBodies: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/RequestBody',\n },\n ],\n },\n },\n },\n headers: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Header',\n },\n ],\n },\n },\n },\n securitySchemes: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/SecurityScheme',\n },\n ],\n },\n },\n },\n links: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Link',\n },\n ],\n },\n },\n },\n callbacks: {\n type: 'object',\n patternProperties: {\n '^[a-zA-Z0-9\\\\.\\\\-_]+$': {\n oneOf: [\n {\n $ref: '#/definitions/Reference',\n },\n {\n $ref: '#/definitions/Callback',\n },\n ],\n },\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Schema: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n },\n multipleOf: {\n type: 'number',\n exclusiveMinimum: 0,\n },\n maximum: {\n type: 'number',\n },\n exclusiveMaximum: {\n type: 'boolean',\n default: false,\n },\n minimum: {\n type: 'number',\n },\n exclusiveMinimum: {\n type: 'boolean',\n default: false,\n },\n maxLength: {\n type: 'integer',\n minimum: 0,\n },\n minLength: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n pattern: {\n type: 'string',\n format: 'regex',\n },\n maxItems: {\n type: 'integer',\n minimum: 0,\n },\n minItems: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n uniqueItems: {\n type: 'boolean',\n default: false,\n },\n maxProperties: {\n type: 'integer',\n minimum: 0,\n },\n minProperties: {\n type: 'integer',\n minimum: 0,\n default: 0,\n },\n required: {\n type: 'array',\n items: {\n type: 'string',\n },\n minItems: 1,\n uniqueItems: true,\n },\n enum: {\n type: 'array',\n items: {},\n minItems: 1,\n uniqueItems: false,\n },\n type: {\n type: 'string',\n enum: ['array', 'boolean', 'integer', 'number', 'object', 'string'],\n },\n not: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n allOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n oneOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n anyOf: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n properties: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n {\n type: 'boolean',\n },\n ],\n default: true,\n },\n description: {\n type: 'string',\n },\n format: {\n type: 'string',\n },\n default: {},\n nullable: {\n type: 'boolean',\n default: false,\n },\n discriminator: {\n $ref: '#/definitions/Discriminator',\n },\n readOnly: {\n type: 'boolean',\n default: false,\n },\n writeOnly: {\n type: 'boolean',\n default: false,\n },\n example: {},\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n xml: {\n $ref: '#/definitions/XML',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Discriminator: {\n type: 'object',\n required: ['propertyName'],\n properties: {\n propertyName: {\n type: 'string',\n },\n mapping: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n },\n XML: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n namespace: {\n type: 'string',\n format: 'uri',\n },\n prefix: {\n type: 'string',\n },\n attribute: {\n type: 'boolean',\n default: false,\n },\n wrapped: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Response: {\n type: 'object',\n required: ['description'],\n properties: {\n description: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Header',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n },\n links: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Link',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n MediaType: {\n type: 'object',\n properties: {\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n encoding: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/Encoding',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n ],\n },\n Example: {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n value: {},\n externalValue: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Header: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n required: {\n type: 'boolean',\n default: false,\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n },\n style: {\n type: 'string',\n enum: ['simple'],\n default: 'simple',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n minProperties: 1,\n maxProperties: 1,\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n {\n $ref: '#/definitions/SchemaXORContent',\n },\n ],\n },\n Paths: {\n type: 'object',\n patternProperties: {\n '^\\\\/': {\n $ref: '#/definitions/PathItem',\n },\n '^x-': {},\n },\n additionalProperties: false,\n },\n PathItem: {\n type: 'object',\n properties: {\n $ref: {\n type: 'string',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n parameters: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Parameter',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n uniqueItems: true,\n },\n },\n patternProperties: {\n '^(get|put|post|delete|options|head|patch|trace)$': {\n $ref: '#/definitions/Operation',\n },\n '^x-': {},\n },\n additionalProperties: false,\n },\n Operation: {\n type: 'object',\n required: ['responses'],\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n operationId: {\n type: 'string',\n },\n parameters: {\n type: 'array',\n items: {\n oneOf: [\n {\n $ref: '#/definitions/Parameter',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n uniqueItems: true,\n },\n requestBody: {\n oneOf: [\n {\n $ref: '#/definitions/RequestBody',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n responses: {\n $ref: '#/definitions/Responses',\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Callback',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/definitions/SecurityRequirement',\n },\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/definitions/Server',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Responses: {\n type: 'object',\n properties: {\n default: {\n oneOf: [\n {\n $ref: '#/definitions/Response',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n patternProperties: {\n '^[1-5](?:\\\\d{2}|XX)$': {\n oneOf: [\n {\n $ref: '#/definitions/Response',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n '^x-': {},\n },\n minProperties: 1,\n additionalProperties: false,\n },\n SecurityRequirement: {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n Tag: {\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/definitions/ExternalDocumentation',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ExternalDocumentation: {\n type: 'object',\n required: ['url'],\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri-reference',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ExampleXORExamples: {\n description: 'Example and examples are mutually exclusive',\n not: {\n required: ['example', 'examples'],\n },\n },\n SchemaXORContent: {\n description: 'Schema and content are mutually exclusive, at least one is required',\n not: {\n required: ['schema', 'content'],\n },\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n description: 'Some properties are not allowed if content is present',\n allOf: [\n {\n not: {\n required: ['style'],\n },\n },\n {\n not: {\n required: ['explode'],\n },\n },\n {\n not: {\n required: ['allowReserved'],\n },\n },\n {\n not: {\n required: ['example'],\n },\n },\n {\n not: {\n required: ['examples'],\n },\n },\n ],\n },\n ],\n },\n Parameter: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n required: {\n type: 'boolean',\n default: false,\n },\n deprecated: {\n type: 'boolean',\n default: false,\n },\n allowEmptyValue: {\n type: 'boolean',\n default: false,\n },\n style: {\n type: 'string',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n schema: {\n oneOf: [\n {\n $ref: '#/definitions/Schema',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n minProperties: 1,\n maxProperties: 1,\n },\n example: {},\n examples: {\n type: 'object',\n additionalProperties: {\n oneOf: [\n {\n $ref: '#/definitions/Example',\n },\n {\n $ref: '#/definitions/Reference',\n },\n ],\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n required: ['name', 'in'],\n allOf: [\n {\n $ref: '#/definitions/ExampleXORExamples',\n },\n {\n $ref: '#/definitions/SchemaXORContent',\n },\n {\n $ref: '#/definitions/ParameterLocation',\n },\n ],\n },\n ParameterLocation: {\n description: 'Parameter location',\n oneOf: [\n {\n description: 'Parameter in path',\n required: ['required'],\n properties: {\n in: {\n enum: ['path'],\n },\n style: {\n enum: ['matrix', 'label', 'simple'],\n default: 'simple',\n },\n required: {\n enum: [true],\n },\n },\n },\n {\n description: 'Parameter in query',\n properties: {\n in: {\n enum: ['query'],\n },\n style: {\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n default: 'form',\n },\n },\n },\n {\n description: 'Parameter in header',\n properties: {\n in: {\n enum: ['header'],\n },\n style: {\n enum: ['simple'],\n default: 'simple',\n },\n },\n },\n {\n description: 'Parameter in cookie',\n properties: {\n in: {\n enum: ['cookie'],\n },\n style: {\n enum: ['form'],\n default: 'form',\n },\n },\n },\n ],\n },\n RequestBody: {\n type: 'object',\n required: ['content'],\n properties: {\n description: {\n type: 'string',\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/MediaType',\n },\n },\n required: {\n type: 'boolean',\n default: false,\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n SecurityScheme: {\n oneOf: [\n {\n $ref: '#/definitions/APIKeySecurityScheme',\n },\n {\n $ref: '#/definitions/HTTPSecurityScheme',\n },\n {\n $ref: '#/definitions/OAuth2SecurityScheme',\n },\n {\n $ref: '#/definitions/OpenIdConnectSecurityScheme',\n },\n ],\n },\n APIKeySecurityScheme: {\n type: 'object',\n required: ['type', 'name', 'in'],\n properties: {\n type: {\n type: 'string',\n enum: ['apiKey'],\n },\n name: {\n type: 'string',\n },\n in: {\n type: 'string',\n enum: ['header', 'query', 'cookie'],\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n HTTPSecurityScheme: {\n type: 'object',\n required: ['scheme', 'type'],\n properties: {\n scheme: {\n type: 'string',\n },\n bearerFormat: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n type: {\n type: 'string',\n enum: ['http'],\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n oneOf: [\n {\n description: 'Bearer',\n properties: {\n scheme: {\n enum: ['bearer'],\n },\n },\n },\n {\n description: 'Non Bearer',\n not: {\n required: ['bearerFormat'],\n },\n properties: {\n scheme: {\n not: {\n enum: ['bearer'],\n },\n },\n },\n },\n ],\n },\n OAuth2SecurityScheme: {\n type: 'object',\n required: ['type', 'flows'],\n properties: {\n type: {\n type: 'string',\n enum: ['oauth2'],\n },\n flows: {\n $ref: '#/definitions/OAuthFlows',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n OpenIdConnectSecurityScheme: {\n type: 'object',\n required: ['type', 'openIdConnectUrl'],\n properties: {\n type: {\n type: 'string',\n enum: ['openIdConnect'],\n },\n openIdConnectUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n description: {\n type: 'string',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n OAuthFlows: {\n type: 'object',\n properties: {\n implicit: {\n $ref: '#/definitions/ImplicitOAuthFlow',\n },\n password: {\n $ref: '#/definitions/PasswordOAuthFlow',\n },\n clientCredentials: {\n $ref: '#/definitions/ClientCredentialsFlow',\n },\n authorizationCode: {\n $ref: '#/definitions/AuthorizationCodeOAuthFlow',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ImplicitOAuthFlow: {\n type: 'object',\n required: ['authorizationUrl', 'scopes'],\n properties: {\n authorizationUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n PasswordOAuthFlow: {\n type: 'object',\n required: ['tokenUrl', 'scopes'],\n properties: {\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n ClientCredentialsFlow: {\n type: 'object',\n required: ['tokenUrl', 'scopes'],\n properties: {\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n AuthorizationCodeOAuthFlow: {\n type: 'object',\n required: ['authorizationUrl', 'tokenUrl', 'scopes'],\n properties: {\n authorizationUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n tokenUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n refreshUrl: {\n type: 'string',\n format: 'uri-reference',\n },\n scopes: {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n },\n Link: {\n type: 'object',\n properties: {\n operationId: {\n type: 'string',\n },\n operationRef: {\n type: 'string',\n format: 'uri-reference',\n },\n parameters: {\n type: 'object',\n additionalProperties: {},\n },\n requestBody: {},\n description: {\n type: 'string',\n },\n server: {\n $ref: '#/definitions/Server',\n },\n },\n patternProperties: {\n '^x-': {},\n },\n additionalProperties: false,\n not: {\n description: 'Operation Id and Operation Ref are mutually exclusive',\n required: ['operationId', 'operationRef'],\n },\n },\n Callback: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/PathItem',\n },\n patternProperties: {\n '^x-': {},\n },\n },\n Encoding: {\n type: 'object',\n properties: {\n contentType: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/definitions/Header',\n },\n },\n style: {\n type: 'string',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n type: 'boolean',\n default: false,\n },\n },\n additionalProperties: false,\n },\n },\n};\n\nconst OAS_3_1 = {\n $id: 'https://spec.openapis.org/oas/3.1/schema/2021-09-28',\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n type: 'object',\n properties: {\n openapi: {\n type: 'string',\n pattern: '^3\\\\.1\\\\.\\\\d+(-.+)?$',\n },\n info: {\n $ref: '#/$defs/info',\n },\n jsonSchemaDialect: {\n type: 'string',\n format: 'uri',\n default: 'https://spec.openapis.org/oas/3.1/dialect/base',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n paths: {\n $ref: '#/$defs/paths',\n },\n webhooks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n components: {\n $ref: '#/$defs/components',\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/$defs/security-requirement',\n },\n },\n tags: {\n type: 'array',\n items: {\n $ref: '#/$defs/tag',\n },\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n },\n required: ['openapi', 'info'],\n anyOf: [\n {\n required: ['paths'],\n errorMessage: 'The document must have either \"paths\", \"webhooks\" or \"components\"',\n },\n {\n required: ['components'],\n },\n {\n required: ['webhooks'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n $defs: {\n info: {\n type: 'object',\n properties: {\n title: {\n type: 'string',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n termsOfService: {\n type: 'string',\n },\n contact: {\n $ref: '#/$defs/contact',\n },\n license: {\n $ref: '#/$defs/license',\n },\n version: {\n type: 'string',\n },\n },\n required: ['title', 'version'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n contact: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n url: {\n type: 'string',\n },\n email: {\n type: 'string',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n license: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n identifier: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['name'],\n oneOf: [\n {\n required: ['identifier'],\n },\n {\n required: ['url'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n server: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n format: 'uri-template',\n },\n description: {\n type: 'string',\n },\n variables: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/server-variable',\n },\n },\n },\n required: ['url'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'server-variable': {\n type: 'object',\n properties: {\n enum: {\n type: 'array',\n items: {\n type: 'string',\n },\n minItems: 1,\n },\n default: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n required: ['default'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n components: {\n type: 'object',\n properties: {\n schemas: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/schema',\n },\n },\n responses: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/response-or-reference',\n },\n },\n parameters: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n examples: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/example-or-reference',\n },\n },\n requestBodies: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/request-body-or-reference',\n },\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n securitySchemes: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/security-scheme-or-reference',\n },\n },\n links: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/link-or-reference',\n },\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/callbacks-or-reference',\n },\n },\n pathItems: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n },\n patternProperties: {\n '^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$': {\n $comment:\n 'Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected',\n propertyNames: {\n pattern: '^[a-zA-Z0-9._-]+$',\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n paths: {\n type: 'object',\n patternProperties: {\n '^/': {\n $ref: '#/$defs/path-item',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'path-item': {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n parameters: {\n type: 'array',\n items: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n },\n patternProperties: {\n '^(get|put|post|delete|options|head|patch|trace)$': {\n $ref: '#/$defs/operation',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'path-item-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/path-item',\n },\n },\n operation: {\n type: 'object',\n properties: {\n tags: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n operationId: {\n type: 'string',\n },\n parameters: {\n type: 'array',\n items: {\n $ref: '#/$defs/parameter-or-reference',\n },\n },\n requestBody: {\n $ref: '#/$defs/request-body-or-reference',\n },\n responses: {\n $ref: '#/$defs/responses',\n },\n callbacks: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/callbacks-or-reference',\n },\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n security: {\n type: 'array',\n items: {\n $ref: '#/$defs/security-requirement',\n },\n },\n servers: {\n type: 'array',\n items: {\n $ref: '#/$defs/server',\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'external-documentation': {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n url: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['url'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n parameter: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n in: {\n enum: ['query', 'header', 'path', 'cookie'],\n },\n description: {\n type: 'string',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n allowEmptyValue: {\n default: false,\n type: 'boolean',\n },\n schema: {\n $ref: '#/$defs/schema',\n },\n content: {\n $ref: '#/$defs/content',\n },\n },\n required: ['in'],\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n },\n ],\n dependentSchemas: {\n schema: {\n properties: {\n style: {\n type: 'string',\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n default: false,\n type: 'boolean',\n },\n },\n allOf: [\n {\n $ref: '#/$defs/examples',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie',\n },\n {\n $ref: '#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form',\n },\n ],\n $defs: {\n 'styles-for-path': {\n if: {\n properties: {\n in: {\n const: 'path',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n name: {\n pattern: '[^/#?]+$',\n },\n style: {\n default: 'simple',\n enum: ['matrix', 'label', 'simple'],\n },\n required: {\n const: true,\n },\n },\n required: ['required'],\n },\n },\n 'styles-for-header': {\n if: {\n properties: {\n in: {\n const: 'header',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'simple',\n const: 'simple',\n },\n },\n },\n },\n 'styles-for-query': {\n if: {\n properties: {\n in: {\n const: 'query',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'form',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n },\n },\n },\n 'styles-for-cookie': {\n if: {\n properties: {\n in: {\n const: 'cookie',\n },\n },\n required: ['in'],\n },\n then: {\n properties: {\n style: {\n default: 'form',\n const: 'form',\n },\n },\n },\n },\n 'styles-for-form': {\n if: {\n properties: {\n style: {\n const: 'form',\n },\n },\n required: ['style'],\n },\n then: {\n properties: {\n explode: {\n default: true,\n },\n },\n },\n else: {\n properties: {\n explode: {\n default: false,\n },\n },\n },\n },\n },\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'parameter-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/parameter',\n },\n },\n 'request-body': {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n content: {\n $ref: '#/$defs/content',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n },\n required: ['content'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'request-body-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/request-body',\n },\n },\n content: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/media-type',\n },\n propertyNames: {\n format: 'media-range',\n },\n },\n 'media-type': {\n type: 'object',\n properties: {\n schema: {\n $ref: '#/$defs/schema',\n },\n encoding: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/encoding',\n },\n },\n },\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/examples',\n },\n ],\n unevaluatedProperties: false,\n },\n encoding: {\n type: 'object',\n properties: {\n contentType: {\n type: 'string',\n format: 'media-range',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n style: {\n default: 'form',\n enum: ['form', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n },\n explode: {\n type: 'boolean',\n },\n allowReserved: {\n default: false,\n type: 'boolean',\n },\n },\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/encoding/$defs/explode-default',\n },\n ],\n unevaluatedProperties: false,\n $defs: {\n 'explode-default': {\n if: {\n properties: {\n style: {\n const: 'form',\n },\n },\n required: ['style'],\n },\n then: {\n properties: {\n explode: {\n default: true,\n },\n },\n },\n else: {\n properties: {\n explode: {\n default: false,\n },\n },\n },\n },\n },\n },\n responses: {\n type: 'object',\n properties: {\n default: {\n $ref: '#/$defs/response-or-reference',\n },\n },\n patternProperties: {\n '^[1-5](?:[0-9]{2}|XX)$': {\n $ref: '#/$defs/response-or-reference',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n response: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n headers: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/header-or-reference',\n },\n },\n content: {\n $ref: '#/$defs/content',\n },\n links: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/link-or-reference',\n },\n },\n },\n required: ['description'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'response-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/response',\n },\n },\n callbacks: {\n type: 'object',\n $ref: '#/$defs/specification-extensions',\n additionalProperties: {\n $ref: '#/$defs/path-item-or-reference',\n },\n },\n 'callbacks-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/callbacks',\n },\n },\n example: {\n type: 'object',\n properties: {\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n value: true,\n externalValue: {\n type: 'string',\n format: 'uri',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'example-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/example',\n },\n },\n link: {\n type: 'object',\n properties: {\n operationRef: {\n type: 'string',\n format: 'uri-reference',\n },\n operationId: true,\n parameters: {\n $ref: '#/$defs/map-of-strings',\n },\n requestBody: true,\n description: {\n type: 'string',\n },\n body: {\n $ref: '#/$defs/server',\n },\n },\n oneOf: [\n {\n required: ['operationRef'],\n },\n {\n required: ['operationId'],\n },\n ],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'link-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/link',\n },\n },\n header: {\n type: 'object',\n properties: {\n description: {\n type: 'string',\n },\n required: {\n default: false,\n type: 'boolean',\n },\n deprecated: {\n default: false,\n type: 'boolean',\n },\n schema: {\n $ref: '#/$defs/schema',\n },\n content: {\n $ref: '#/$defs/content',\n },\n },\n oneOf: [\n {\n required: ['schema'],\n },\n {\n required: ['content'],\n },\n ],\n dependentSchemas: {\n schema: {\n properties: {\n style: {\n default: 'simple',\n const: 'simple',\n },\n explode: {\n default: false,\n type: 'boolean',\n },\n },\n $ref: '#/$defs/examples',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'header-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/header',\n },\n },\n tag: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n externalDocs: {\n $ref: '#/$defs/external-documentation',\n },\n },\n required: ['name'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n reference: {\n type: 'object',\n properties: {\n $ref: {\n type: 'string',\n format: 'uri-reference',\n },\n summary: {\n type: 'string',\n },\n description: {\n type: 'string',\n },\n },\n unevaluatedProperties: false,\n },\n schema: {\n $dynamicAnchor: 'meta',\n type: ['object', 'boolean'],\n },\n 'security-scheme': {\n type: 'object',\n properties: {\n type: {\n enum: ['apiKey', 'http', 'mutualTLS', 'oauth2', 'openIdConnect'],\n },\n description: {\n type: 'string',\n },\n },\n required: ['type'],\n allOf: [\n {\n $ref: '#/$defs/specification-extensions',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-apikey',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-http',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-http-bearer',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-oauth2',\n },\n {\n $ref: '#/$defs/security-scheme/$defs/type-oidc',\n },\n ],\n unevaluatedProperties: false,\n $defs: {\n 'type-apikey': {\n if: {\n properties: {\n type: {\n const: 'apiKey',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n name: {\n type: 'string',\n },\n in: {\n enum: ['query', 'header', 'cookie'],\n },\n },\n required: ['name', 'in'],\n },\n },\n 'type-http': {\n if: {\n properties: {\n type: {\n const: 'http',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n scheme: {\n type: 'string',\n },\n },\n required: ['scheme'],\n },\n },\n 'type-http-bearer': {\n if: {\n properties: {\n type: {\n const: 'http',\n },\n scheme: {\n type: 'string',\n pattern: '^[Bb][Ee][Aa][Rr][Ee][Rr]$',\n },\n },\n required: ['type', 'scheme'],\n },\n then: {\n properties: {\n bearerFormat: {\n type: 'string',\n },\n },\n },\n },\n 'type-oauth2': {\n if: {\n properties: {\n type: {\n const: 'oauth2',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n flows: {\n $ref: '#/$defs/oauth-flows',\n },\n },\n required: ['flows'],\n },\n },\n 'type-oidc': {\n if: {\n properties: {\n type: {\n const: 'openIdConnect',\n },\n },\n required: ['type'],\n },\n then: {\n properties: {\n openIdConnectUrl: {\n type: 'string',\n format: 'uri',\n },\n },\n required: ['openIdConnectUrl'],\n },\n },\n },\n },\n 'security-scheme-or-reference': {\n if: {\n type: 'object',\n required: ['$ref'],\n },\n then: {\n $ref: '#/$defs/reference',\n },\n else: {\n $ref: '#/$defs/security-scheme',\n },\n },\n 'oauth-flows': {\n type: 'object',\n properties: {\n implicit: {\n $ref: '#/$defs/oauth-flows/$defs/implicit',\n },\n password: {\n $ref: '#/$defs/oauth-flows/$defs/password',\n },\n clientCredentials: {\n $ref: '#/$defs/oauth-flows/$defs/client-credentials',\n },\n authorizationCode: {\n $ref: '#/$defs/oauth-flows/$defs/authorization-code',\n },\n },\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n $defs: {\n implicit: {\n type: 'object',\n properties: {\n authorizationUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['authorizationUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n password: {\n type: 'object',\n properties: {\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'client-credentials': {\n type: 'object',\n properties: {\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n 'authorization-code': {\n type: 'object',\n properties: {\n authorizationUrl: {\n type: 'string',\n },\n tokenUrl: {\n type: 'string',\n },\n refreshUrl: {\n type: 'string',\n },\n scopes: {\n $ref: '#/$defs/map-of-strings',\n },\n },\n required: ['authorizationUrl', 'tokenUrl', 'scopes'],\n $ref: '#/$defs/specification-extensions',\n unevaluatedProperties: false,\n },\n },\n },\n 'security-requirement': {\n type: 'object',\n additionalProperties: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n 'specification-extensions': {\n patternProperties: {\n '^x-': true,\n },\n },\n examples: {\n properties: {\n example: true,\n examples: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/example-or-reference',\n },\n },\n },\n },\n 'map-of-strings': {\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n },\n },\n};\n\nconst OAS_SCHEMAS = {\n '2.0': OAS_2,\n '3.0': OAS_3,\n 3.1: OAS_3_1,\n};\n\nfunction shouldIgnoreError(error) {\n return (\n // oneOf is a fairly error as we have 2 options to choose from for most of the time.\n error.keyword === 'oneOf' ||\n // the required $ref is entirely useless, since oas-schema rules operate on resolved content, so there won't be any $refs in the document\n (error.keyword === 'required' && error.params.missingProperty === '$ref')\n );\n}\n\n// this is supposed to cover edge cases we need to cover manually, when it's impossible to detect the most appropriate error, i.e. oneOf consisting of more than 3 members, etc.\n// note, more errors can be included if certain messages reported by AJV are not quite meaningful\nconst ERROR_MAP = [\n {\n path: /^components\\/securitySchemes\\/[^/]+$/,\n message: 'Invalid security scheme',\n },\n];\n\n// The function removes irrelevant (aka misleading, confusing, useless, whatever you call it) errors.\n// There are a few exceptions, i.e. security components I covered manually,\n// yet apart from them we usually deal with a relatively simple scenario that can be literally expressed as: \"either proper value of $ref property\".\n// The $ref part is never going to be interesting for us, because both oas-schema rules operate on resolved content, so we won't have any $refs left.\n// As you can see, what we deal here wit is actually not really oneOf anymore - it's always the first member of oneOf we match against.\n// That being said, we always strip both oneOf and $ref, since we are always interested in the first error.\nexport function prepareResults(errors) {\n // Update additionalProperties errors to make them more precise and prevent them from being treated as duplicates\n for (const error of errors) {\n if (error.keyword === 'additionalProperties') {\n error.instancePath = `${error.instancePath}/${String(error.params['additionalProperty'])}`;\n }\n }\n\n for (let i = 0; i < errors.length; i++) {\n const error = errors[i];\n\n if (i + 1 < errors.length && errors[i + 1].instancePath === error.instancePath) {\n errors.splice(i + 1, 1);\n i--;\n } else if (i > 0 && shouldIgnoreError(error) && errors[i - 1].instancePath.startsWith(error.instancePath)) {\n errors.splice(i, 1);\n i--;\n }\n }\n}\n\nfunction applyManualReplacements(errors) {\n for (const error of errors) {\n if (error.path === void 0) continue;\n\n const joinedPath = error.path.join('/');\n\n for (const mappedError of ERROR_MAP) {\n if (mappedError.path.test(joinedPath)) {\n error.message = mappedError.message;\n break;\n }\n }\n }\n}\n\nexport default createRulesetFunction(\n {\n input: null,\n options: null,\n },\n function oasDocumentSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n if (formats === null || formats === void 0) return;\n\n const schema = formats.has(oas2)\n ? OAS_SCHEMAS['2.0']\n : formats.has(oas3_1)\n ? OAS_SCHEMAS['3.1']\n : OAS_SCHEMAS['3.0'];\n\n const errors = schemaFn(targetVal, { allErrors: true, schema, prepareResults }, context);\n\n if (Array.isArray(errors)) {\n applyManualReplacements(errors);\n }\n\n return errors;\n },\n);\n"
|
|
},
|
|
{
|
|
"id": "oWnSsB6ESXiPxcECo6sxv",
|
|
"extendedFrom": "",
|
|
"name": "oasDiscriminator",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nexport const oasDiscriminator = (schema, _opts, { path }) => {\n /**\n * This function verifies:\n *\n * 1. The discriminator property name is defined at this schema.\n * 2. The discriminator property is in the required property list.\n */\n\n if (!isObject(schema)) return;\n\n if (typeof schema.discriminator !== 'string') return;\n\n const discriminatorName = schema.discriminator;\n\n const results = [];\n\n if (!isObject(schema.properties) || !Object.keys(schema.properties).some(k => k === discriminatorName)) {\n results.push({\n message: `The discriminator property must be defined in this schema.`,\n path: [...path, 'properties'],\n });\n }\n\n if (!Array.isArray(schema.required) || !schema.required.some(n => n === discriminatorName)) {\n results.push({\n message: `The discriminator property must be in the required property list.`,\n path: [...path, 'required'],\n });\n }\n\n return results;\n};\n\nexport default oasDiscriminator;\n"
|
|
},
|
|
{
|
|
"id": "yV8GE2M3oZxmdMy_bselm",
|
|
"extendedFrom": "",
|
|
"name": "oasExample",
|
|
"content": "import { isPlainObject, pointerToPath } from '@stoplight/json';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas2, oas3_1, extractDraftVersion, oas3_0 } from '@stoplight/spectral-formats';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport traverse from 'json-schema-traverse';\n\nconst MEDIA_VALIDATION_ITEMS = {\n 2: [\n {\n field: 'examples',\n multiple: true,\n keyed: false,\n },\n ],\n 3: [\n {\n field: 'example',\n multiple: false,\n keyed: false,\n },\n {\n field: 'examples',\n multiple: true,\n keyed: true,\n },\n ],\n};\n\nconst SCHEMA_VALIDATION_ITEMS = {\n 2: ['example', 'x-example', 'default'],\n 3: ['example', 'default'],\n};\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction rewriteNullable(schema, errors) {\n for (const error of errors) {\n if (error.keyword !== 'type') continue;\n const value = getSchemaProperty(schema, error.schemaPath);\n if (isPlainObject(value) && value.nullable === true) {\n error.message += ',null';\n }\n }\n}\n\nconst visitOAS2 = schema => {\n if (schema['x-nullable'] === true) {\n schema.nullable = true;\n delete schema['x-nullable'];\n }\n};\n\nfunction getSchemaProperty(schema, schemaPath) {\n const path = pointerToPath(schemaPath);\n let value = schema;\n\n for (const fragment of path.slice(0, -1)) {\n if (!isPlainObject(value)) {\n return;\n }\n\n value = value[fragment];\n }\n\n return value;\n}\n\nconst oasSchema = createRulesetFunction(\n {\n input: null,\n options: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n },\n },\n additionalProperties: false,\n },\n },\n function oasSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n\n let { schema } = opts;\n\n let dialect = 'draft4';\n let prepareResults;\n\n if (!formats) {\n dialect = 'auto';\n } else if (formats.has(oas3_1)) {\n if (isPlainObject(context.document.data) && typeof context.document.data.jsonSchemaDialect === 'string') {\n dialect = extractDraftVersion(context.document.data.jsonSchemaDialect) ?? 'draft2020-12';\n } else {\n dialect = 'draft2020-12';\n }\n } else if (formats.has(oas3_0)) {\n prepareResults = rewriteNullable.bind(null, schema);\n } else if (formats.has(oas2)) {\n const clonedSchema = JSON.parse(JSON.stringify(schema));\n traverse(clonedSchema, visitOAS2);\n schema = clonedSchema;\n prepareResults = rewriteNullable.bind(null, clonedSchema);\n }\n\n return schemaFn(\n targetVal,\n {\n ...opts,\n schema,\n prepareResults,\n dialect,\n },\n context,\n );\n },\n);\n\nfunction* getMediaValidationItems(items, targetVal, givenPath, oasVersion) {\n for (const { field, keyed, multiple } of items) {\n if (!(field in targetVal)) {\n continue;\n }\n\n const value = targetVal[field];\n\n if (multiple) {\n if (!isObject(value)) continue;\n\n for (const exampleKey of Object.keys(value)) {\n const exampleValue = value[exampleKey];\n if (oasVersion === 3 && keyed && (!isObject(exampleValue) || 'externalValue' in exampleValue)) {\n // should be covered by oas3-examples-value-or-externalValue\n continue;\n }\n\n const targetPath = [...givenPath, field, exampleKey];\n\n if (keyed) {\n targetPath.push('value');\n }\n\n yield {\n value: keyed && isObject(exampleValue) ? exampleValue.value : exampleValue,\n path: targetPath,\n };\n }\n\n return;\n } else {\n return yield {\n value,\n path: [...givenPath, field],\n };\n }\n }\n}\n\nfunction* getSchemaValidationItems(fields, targetVal, givenPath) {\n for (const field of fields) {\n if (!(field in targetVal)) {\n continue;\n }\n\n yield {\n value: targetVal[field],\n path: [...givenPath, field],\n };\n }\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n },\n options: {\n type: 'object',\n properties: {\n oasVersion: {\n enum: ['2', '3'],\n },\n schemaField: {\n type: 'string',\n },\n type: {\n enum: ['media', 'schema'],\n },\n },\n additionalProperties: false,\n },\n },\n function oasExample(targetVal, opts, context) {\n const formats = context.document.formats;\n const schemaOpts = {\n schema: opts.schemaField === '$' ? targetVal : targetVal[opts.schemaField],\n };\n\n let results = void 0;\n let oasVersion = parseInt(opts.oasVersion);\n\n const validationItems =\n opts.type === 'schema'\n ? getSchemaValidationItems(SCHEMA_VALIDATION_ITEMS[oasVersion], targetVal, context.path)\n : getMediaValidationItems(MEDIA_VALIDATION_ITEMS[oasVersion], targetVal, context.path, oasVersion);\n\n if (formats?.has(oas2) && 'required' in schemaOpts.schema && typeof schemaOpts.schema.required === 'boolean') {\n schemaOpts.schema = { ...schemaOpts.schema };\n delete schemaOpts.schema.required;\n }\n\n for (const validationItem of validationItems) {\n const result = oasSchema(validationItem.value, schemaOpts, {\n ...context,\n path: validationItem.path,\n });\n\n if (Array.isArray(result)) {\n if (results === void 0) results = [];\n results.push(...result);\n }\n }\n\n return results;\n },\n);\n"
|
|
},
|
|
{
|
|
"id": "7IM2dxxl58nqnDNos_xti",
|
|
"extendedFrom": "",
|
|
"name": "oasOpFormDataConsumeCheck",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validConsumeValue = /(application\\/x-www-form-urlencoded|multipart\\/form-data)/;\n\nexport const oasOpFormDataConsumeCheck = targetVal => {\n if (!isObject(targetVal)) return;\n\n const parameters = targetVal.parameters;\n const consumes = targetVal.consumes;\n\n if (!Array.isArray(parameters) || !Array.isArray(consumes)) {\n return;\n }\n\n if (parameters.some(p => isObject(p) && p.in === 'formData') && !validConsumeValue.test(consumes?.join(','))) {\n return [\n {\n message: 'Consumes must include urlencoded, multipart, or form-data media type when using formData parameter.',\n },\n ];\n }\n\n return;\n};\n\nexport default oasOpFormDataConsumeCheck;\n"
|
|
},
|
|
{
|
|
"id": "qyreBtJPioj3lxIja57-4",
|
|
"extendedFrom": "",
|
|
"name": "oasOpIdUnique",
|
|
"content": "import { isPlainObject } from '@stoplight/json';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nexport const oasOpIdUnique = targetVal => {\n if (!isObject(targetVal) || !isObject(targetVal.paths)) return;\n\n const results = [];\n\n const { paths } = targetVal;\n\n const seenIds = [];\n\n for (const { path, operation } of getAllOperations(paths)) {\n const pathValue = paths[path];\n\n if (!isObject(pathValue)) continue;\n\n const operationValue = pathValue[operation];\n\n if (!isObject(operationValue) || !('operationId' in operationValue)) {\n continue;\n }\n\n const { operationId } = operationValue;\n\n if (seenIds.includes(operationId)) {\n results.push({\n message: 'operationId must be unique.',\n path: ['paths', path, operation, 'operationId'],\n });\n } else {\n seenIds.push(operationId);\n }\n }\n\n return results;\n};\n\nexport default oasOpIdUnique;\n"
|
|
},
|
|
{
|
|
"id": "eBZfmdV9f3yJhywGGfP6i",
|
|
"extendedFrom": "",
|
|
"name": "oasOpParams",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction computeFingerprint(param) {\n return `${String(param.in)}-${String(param.name)}`;\n}\n\nexport const oasOpParams = (params, _opts, { path }) => {\n /**\n * This function verifies:\n *\n * 1. Operations must have unique `name` + `in` parameters.\n * 2. Operation cannot have both `in:body` and `in:formData` parameters\n * 3. Operation must have only one `in:body` parameter.\n */\n\n if (!Array.isArray(params)) return;\n\n if (params.length < 2) return;\n\n const results = [];\n\n const count = {\n body: [],\n formData: [],\n };\n const list = [];\n const duplicates = [];\n\n let index = -1;\n\n for (const param of params) {\n index++;\n\n if (!isObject(param)) continue;\n\n // skip params that are refs\n if ('$ref' in param) continue;\n\n // Operations must have unique `name` + `in` parameters.\n const fingerprint = computeFingerprint(param);\n if (list.includes(fingerprint)) {\n duplicates.push(index);\n } else {\n list.push(fingerprint);\n }\n\n if (typeof param.in === 'string' && param.in in count) {\n count[param.in].push(index);\n }\n }\n\n if (duplicates.length > 0) {\n for (const i of duplicates) {\n results.push({\n message: 'A parameter in this operation already exposes the same combination of \"name\" and \"in\" values.',\n path: [...path, i],\n });\n }\n }\n\n if (count.body.length > 0 && count.formData.length > 0) {\n results.push({\n message: 'Operation must not have both \"in:body\" and \"in:formData\" parameters.',\n });\n }\n\n if (count.body.length > 1) {\n for (let i = 1; i < count.body.length; i++) {\n results.push({\n message: 'Operation must not have more than a single instance of the \"in:body\" parameter.',\n path: [...path, count.body[i]],\n });\n }\n }\n\n return results;\n};\n\nexport default oasOpParams;\n"
|
|
},
|
|
{
|
|
"id": "M8I-IiA48R9_GpRVLR2-D",
|
|
"extendedFrom": "",
|
|
"name": "oasOpSecurityDefined",
|
|
"content": "import { isPlainObject } from '@stoplight/json';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nfunction _get(value, path) {\n for (const segment of path) {\n if (!isObject(value)) {\n break;\n }\n\n value = value[segment];\n }\n\n return value;\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n paths: {\n type: 'object',\n },\n security: {\n type: 'array',\n },\n },\n },\n options: {\n type: 'object',\n properties: {\n schemesPath: {\n type: 'array',\n items: {\n type: ['string', 'number'],\n },\n },\n },\n },\n },\n function oasOpSecurityDefined(targetVal, { schemesPath }) {\n const { paths } = targetVal;\n\n const results = [];\n\n const schemes = _get(targetVal, schemesPath);\n const allDefs = isObject(schemes) ? Object.keys(schemes) : [];\n\n // Check global security requirements\n\n const { security } = targetVal;\n\n if (Array.isArray(security)) {\n for (const [index, value] of security.entries()) {\n if (!isObject(value)) {\n continue;\n }\n\n const securityKeys = Object.keys(value);\n\n for (const securityKey of securityKeys) {\n if (!allDefs.includes(securityKey)) {\n results.push({\n message: `API \"security\" values must match a scheme defined in the \"${schemesPath.join('.')}\" object.`,\n path: ['security', index, securityKey],\n });\n }\n }\n }\n }\n\n for (const { path, operation, value } of getAllOperations(paths)) {\n if (!isObject(value)) continue;\n\n const { security } = value;\n\n if (!Array.isArray(security)) {\n continue;\n }\n\n for (const [index, value] of security.entries()) {\n if (!isObject(value)) {\n continue;\n }\n\n const securityKeys = Object.keys(value);\n\n for (const securityKey of securityKeys) {\n if (!allDefs.includes(securityKey)) {\n results.push({\n message: `Operation \"security\" values must match a scheme defined in the \"${schemesPath.join(\n '.',\n )}\" object.`,\n path: ['paths', path, operation, 'security', index, securityKey],\n });\n }\n }\n }\n }\n\n return results;\n },\n);\n"
|
|
},
|
|
{
|
|
"id": "UZ4xjIYz5GYPDsvg8OcM8",
|
|
"extendedFrom": "",
|
|
"name": "oasOpSuccessResponse",
|
|
"content": "import { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas3 } from '@stoplight/spectral-formats';\n\nexport const oasOpSuccessResponse = createRulesetFunction(\n {\n input: {\n type: 'object',\n },\n options: null,\n },\n (input, opts, context) => {\n const isOAS3X = context.document.formats?.has(oas3) === true;\n\n for (const response of Object.keys(input)) {\n if (isOAS3X && (response === '2XX' || response === '3XX')) {\n return;\n }\n\n if (Number(response) >= 200 && Number(response) < 400) {\n return;\n }\n }\n\n return [\n {\n message: 'Operation must define at least a single 2xx or 3xx response',\n },\n ];\n },\n);\n\nexport default oasOpSuccessResponse;\n"
|
|
},
|
|
{
|
|
"id": "p5iMKUsFH7_JgSeDnWdXt",
|
|
"extendedFrom": "",
|
|
"name": "oasPathParam",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst pathRegex = /(\\{;?\\??[a-zA-Z0-9_-]+\\*?\\})/g;\n\nconst isNamedPathParam = p => {\n return p.in !== void 0 && p.in === 'path' && p.name !== void 0;\n};\n\nconst isUnknownNamedPathParam = (p, path, results, seen) => {\n if (!isNamedPathParam(p)) {\n return false;\n }\n\n if (p.required !== true) {\n results.push(generateResult(requiredMessage(p.name), path));\n }\n\n if (p.name in seen) {\n results.push(generateResult(uniqueDefinitionMessage(p.name), path));\n return false;\n }\n\n return true;\n};\n\nconst ensureAllDefinedPathParamsAreUsedInPath = (path, params, expected, results) => {\n for (const p of Object.keys(params)) {\n if (!params[p]) {\n continue;\n }\n\n if (!expected.includes(p)) {\n const resPath = params[p];\n results.push(generateResult(`Parameter \"${p}\" must be used in path \"${path}\".`, resPath));\n }\n }\n};\n\nconst ensureAllExpectedParamsInPathAreDefined = (path, params, expected, operationPath, results) => {\n for (const p of expected) {\n if (!(p in params)) {\n results.push(\n generateResult(`Operation must define parameter \"{${p}}\" as expected by path \"${path}\".`, operationPath),\n );\n }\n }\n};\n\nexport const oasPathParam = targetVal => {\n /**\n * This rule verifies:\n *\n * 1. for every param referenced in the path string ie /users/{userId}, var must be defined in either\n * path.parameters, or operation.parameters object\n * 2. every path.parameters + operation.parameters property must be used in the path string\n */\n\n if (!isObject(targetVal) || !isObject(targetVal.paths)) {\n return;\n }\n\n const results = [];\n\n // keep track of normalized paths for verifying paths are unique\n const uniquePaths = {};\n const validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\n for (const path of Object.keys(targetVal.paths)) {\n const pathValue = targetVal.paths[path];\n if (!isObject(pathValue)) continue;\n\n // verify normalized paths are functionally unique (ie `/path/{one}` vs `/path/{two}` are\n // different but equivalent within the context of OAS)\n const normalized = path.replace(pathRegex, '%'); // '%' is used here since its invalid in paths\n if (normalized in uniquePaths) {\n results.push(\n generateResult(`Paths \"${String(uniquePaths[normalized])}\" and \"${path}\" must not be equivalent.`, [\n 'paths',\n path,\n ]),\n );\n } else {\n uniquePaths[normalized] = path;\n }\n\n // find all templated path parameters\n const pathElements = [];\n let match;\n\n while ((match = pathRegex.exec(path))) {\n const p = match[0].replace(/[{}?*;]/g, '');\n if (pathElements.includes(p)) {\n results.push(generateResult(`Path \"${path}\" must not use parameter \"{${p}}\" multiple times.`, ['paths', path]));\n } else {\n pathElements.push(p);\n }\n }\n\n // find parameters set within the top-level 'parameters' object\n const topParams = {};\n if (Array.isArray(pathValue.parameters)) {\n for (const [i, value] of pathValue.parameters.entries()) {\n if (!isObject(value)) continue;\n\n const fullParameterPath = ['paths', path, 'parameters', i];\n\n if (isUnknownNamedPathParam(value, fullParameterPath, results, topParams)) {\n topParams[value.name] = fullParameterPath;\n }\n }\n }\n\n if (isObject(targetVal.paths[path])) {\n // find parameters set within the operation's 'parameters' object\n for (const op of Object.keys(pathValue)) {\n const operationValue = pathValue[op];\n if (!isObject(operationValue)) continue;\n\n if (op === 'parameters' || !validOperationKeys.includes(op)) {\n continue;\n }\n\n const operationParams = {};\n const { parameters } = operationValue;\n const operationPath = ['paths', path, op];\n\n if (Array.isArray(parameters)) {\n for (const [i, p] of parameters.entries()) {\n if (!isObject(p)) continue;\n\n const fullParameterPath = [...operationPath, 'parameters', i];\n\n if (isUnknownNamedPathParam(p, fullParameterPath, results, operationParams)) {\n operationParams[p.name] = fullParameterPath;\n }\n }\n }\n\n const definedParams = { ...topParams, ...operationParams };\n ensureAllDefinedPathParamsAreUsedInPath(path, definedParams, pathElements, results);\n ensureAllExpectedParamsInPathAreDefined(path, definedParams, pathElements, operationPath, results);\n }\n }\n }\n\n return results;\n};\n\nfunction generateResult(message, path) {\n return {\n message,\n path,\n };\n}\n\nconst requiredMessage = name => `Path parameter \"${name}\" must have \"required\" property that is set to \"true\".`;\n\nconst uniqueDefinitionMessage = name => `Path parameter \"${name}\" must not be defined multiple times.`;\n\nexport default oasPathParam;\n"
|
|
},
|
|
{
|
|
"id": "jSPbiQ4Np9h0tZTAVxshi",
|
|
"extendedFrom": "",
|
|
"name": "oasSchema",
|
|
"content": "import traverse from 'json-schema-traverse';\nimport { schema as schemaFn } from '@stoplight/spectral-functions';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\nimport { oas2, oas3_1, extractDraftVersion, oas3_0 } from '@stoplight/spectral-formats';\nimport { isPlainObject, pointerToPath } from '@stoplight/json';\n\nfunction rewriteNullable(schema, errors) {\n for (const error of errors) {\n if (error.keyword !== 'type') continue;\n const value = getSchemaProperty(schema, error.schemaPath);\n if (isPlainObject(value) && value.nullable === true) {\n error.message += ',null';\n }\n }\n}\n\nexport default createRulesetFunction(\n {\n input: null,\n options: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n },\n },\n additionalProperties: false,\n },\n },\n function oasSchema(targetVal, opts, context) {\n const formats = context.document.formats;\n\n let { schema } = opts;\n\n let dialect = 'draft4';\n let prepareResults;\n\n if (!formats) {\n dialect = 'auto';\n } else if (formats.has(oas3_1)) {\n if (isPlainObject(context.document.data) && typeof context.document.data.jsonSchemaDialect === 'string') {\n dialect = extractDraftVersion(context.document.data.jsonSchemaDialect) ?? 'draft2020-12';\n } else {\n dialect = 'draft2020-12';\n }\n } else if (formats.has(oas3_0)) {\n prepareResults = rewriteNullable.bind(null, schema);\n } else if (formats.has(oas2)) {\n const clonedSchema = JSON.parse(JSON.stringify(schema));\n traverse(clonedSchema, visitOAS2);\n schema = clonedSchema;\n prepareResults = rewriteNullable.bind(null, clonedSchema);\n }\n\n return schemaFn(\n targetVal,\n {\n ...opts,\n schema,\n prepareResults,\n dialect,\n },\n context,\n );\n },\n);\n\nconst visitOAS2 = schema => {\n if (schema['x-nullable'] === true) {\n schema.nullable = true;\n delete schema['x-nullable'];\n }\n};\n\nfunction getSchemaProperty(schema, schemaPath) {\n const path = pointerToPath(schemaPath);\n let value = schema;\n\n for (const fragment of path.slice(0, -1)) {\n if (!isPlainObject(value)) {\n return;\n }\n\n value = value[fragment];\n }\n\n return value;\n}\n"
|
|
},
|
|
{
|
|
"id": "zkdTymCWqcmxPJWZxyMxr",
|
|
"extendedFrom": "",
|
|
"name": "oasTagDefined",
|
|
"content": "// This function will check an API doc to verify that any tag that appears on\n// an operation is also present in the global tags array.\nimport { isPlainObject } from '@stoplight/json';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nconst validOperationKeys = ['get', 'head', 'post', 'put', 'patch', 'delete', 'options', 'trace'];\n\nfunction* getAllOperations(paths) {\n if (!isPlainObject(paths)) {\n return;\n }\n\n const item = {\n path: '',\n operation: '',\n value: null,\n };\n\n for (const path of Object.keys(paths)) {\n const operations = paths[path];\n if (!isPlainObject(operations)) {\n continue;\n }\n\n item.path = path;\n\n for (const operation of Object.keys(operations)) {\n if (!isPlainObject(operations[operation]) || !validOperationKeys.includes(operation)) {\n continue;\n }\n\n item.operation = operation;\n item.value = operations[operation];\n\n yield item;\n }\n }\n}\n\nexport const oasTagDefined = targetVal => {\n if (!isObject(targetVal)) return;\n const results = [];\n\n const globalTags = [];\n\n if (Array.isArray(targetVal.tags)) {\n for (const tag of targetVal.tags) {\n if (isObject(tag) && typeof tag.name === 'string') {\n globalTags.push(tag.name);\n }\n }\n }\n\n const { paths } = targetVal;\n\n for (const { path, operation, value } of getAllOperations(paths)) {\n if (!isObject(value)) continue;\n\n const { tags } = value;\n\n if (!Array.isArray(tags)) {\n continue;\n }\n\n for (const [i, tag] of tags.entries()) {\n if (!globalTags.includes(tag)) {\n results.push({\n message: 'Operation tags must be defined in global tags.',\n path: ['paths', path, operation, 'tags', i],\n });\n }\n }\n }\n\n return results;\n};\n\nexport default oasTagDefined;\n"
|
|
},
|
|
{
|
|
"id": "bSNTJ6RVt78jw4E_B8RZx",
|
|
"extendedFrom": "",
|
|
"name": "oasUnusedComponent",
|
|
"content": "import { unreferencedReusableObject } from '@stoplight/spectral-functions';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nexport default createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n components: {\n type: 'object',\n },\n },\n required: ['components'],\n },\n options: null,\n },\n function oasUnusedComponent(targetVal, opts, context) {\n const results = [];\n const componentTypes = [\n 'schemas',\n 'responses',\n 'parameters',\n 'examples',\n 'requestBodies',\n 'headers',\n 'links',\n 'callbacks',\n ];\n\n for (const type of componentTypes) {\n const value = targetVal.components[type];\n if (!isObject(value)) continue;\n\n const resultsForType = unreferencedReusableObject(\n value,\n { reusableObjectsLocation: `#/components/${type}` },\n context,\n );\n if (resultsForType !== void 0 && Array.isArray(resultsForType)) {\n results.push(...resultsForType);\n }\n }\n\n return results;\n },\n);\n"
|
|
},
|
|
{
|
|
"id": "-uVRn9J4Aa9vPBuXTKs3j",
|
|
"extendedFrom": "",
|
|
"name": "refSiblings",
|
|
"content": "function isObject(value) {\n return value !== null && typeof value === 'object';\n}\n\nfunction getParentValue(document, path) {\n if (path.length === 0) {\n return null;\n }\n\n let piece = document;\n\n for (let i = 0; i < path.length - 1; i += 1) {\n if (!isObject(piece)) {\n return null;\n }\n\n piece = piece[path[i]];\n }\n\n return piece;\n}\n\nconst refSiblings = (targetVal, opts, { document, path }) => {\n const value = getParentValue(document.data, path);\n\n if (!isObject(value)) {\n return;\n }\n\n const keys = Object.keys(value);\n if (keys.length === 1) {\n return;\n }\n\n const results = [];\n const actualObjPath = path.slice(0, -1);\n\n for (const key of keys) {\n if (key === '$ref') {\n continue;\n }\n results.push({\n message: '$ref must not be placed next to any other properties',\n path: [...actualObjPath, key],\n });\n }\n\n return results;\n};\n\nexport default refSiblings;\n"
|
|
},
|
|
{
|
|
"id": "JLGe8QHPvzG6Ov6FWmWFZ",
|
|
"extendedFrom": "",
|
|
"name": "typedEnum",
|
|
"content": "import { oas2, oas3_0 } from '@stoplight/spectral-formats';\nimport { printValue } from '@stoplight/spectral-runtime';\nimport { createRulesetFunction } from '@stoplight/spectral-core';\n\nfunction getDataType(input, checkForInteger) {\n const type = typeof input;\n switch (type) {\n case 'string':\n case 'boolean':\n return type;\n case 'number':\n if (checkForInteger && Number.isInteger(input)) {\n return 'integer';\n }\n\n return 'number';\n case 'object':\n if (input === null) {\n return 'null';\n }\n\n return Array.isArray(input) ? 'array' : 'object';\n default:\n throw TypeError('Unknown input type');\n }\n}\n\nfunction getTypes(input, formats) {\n const { type } = input;\n\n if (\n (input.nullable === true && formats?.has(oas3_0) === true) ||\n (input['x-nullable'] === true && formats?.has(oas2) === true)\n ) {\n return Array.isArray(type) ? [...type, 'null'] : [type, 'null'];\n }\n\n return type;\n}\n\nexport const typedEnum = createRulesetFunction(\n {\n input: {\n type: 'object',\n properties: {\n enum: {\n type: 'array',\n },\n type: {\n oneOf: [\n {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n {\n type: 'string',\n },\n ],\n },\n },\n required: ['enum', 'type'],\n },\n options: null,\n },\n function (input, opts, context) {\n const { enum: enumValues } = input;\n const type = getTypes(input, context.document.formats);\n const checkForInteger = type === 'integer' || (Array.isArray(type) && type.includes('integer'));\n\n let results;\n\n enumValues.forEach((value, i) => {\n const valueType = getDataType(value, checkForInteger);\n\n if (valueType === type || (Array.isArray(type) && type.includes(valueType))) {\n return;\n }\n\n results ??= [];\n results.push({\n message: `Enum value ${printValue(enumValues[i])} must be \"${String(type)}\".`,\n path: [...context.path, 'enum', i],\n });\n });\n\n return results;\n },\n);\n\nexport default typedEnum;\n"
|
|
}
|
|
],
|
|
"extendedDefault": false
|
|
}
|
|
},
|
|
"extendedDefault": true
|
|
} |