From 193989297237d714e30b84156b9f636f473cfb8b Mon Sep 17 00:00:00 2001 From: Roman Sahan Date: Mon, 29 Apr 2024 15:59:05 +0200 Subject: [PATCH 1/5] HCK-5545: requestBody should be present only for request types that supports it --- .../entity_level/entityLevelConfig.json | 1325 +++++++++-------- snippets/requestStructure.json | 107 +- 2 files changed, 747 insertions(+), 685 deletions(-) diff --git a/properties_pane/entity_level/entityLevelConfig.json b/properties_pane/entity_level/entityLevelConfig.json index 19e53d4..d845dca 100644 --- a/properties_pane/entity_level/entityLevelConfig.json +++ b/properties_pane/entity_level/entityLevelConfig.json @@ -127,660 +127,673 @@ making sure that you maintain a proper JSON format. */ [ - { - "lowerTab": "Details", - "structure": [ - { - "propertyName": "Request operation", - "propertyKeyword": "collectionName", - "propertyTooltip": "Select from list of operations", - "propertyType": "select", - "options": ["get", "put", "post", "delete", "options", "head", "patch", "trace", "$ref"], - "dependency": { - "key": "entityType", - "value": "request" - } - }, - { - "propertyName": "Response", - "propertyKeyword": "collectionName", - "propertyTooltip": "Select from list of options", - "propertyType": "select", - "options": [ - { - "name": "1XX (Informational)", - "value": "1XX", - "tooltip": "Informational" - }, - { - "name": "100 (Continue)", - "value": "100", - "tooltip": "Continue" - }, - { - "name": "101 (Switching ...)", - "value": "101", - "tooltip": "Switching Protocols" - }, - { - "name": "2XX (Successful)", - "value": "2XX", - "tooltip": "Successful" - }, - { - "name": "200 (OK)", - "value": "200", - "tooltip": "OK" - }, - { - "name": "201 (Created)", - "value": "201", - "tooltip": "Created" - }, - { - "name": "202 (Accepted)", - "value": "202", - "tooltip": "Accepted" - }, - { - "name": "203 (Non-Author...)", - "value": "203", - "tooltip": "Non-Authoritative Information" - }, - { - "name": "204 (No Content)", - "value": "204", - "tooltip": "No Content" - }, - { - "name": "205 (Reset Content)", - "value": "205", - "tooltip": "Reset Content" - }, - { - "name": "206 (Partial Co...)", - "value": "206", - "tooltip": "Partial Content" - }, - { - "name": "207 (Multi-Status)", - "value": "207", - "tooltip": "Multi-Status" - }, - { - "name": "226 (IM Used)", - "value": "226", - "tooltip": "IM Used" - }, - { - "name": "3XX (Redirection)", - "value": "3XX", - "tooltip": "Redirection" - }, - { - "name": "300 (Multiple C...)", - "value": "300", - "tooltip": "Multiple Choices" - }, - { - "name": "301 (Moved Perm...)", - "value": "301", - "tooltip": "Moved Permanently" - }, - { - "name": "302 (Found)", - "value": "302", - "tooltip": "Found" - }, - { - "name": "303 (See Other)", - "value": "303", - "tooltip": "See Other" - }, - { - "name": "304 (Not Modified)", - "value": "304", - "tooltip": "Not Modified" - }, - { - "name": "305 (Use Proxy)", - "value": "305", - "tooltip": "Use Proxy" - }, - { - "name": "307 (Temporary ...)", - "value": "307", - "tooltip": "Temporary Redirect" - }, - { - "name": "308 (Permanent ...)", - "value": "308", - "tooltip": "Permanent Redirect" - }, - { - "name": "4XX (Client Error)", - "value": "4XX", - "tooltip": "Client Error" - }, - { - "name": "400 (Bad Request)", - "value": "400", - "tooltip": "Bad Request" - }, - { - "name": "401 (Unauthorized)", - "value": "401", - "tooltip": "Unauthorized" - }, - { - "name": "402 (Payment Re...)", - "value": "402", - "tooltip": "Payment Required" - }, - { - "name": "403 (Forbidden)", - "value": "403", - "tooltip": "Forbidden" - }, - { - "name": "404 (Not Found)", - "value": "404", - "tooltip": "Not Found" - }, - { - "name": "405 (Method Not...)", - "value": "405", - "tooltip": "Method Not Allowed" - }, - { - "name": "406 (Not Accept...)", - "value": "406", - "tooltip": "Not Acceptable" - }, - { - "name": "407 (Proxy Auth...)", - "value": "407", - "tooltip": "Proxy Authentication Required" - }, - { - "name": "408 (Request Ti...)", - "value": "408", - "tooltip": "Request Timeout" - }, - { - "name": "409 (Conflict)", - "value": "409", - "tooltip": "Conflict" - }, - { - "name": "410 (Gone)", - "value": "410", - "tooltip": "Gone" - }, - { - "name": "411 (Length Req...)", - "value": "411", - "tooltip": "Length Required" - }, - { - "name": "412 (Preconditi...)", - "value": "412", - "tooltip": "Precondition Failed" - }, - { - "name": "413 (Request En...)", - "value": "413", - "tooltip": "Request Entity Too Large" - }, - { - "name": "414 (Request-UR...)", - "value": "414", - "tooltip": "Request-URI Too Long" - }, - { - "name": "415 (Unsupporte...)", - "value": "415", - "tooltip": "Unsupported Media Type" - }, - { - "name": "416 (Requested ...)", - "value": "416", - "tooltip": "Requested Range Not Satisfiable" - }, - { - "name": "417 (Expectatio...)", - "value": "417", - "tooltip": "Expectation Failed" - }, - { - "name": "418 (I'm a teapot)", - "value": "418", - "tooltip": "I'm a teapot" - }, - { - "name": "421 (Misdirecte...)", - "value": "421", - "tooltip": "Misdirected Request" - }, - { - "name": "422 (Unprocessa...)", - "value": "422", - "tooltip": "Unprocessable Entity" - }, - { - "name": "423 (Locked)", - "value": "423", - "tooltip": "Locked" - }, - { - "name": "424 (Failed Dep...)", - "value": "424", - "tooltip": "Failed Dependency" - }, - { - "name": "425 (Too Early)", - "value": "425", - "tooltip": "Too Early" - }, - { - "name": "426 (Upgrade Re...)", - "value": "426", - "tooltip": "Upgrade Required" - }, - { - "name": "428 (Preconditi...)", - "value": "428", - "tooltip": "Precondition Required" - }, - { - "name": "429 (Too Many R...)", - "value": "429", - "tooltip": "Too Many Requests" - }, - { - "name": "431 (Request He...)", - "value": "431", - "tooltip": "Request Header Fields Too Large" - }, - { - "name": "451 (Unavailabl...)", - "value": "451", - "tooltip": "Unavailable For Legal Reasons" - }, - { - "name": "5XX (Server Error)", - "value": "5XX", - "tooltip": "Server Error" - }, - { - "name": "500 (Internal S...)", - "value": "500", - "tooltip": "Internal Server Error" - }, - { - "name": "501 (Not Implem...)", - "value": "501", - "tooltip": "Not Implemented" - }, - { - "name": "502 (Bad Gateway)", - "value": "502", - "tooltip": "Bad Gateway" - }, - { - "name": "503 (Service Un...)", - "value": "503", - "tooltip": "Service Unavailable" - }, - { - "name": "504 (Gateway Ti...)", - "value": "504", - "tooltip": "Gateway Timeout" - }, - { - "name": "505 (HTTP Versi...)", - "value": "505", - "tooltip": "HTTP Version Not Supported" - }, - { - "name": "506 (Variant Al...)", - "value": "506", - "tooltip": "Variant Also Negotiates" - }, - { - "name": "507 (Insufficie...)", - "value": "507", - "tooltip": "Insufficient Storage" - }, - { - "name": "508 (Loop Detected)", - "value": "508", - "tooltip": "Loop Detected" - }, - { - "name": "510 (Not Extended)", - "value": "510", - "tooltip": "Not Extended" - }, - { - "name": "511 (Network Au...)", - "value": "511", - "tooltip": "Network Authentication Required" - }, - { - "name": "default", - "value": "default", - "tooltip": "default" - } - ], - "dependency": { - "key": "entityType", - "value": "response" - } - }, - { - "propertyKeyword": "additionalProperties", - "propertyName": "Additional Properties", - "propertyType": "checkbox", - "hidden": true - }, - { - "propertyName": "Activated", - "propertyKeyword": "isActivated", - "propertyType": "checkbox", - "propertyTooltip": "Deactivated item will be commented out in the schema" - }, - { - "propertyName": "schema", - "propertyKeyword": "pathItemSchema", - "propertyType": "fieldList", - "template": "orderedList", - "dependency": { - "type": "and", - "values": [ - { - "key": "collectionName", - "value": "$ref" - }, - { - "key": "entityType", - "value": "request" - } - ] - } - }, - { - "propertyName": "tags", - "propertyType": "group", - "propertyKeyword": "tags", - "shouldValidate": true, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "tag", - "propertyKeyword": "tag", - "propertyTooltip": "", - "propertyType": "text" - } - ], - "dependency": { - "key": "entityType", - "value": "request" - } - }, - { - "propertyName": "summary", - "propertyKeyword": "summary", - "propertyType": "text", - "sampleGen": "&containerName|&entityName|&random|", - "dependency": { - "key": "entityType", - "value": "request" - } - }, - { - "propertyName": "externalDocs", - "propertyType": "block", - "propertyKeyword": "externalDocs", - "shouldValidate": true, - "propertyTooltip": "", - "dependency": { - "key": "entityType", - "value": "request" - }, - "structure": [ - { - "propertyName": "url", - "propertyKeyword": "externalDocsUrl", - "shouldValidate": true, - "propertyTooltip": "", - "propertyType": "text", - "regex": "^([A-Za-z][A-Za-z0-9+.-]*:/{0,3})?[A-Za-z0-9{}\\[\\]._~%!$&\\'()*+,;=:@/-]*([?][A-Za-z0-9._~%!$&\\'()*+,;=:@/?-]*)?(#[A-Za-z0-9._~%!$&\\'()*+,;=:@/?-]*)?$" - }, - { - "propertyName": "description", - "propertyKeyword": "externalDocsDescription", - "propertyTooltip": "", - "propertyType": "details", - "template": "textarea" - }, - { - "propertyName": "extensions", - "propertyType": "group", - "propertyKeyword": "scopesExtensions", - "shouldValidate": true, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "pattern", - "propertyKeyword": "extensionPattern", - "shouldValidate": true, - "propertyType": "text", - "regex": "^x-" - }, - { - "propertyName": "value", - "propertyKeyword": "extensionValue", - "propertyValidate": false, - "propertyTooltip": "Popup for multi-line text entry", - "propertyType": "details", - "template": "textarea", - "markdown": false - } - ] - } - ] - }, - { - "propertyName": "operationId", - "propertyKeyword": "operationId", - "propertyType": "text", - "sampleGen": "&containerName|&entityName|&random|", - "dependency": { - "key": "entityType", - "value": "request" - } - }, - { - "propertyName": "deprecated", - "propertyKeyword": "deprecated", - "propertyType": "checkbox", - "dependency": { - "key": "entityType", - "value": "request" - } - }, - { - "propertyName": "security", - "propertyType": "group", - "propertyKeyword": "security", - "shouldValidate": true, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "pattern {name}", - "propertyKeyword": "securityRequirementName", - "propertyTooltip": "", - "propertyType": "text" - }, - { - "propertyName": "operation", - "propertyKeyword": "securityRequirementOperation", - "propertyTooltip": "", - "propertyType": "multipleText" - } - ], - "dependency": { - "key": "entityType", - "value": "request" - } - }, - { - "propertyName": "servers", - "propertyType": "group", - "propertyKeyword": "servers", - "shouldValidate": true, - "propertyTooltip": "", - "dependency": { - "key": "entityType", - "value": "request" - }, - "structure": [ - { - "propertyName": "url", - "propertyKeyword": "serverURL", - "shouldValidate": true, - "propertyType": "text", - "propertyFormat": "uri" - }, - { - "propertyName": "description", - "propertyKeyword": "serverDescription", - "propertyValidate": false, - "propertyTooltip": "Popup for multi-line text entry", - "propertyType": "details", - "template": "textarea" - }, - { - "propertyName": "variables", - "propertyType": "group", - "propertyKeyword": "serverVariables", - "shouldValidate": true, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "name", - "propertyKeyword": "serverVariableName", - "propertyTooltip": "", - "propertyType": "text" - }, - { - "propertyName": "enum", - "propertyType": "group", - "propertyKeyword": "serverVariableEnum", - "shouldValidate": true, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "value", - "propertyKeyword": "serverVariableEnumValue", - "propertyTooltip": "", - "propertyType": "text" - } - ] - }, - { - "propertyName": "default", - "propertyKeyword": "serverVariableDefault", - "propertyTooltip": "", - "propertyType": "text" - }, - { - "propertyName": "description", - "propertyKeyword": "serverVariableDescription", - "propertyTooltip": "", - "propertyType": "details", - "template": "textarea" - }, - { - "propertyName": "extensions", - "propertyType": "group", - "propertyKeyword": "scopesExtensions", - "shouldValidate": true, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "pattern", - "propertyKeyword": "extensionPattern", - "shouldValidate": true, - "propertyType": "text", - "regex": "^x-" - }, - { - "propertyName": "value", - "propertyKeyword": "extensionValue", - "propertyValidate": false, - "propertyTooltip": "Popup for multi-line text entry", - "propertyType": "details", - "template": "textarea", - "markdown": false - } - ] - } - ] - }, - { - "propertyName": "extensions", - "propertyType": "group", - "propertyKeyword": "scopesExtensions", - "shouldValidate": true, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "pattern", - "propertyKeyword": "extensionPattern", - "shouldValidate": true, - "propertyType": "text", - "regex": "^x-" - }, - { - "propertyName": "value", - "propertyKeyword": "extensionValue", - "propertyValidate": false, - "propertyTooltip": "Popup for multi-line text entry", - "propertyType": "details", - "template": "textarea", - "markdown": false - } - ] - } - ] - }, - { - "propertyName": "extensions", - "propertyType": "group", - "propertyKeyword": "scopesExtensions", - "shouldValidate": true, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "pattern", - "propertyKeyword": "extensionPattern", - "shouldValidate": true, - "propertyType": "text", - "regex": "^x-" - }, - { - "propertyName": "value", - "propertyKeyword": "extensionValue", - "propertyValidate": false, - "propertyTooltip": "Popup for multi-line text entry", - "propertyType": "details", - "template": "textarea", - "markdown": false - } - ] - } - ] - } + { + "lowerTab": "Details", + "structure": [ + { + "propertyName": "Request operation", + "propertyKeyword": "collectionName", + "propertyTooltip": "Select from list of operations", + "propertyType": "select", + "options": [ + "get", + "put", + "post", + "delete", + "options", + "head", + "patch", + "trace", + "$ref" + ], + "dependency": { + "key": "entityType", + "value": "request" + }, + "snippetDependency": { + "name": "requestStructure" + } + }, + { + "propertyName": "Response", + "propertyKeyword": "collectionName", + "propertyTooltip": "Select from list of options", + "propertyType": "select", + "options": [ + { + "name": "1XX (Informational)", + "value": "1XX", + "tooltip": "Informational" + }, + { + "name": "100 (Continue)", + "value": "100", + "tooltip": "Continue" + }, + { + "name": "101 (Switching ...)", + "value": "101", + "tooltip": "Switching Protocols" + }, + { + "name": "2XX (Successful)", + "value": "2XX", + "tooltip": "Successful" + }, + { + "name": "200 (OK)", + "value": "200", + "tooltip": "OK" + }, + { + "name": "201 (Created)", + "value": "201", + "tooltip": "Created" + }, + { + "name": "202 (Accepted)", + "value": "202", + "tooltip": "Accepted" + }, + { + "name": "203 (Non-Author...)", + "value": "203", + "tooltip": "Non-Authoritative Information" + }, + { + "name": "204 (No Content)", + "value": "204", + "tooltip": "No Content" + }, + { + "name": "205 (Reset Content)", + "value": "205", + "tooltip": "Reset Content" + }, + { + "name": "206 (Partial Co...)", + "value": "206", + "tooltip": "Partial Content" + }, + { + "name": "207 (Multi-Status)", + "value": "207", + "tooltip": "Multi-Status" + }, + { + "name": "226 (IM Used)", + "value": "226", + "tooltip": "IM Used" + }, + { + "name": "3XX (Redirection)", + "value": "3XX", + "tooltip": "Redirection" + }, + { + "name": "300 (Multiple C...)", + "value": "300", + "tooltip": "Multiple Choices" + }, + { + "name": "301 (Moved Perm...)", + "value": "301", + "tooltip": "Moved Permanently" + }, + { + "name": "302 (Found)", + "value": "302", + "tooltip": "Found" + }, + { + "name": "303 (See Other)", + "value": "303", + "tooltip": "See Other" + }, + { + "name": "304 (Not Modified)", + "value": "304", + "tooltip": "Not Modified" + }, + { + "name": "305 (Use Proxy)", + "value": "305", + "tooltip": "Use Proxy" + }, + { + "name": "307 (Temporary ...)", + "value": "307", + "tooltip": "Temporary Redirect" + }, + { + "name": "308 (Permanent ...)", + "value": "308", + "tooltip": "Permanent Redirect" + }, + { + "name": "4XX (Client Error)", + "value": "4XX", + "tooltip": "Client Error" + }, + { + "name": "400 (Bad Request)", + "value": "400", + "tooltip": "Bad Request" + }, + { + "name": "401 (Unauthorized)", + "value": "401", + "tooltip": "Unauthorized" + }, + { + "name": "402 (Payment Re...)", + "value": "402", + "tooltip": "Payment Required" + }, + { + "name": "403 (Forbidden)", + "value": "403", + "tooltip": "Forbidden" + }, + { + "name": "404 (Not Found)", + "value": "404", + "tooltip": "Not Found" + }, + { + "name": "405 (Method Not...)", + "value": "405", + "tooltip": "Method Not Allowed" + }, + { + "name": "406 (Not Accept...)", + "value": "406", + "tooltip": "Not Acceptable" + }, + { + "name": "407 (Proxy Auth...)", + "value": "407", + "tooltip": "Proxy Authentication Required" + }, + { + "name": "408 (Request Ti...)", + "value": "408", + "tooltip": "Request Timeout" + }, + { + "name": "409 (Conflict)", + "value": "409", + "tooltip": "Conflict" + }, + { + "name": "410 (Gone)", + "value": "410", + "tooltip": "Gone" + }, + { + "name": "411 (Length Req...)", + "value": "411", + "tooltip": "Length Required" + }, + { + "name": "412 (Preconditi...)", + "value": "412", + "tooltip": "Precondition Failed" + }, + { + "name": "413 (Request En...)", + "value": "413", + "tooltip": "Request Entity Too Large" + }, + { + "name": "414 (Request-UR...)", + "value": "414", + "tooltip": "Request-URI Too Long" + }, + { + "name": "415 (Unsupporte...)", + "value": "415", + "tooltip": "Unsupported Media Type" + }, + { + "name": "416 (Requested ...)", + "value": "416", + "tooltip": "Requested Range Not Satisfiable" + }, + { + "name": "417 (Expectatio...)", + "value": "417", + "tooltip": "Expectation Failed" + }, + { + "name": "418 (I'm a teapot)", + "value": "418", + "tooltip": "I'm a teapot" + }, + { + "name": "421 (Misdirecte...)", + "value": "421", + "tooltip": "Misdirected Request" + }, + { + "name": "422 (Unprocessa...)", + "value": "422", + "tooltip": "Unprocessable Entity" + }, + { + "name": "423 (Locked)", + "value": "423", + "tooltip": "Locked" + }, + { + "name": "424 (Failed Dep...)", + "value": "424", + "tooltip": "Failed Dependency" + }, + { + "name": "425 (Too Early)", + "value": "425", + "tooltip": "Too Early" + }, + { + "name": "426 (Upgrade Re...)", + "value": "426", + "tooltip": "Upgrade Required" + }, + { + "name": "428 (Preconditi...)", + "value": "428", + "tooltip": "Precondition Required" + }, + { + "name": "429 (Too Many R...)", + "value": "429", + "tooltip": "Too Many Requests" + }, + { + "name": "431 (Request He...)", + "value": "431", + "tooltip": "Request Header Fields Too Large" + }, + { + "name": "451 (Unavailabl...)", + "value": "451", + "tooltip": "Unavailable For Legal Reasons" + }, + { + "name": "5XX (Server Error)", + "value": "5XX", + "tooltip": "Server Error" + }, + { + "name": "500 (Internal S...)", + "value": "500", + "tooltip": "Internal Server Error" + }, + { + "name": "501 (Not Implem...)", + "value": "501", + "tooltip": "Not Implemented" + }, + { + "name": "502 (Bad Gateway)", + "value": "502", + "tooltip": "Bad Gateway" + }, + { + "name": "503 (Service Un...)", + "value": "503", + "tooltip": "Service Unavailable" + }, + { + "name": "504 (Gateway Ti...)", + "value": "504", + "tooltip": "Gateway Timeout" + }, + { + "name": "505 (HTTP Versi...)", + "value": "505", + "tooltip": "HTTP Version Not Supported" + }, + { + "name": "506 (Variant Al...)", + "value": "506", + "tooltip": "Variant Also Negotiates" + }, + { + "name": "507 (Insufficie...)", + "value": "507", + "tooltip": "Insufficient Storage" + }, + { + "name": "508 (Loop Detected)", + "value": "508", + "tooltip": "Loop Detected" + }, + { + "name": "510 (Not Extended)", + "value": "510", + "tooltip": "Not Extended" + }, + { + "name": "511 (Network Au...)", + "value": "511", + "tooltip": "Network Authentication Required" + }, + { + "name": "default", + "value": "default", + "tooltip": "default" + } + ], + "dependency": { + "key": "entityType", + "value": "response" + } + }, + { + "propertyKeyword": "additionalProperties", + "propertyName": "Additional Properties", + "propertyType": "checkbox", + "hidden": true + }, + { + "propertyName": "Activated", + "propertyKeyword": "isActivated", + "propertyType": "checkbox", + "propertyTooltip": "Deactivated item will be commented out in the schema" + }, + { + "propertyName": "schema", + "propertyKeyword": "pathItemSchema", + "propertyType": "fieldList", + "template": "orderedList", + "dependency": { + "type": "and", + "values": [ + { + "key": "collectionName", + "value": "$ref" + }, + { + "key": "entityType", + "value": "request" + } + ] + } + }, + { + "propertyName": "tags", + "propertyType": "group", + "propertyKeyword": "tags", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "tag", + "propertyKeyword": "tag", + "propertyTooltip": "", + "propertyType": "text" + } + ], + "dependency": { + "key": "entityType", + "value": "request" + } + }, + { + "propertyName": "summary", + "propertyKeyword": "summary", + "propertyType": "text", + "sampleGen": "&containerName|&entityName|&random|", + "dependency": { + "key": "entityType", + "value": "request" + } + }, + { + "propertyName": "externalDocs", + "propertyType": "block", + "propertyKeyword": "externalDocs", + "shouldValidate": true, + "propertyTooltip": "", + "dependency": { + "key": "entityType", + "value": "request" + }, + "structure": [ + { + "propertyName": "url", + "propertyKeyword": "externalDocsUrl", + "shouldValidate": true, + "propertyTooltip": "", + "propertyType": "text", + "regex": "^([A-Za-z][A-Za-z0-9+.-]*:/{0,3})?[A-Za-z0-9{}\\[\\]._~%!$&\\'()*+,;=:@/-]*([?][A-Za-z0-9._~%!$&\\'()*+,;=:@/?-]*)?(#[A-Za-z0-9._~%!$&\\'()*+,;=:@/?-]*)?$" + }, + { + "propertyName": "description", + "propertyKeyword": "externalDocsDescription", + "propertyTooltip": "", + "propertyType": "details", + "template": "textarea" + }, + { + "propertyName": "extensions", + "propertyType": "group", + "propertyKeyword": "scopesExtensions", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "pattern", + "propertyKeyword": "extensionPattern", + "shouldValidate": true, + "propertyType": "text", + "regex": "^x-" + }, + { + "propertyName": "value", + "propertyKeyword": "extensionValue", + "propertyValidate": false, + "propertyTooltip": "Popup for multi-line text entry", + "propertyType": "details", + "template": "textarea", + "markdown": false + } + ] + } + ] + }, + { + "propertyName": "operationId", + "propertyKeyword": "operationId", + "propertyType": "text", + "sampleGen": "&containerName|&entityName|&random|", + "dependency": { + "key": "entityType", + "value": "request" + } + }, + { + "propertyName": "deprecated", + "propertyKeyword": "deprecated", + "propertyType": "checkbox", + "dependency": { + "key": "entityType", + "value": "request" + } + }, + { + "propertyName": "security", + "propertyType": "group", + "propertyKeyword": "security", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "pattern {name}", + "propertyKeyword": "securityRequirementName", + "propertyTooltip": "", + "propertyType": "text" + }, + { + "propertyName": "operation", + "propertyKeyword": "securityRequirementOperation", + "propertyTooltip": "", + "propertyType": "multipleText" + } + ], + "dependency": { + "key": "entityType", + "value": "request" + } + }, + { + "propertyName": "servers", + "propertyType": "group", + "propertyKeyword": "servers", + "shouldValidate": true, + "propertyTooltip": "", + "dependency": { + "key": "entityType", + "value": "request" + }, + "structure": [ + { + "propertyName": "url", + "propertyKeyword": "serverURL", + "shouldValidate": true, + "propertyType": "text", + "propertyFormat": "uri" + }, + { + "propertyName": "description", + "propertyKeyword": "serverDescription", + "propertyValidate": false, + "propertyTooltip": "Popup for multi-line text entry", + "propertyType": "details", + "template": "textarea" + }, + { + "propertyName": "variables", + "propertyType": "group", + "propertyKeyword": "serverVariables", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "name", + "propertyKeyword": "serverVariableName", + "propertyTooltip": "", + "propertyType": "text" + }, + { + "propertyName": "enum", + "propertyType": "group", + "propertyKeyword": "serverVariableEnum", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "value", + "propertyKeyword": "serverVariableEnumValue", + "propertyTooltip": "", + "propertyType": "text" + } + ] + }, + { + "propertyName": "default", + "propertyKeyword": "serverVariableDefault", + "propertyTooltip": "", + "propertyType": "text" + }, + { + "propertyName": "description", + "propertyKeyword": "serverVariableDescription", + "propertyTooltip": "", + "propertyType": "details", + "template": "textarea" + }, + { + "propertyName": "extensions", + "propertyType": "group", + "propertyKeyword": "scopesExtensions", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "pattern", + "propertyKeyword": "extensionPattern", + "shouldValidate": true, + "propertyType": "text", + "regex": "^x-" + }, + { + "propertyName": "value", + "propertyKeyword": "extensionValue", + "propertyValidate": false, + "propertyTooltip": "Popup for multi-line text entry", + "propertyType": "details", + "template": "textarea", + "markdown": false + } + ] + } + ] + }, + { + "propertyName": "extensions", + "propertyType": "group", + "propertyKeyword": "scopesExtensions", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "pattern", + "propertyKeyword": "extensionPattern", + "shouldValidate": true, + "propertyType": "text", + "regex": "^x-" + }, + { + "propertyName": "value", + "propertyKeyword": "extensionValue", + "propertyValidate": false, + "propertyTooltip": "Popup for multi-line text entry", + "propertyType": "details", + "template": "textarea", + "markdown": false + } + ] + } + ] + }, + { + "propertyName": "extensions", + "propertyType": "group", + "propertyKeyword": "scopesExtensions", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "pattern", + "propertyKeyword": "extensionPattern", + "shouldValidate": true, + "propertyType": "text", + "regex": "^x-" + }, + { + "propertyName": "value", + "propertyKeyword": "extensionValue", + "propertyValidate": false, + "propertyTooltip": "Popup for multi-line text entry", + "propertyType": "details", + "template": "textarea", + "markdown": false + } + ] + } + ] + } ] diff --git a/snippets/requestStructure.json b/snippets/requestStructure.json index 5ecfd1e..48eb9ce 100644 --- a/snippets/requestStructure.json +++ b/snippets/requestStructure.json @@ -1,31 +1,80 @@ { - "name": "requestStructure", - "properties": [{ - "name": "parameters", - "type": "array", - "subtype": "anyParameter" - }, { - "name": "requestBody", - "type": "requestBody", - "properties": [{ - "name": "application/json", - "type": "media", - "properties": [{ - "name": "schema", - "type": "object" - }, { - "name": "examples", - "type": "object", - "subtype": "example" - }, { - "name": "encoding", - "type": "object", - "subtype": "encoding" - }] - }] - }, { - "name": "callbacks", - "type": "operationObject", - "subtype": "callback" - }] + "name": "requestStructure", + "properties": [ + { + "name": "parameters", + "type": "array", + "subtype": "anyParameter" + }, + { + "name": "requestBody", + "type": "requestBody", + "dependency": { + "type": "or", + "values": [ + { + "key": "dbVersion", + "value": "3.1.0", + "level": "model" + }, + { + "type": "or", + "values": [ + { + "key": "collectionName", + "value": "post" + }, + { + "key": "collectionName", + "value": "patch" + }, + { + "key": "collectionName", + "value": "put" + }, + { + "key": "collectionName", + "value": "options" + }, + { + "key": "collectionName", + "value": "trace" + }, + { + "key": "collectionName", + "value": "$ref" + } + ] + } + ] + }, + "properties": [ + { + "name": "application/json", + "type": "media", + "properties": [ + { + "name": "schema", + "type": "object" + }, + { + "name": "examples", + "type": "object", + "subtype": "example" + }, + { + "name": "encoding", + "type": "object", + "subtype": "encoding" + } + ] + } + ] + }, + { + "name": "callbacks", + "type": "operationObject", + "subtype": "callback" + } + ] } From 9549abf31a6f7d3f6471d205d11a36b449416853 Mon Sep 17 00:00:00 2001 From: Roman Sahan Date: Tue, 30 Apr 2024 16:23:28 +0200 Subject: [PATCH 2/5] HCK-5604: add checkbox to include request body --- .../entity_level/entityLevelConfig.json | 36 +++++++++++++++++++ snippets/requestStructure.json | 9 ++--- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/properties_pane/entity_level/entityLevelConfig.json b/properties_pane/entity_level/entityLevelConfig.json index d845dca..f013ef1 100644 --- a/properties_pane/entity_level/entityLevelConfig.json +++ b/properties_pane/entity_level/entityLevelConfig.json @@ -497,6 +497,42 @@ making sure that you maintain a proper JSON format. "propertyType": "checkbox", "hidden": true }, + { + "propertyName": "Include request body", + "propertyKeyword": "withRequestBody", + "propertyType": "checkbox", + "propertyTooltip": "Request body does not have well-defined semantics and should be avoided if possible", + "snippetDependency": { + "name": "requestStructure" + }, + "dependency": { + "type": "and", + "values": [ + { + "key": "dbVersion", + "value": "3.1.0", + "level": "model" + }, + { + "type": "or", + "values": [ + { + "key": "collectionName", + "value": "get" + }, + { + "key": "collectionName", + "value": "delete" + }, + { + "key": "collectionName", + "value": "head" + } + ] + } + ] + } + }, { "propertyName": "Activated", "propertyKeyword": "isActivated", diff --git a/snippets/requestStructure.json b/snippets/requestStructure.json index 48eb9ce..aa71bcc 100644 --- a/snippets/requestStructure.json +++ b/snippets/requestStructure.json @@ -13,9 +13,8 @@ "type": "or", "values": [ { - "key": "dbVersion", - "value": "3.1.0", - "level": "model" + "key": "withRequestBody", + "value": true }, { "type": "or", @@ -36,10 +35,6 @@ "key": "collectionName", "value": "options" }, - { - "key": "collectionName", - "value": "trace" - }, { "key": "collectionName", "value": "$ref" From 1a5069e41a083f6f4a4144f71fa55fff3da4e794 Mon Sep 17 00:00:00 2001 From: Roman Sahan Date: Thu, 2 May 2024 12:53:30 +0200 Subject: [PATCH 3/5] HCK-5603: add adapter for setting withRequestBody property --- adapter/0.1.73.json | 46 +++++++++++++++++++++++ reverse_engineering/helpers/dataHelper.js | 6 ++- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 adapter/0.1.73.json diff --git a/adapter/0.1.73.json b/adapter/0.1.73.json new file mode 100644 index 0000000..66c408f --- /dev/null +++ b/adapter/0.1.73.json @@ -0,0 +1,46 @@ +/** + * Copyright © 2016-2024 by IntegrIT S.A. dba Hackolade. All rights reserved. + * + * The copyright to the computer software herein is the property of IntegrIT S.A. + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * + * { + * "add": { + * "entity": [], + * "container": [], + * "model": [], + * "view": [], + * "field": { + * "": [] + * } + * }, + * "delete": { + * "entity": [], + * "container": [], + * "model": [], + * "view": [], + * "field": { + * "": [] + * } + * }, + * "modify": { + * "entity": [ + * { + * "from": { }, + * "to": { } + * } + * ], + * "container": [], + * "model": [], + * "view": [], + * "field": [] + * }, + * } + */ +{ + "modify": { + "entity": [["setIncludeRequestBodyProperty"]] + } +} diff --git a/reverse_engineering/helpers/dataHelper.js b/reverse_engineering/helpers/dataHelper.js index 5baf4f5..4070dd4 100644 --- a/reverse_engineering/helpers/dataHelper.js +++ b/reverse_engineering/helpers/dataHelper.js @@ -732,7 +732,8 @@ const handleRequestData = (requestData, request, fieldOrder) => { const responses = requestData.responses; const entityData = getEntityData(requestData, REQUEST); const parametersData = getParametersData(requestData.parameters, fieldOrder); - const requestBody = handleRequestBody(requestData.requestBody || {}, fieldOrder); + const requestBody = requestData.requestBody ? handleRequestBody(requestData.requestBody, fieldOrder) : undefined; + const withRequestBody = !!requestBody; const callbacksData = handleObject(handleCallback, requestData.callbacks); const requestSchema = { parameters: { @@ -754,7 +755,8 @@ const handleRequestData = (requestData, request, fieldOrder) => { subtype: 'requestBody', collectionName: request, properties: requestSchema, - isActivated: true + isActivated: true, + withRequestBody, }); return { jsonSchema, responses }; }; From e6f36eb48b1291e8b9afac740643304b3fe082b2 Mon Sep 17 00:00:00 2001 From: Roman Sahan Date: Thu, 2 May 2024 17:17:36 +0200 Subject: [PATCH 4/5] HCK-5545: add withRequestBody only for deprecated types --- reverse_engineering/helpers/dataHelper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reverse_engineering/helpers/dataHelper.js b/reverse_engineering/helpers/dataHelper.js index 4070dd4..ff2c563 100644 --- a/reverse_engineering/helpers/dataHelper.js +++ b/reverse_engineering/helpers/dataHelper.js @@ -7,6 +7,7 @@ const REQUEST = 'request'; const RESPONSE = 'response'; const EXTENSION_SYMBOL = 'x-'; const REQUEST_TYPE = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', '$ref']; +const REQUEST_TYPES_WITH_BODY = ['put', 'post', 'options', 'patch', '$ref']; const getExtensions = (schema) => { const isExtension = (keyword) => keyword.substring(0, 2) === EXTENSION_SYMBOL; @@ -733,7 +734,7 @@ const handleRequestData = (requestData, request, fieldOrder) => { const entityData = getEntityData(requestData, REQUEST); const parametersData = getParametersData(requestData.parameters, fieldOrder); const requestBody = requestData.requestBody ? handleRequestBody(requestData.requestBody, fieldOrder) : undefined; - const withRequestBody = !!requestBody; + const withRequestBody = REQUEST_TYPES_WITH_BODY.includes(request) ? undefined : !!requestBody; const callbacksData = handleObject(handleCallback, requestData.callbacks); const requestSchema = { parameters: { From 4df48d72ecbd877bca703f737be75712f7bf89be Mon Sep 17 00:00:00 2001 From: Roman Sahan Date: Thu, 2 May 2024 18:25:29 +0200 Subject: [PATCH 5/5] HCK-5545: add more dependency to withRequestBody field --- snippets/requestStructure.json | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/snippets/requestStructure.json b/snippets/requestStructure.json index aa71bcc..72f8c9d 100644 --- a/snippets/requestStructure.json +++ b/snippets/requestStructure.json @@ -13,8 +13,30 @@ "type": "or", "values": [ { - "key": "withRequestBody", - "value": true + "type": "and", + "values": [ + { + "key": "withRequestBody", + "value": true + }, + { + "type": "or", + "values": [ + { + "key": "collectionName", + "value": "get" + }, + { + "key": "collectionName", + "value": "delete" + }, + { + "key": "collectionName", + "value": "head" + } + ] + } + ] }, { "type": "or",