UNPKG

@apistudio/apim-cli

Version:

CLI for API Management Products

1,266 lines 65.8 kB
export default { "rules": { "invalid-kind-value-combined": { "description": "Kind must be one of 'API' | 'Scope' | 'Project' | 'StagedPolicySequence' | 'InvokeAWSLambda' | 'ValidateAPISpecification' | 'CORS' | 'Quota' | 'Plan' | 'Product' | 'URISchemes' | 'properties' | 'Telemetry' | 'Properties' | 'LoadBalancer' | 'SetAuthorization' | 'Invoke' | 'GlobalPolicy' | 'InboundBulkHead' | 'SetMediaType' | 'InboundMessaging' | 'IAM' | 'AuthorizeUser' | 'SetContextVariable' | 'WebMethodsISService' | 'Log' | 'MonitorTraffic' | 'CacheServiceResult' | 'OutboundAlias' | 'OutboundAnonymous' | 'HTTPInvoke' | 'InvokeMessagingExtension' | 'DataMasking' | 'TransformRequest' | 'TransformResponse' | 'Route' | 'MessageConfig' | 'HTTPEndpoint' | 'MockEndpoint' | 'MockResponse' | 'ErrorProcessing' | 'Set' | 'RateLimitDef' | 'RateLimit' | 'Redact' | 'Remove' | 'Transform' | 'DataPowerAssembly' | 'Switch' | 'If' | 'OperationSwitch' | 'Try' | 'IBMCloudLogin' | 'WatsonXAIInvoke' | 'OpenAIInvoke' | 'FreeFlowPolicySequence' | 'Block' | 'TokenMediation' | 'EnforceCircuitBreaker' | 'JavaScript' | 'LuaScript' | 'Cache' | 'Antivirus' | 'SQLInjectionFilter' | 'CountLimit' | 'CountLimitDef' | 'Return' | 'Retry' | 'Throw' | 'HandlebarsTemplate' | 'ExtractIdentity' | 'Authorize' | 'Authenticate' | 'Parse'", "severity": "error", "given": "$", "then": { "field": "kind", "function": "schema", "functionOptions": { "schema": { "type": "string", "enum": [ "API", "Scope", "Project", "StagedPolicySequence", "InvokeAWSLambda", "ValidateAPISpecification", "CORS", "Quota", "Plan", "Product", "URISchemes", "properties", "Telemetry", "Properties", "LoadBalancer", "SetAuthorization", "Invoke", "GlobalPolicy", "InboundBulkHead", "SetMediaType", "InboundMessaging", "IAM", "AuthorizeUser", "SetContextVariable", "WebMethodsISService", "Log", "MonitorTraffic", "CacheServiceResult", "OutboundAlias", "OutboundAnonymous", "HTTPInvoke", "InvokeMessagingExtension", "DataMasking", "TransformRequest", "TransformResponse", "Route", "MessageConfig", "HTTPEndpoint", "MockEndpoint", "MockResponse", "ErrorProcessing", "Set", "RateLimitDef", "RateLimit", "Redact", "Remove", "Transform", "DataPowerAssembly", "Switch", "If", "OperationSwitch", "Try", "IBMCloudLogin", "WatsonXAIInvoke", "OpenAIInvoke", "FreeFlowPolicySequence", "Block", "TokenMediation", "EnforceCircuitBreaker", "JavaScript", "LuaScript", "Cache", "Antivirus", "SQLInjectionFilter", "CountLimit", "CountLimitDef", "Return", "Retry", "Throw", "HandlebarsTemplate", "ExtractIdentity", "Authorize", "Authenticate", "Parse" ] } } } }, "kind-not-exist": { "description": "Kind does not exist.", "severity": "error", "given": "$", "resolved": false, "then": { "field": "kind", "function": "truthy" } }, "invalid-kind-value": { "description": "Kind must be 'Invoke'", "severity": "error", "given": "$", "then": { "field": "kind", "function": "schema", "functionOptions": { "schema": { "type": "string", "enum": [ "Invoke" ] } } } }, "invalid-kind-spl-character": { "description": "kind should not be having empty or special characters", "severity": "error", "given": "$", "resolved": false, "then": { "field": "kind", "function": "pattern", "functionOptions": { "match": "^(?![\\s\\W_]+$).+$" } } }, "invalid-api-version": { "description": "apiVersion must be one of the valid values 'api.ibm.com/v1'", "severity": "error", "given": "$", "resolved": false, "then": { "field": "apiVersion", "function": "schema", "functionOptions": { "schema": { "type": "string", "enum": [ "api.ibm.com/v1" ] } } } }, "api-version-not-exist": { "description": "apiVersion does not exist.", "severity": "error", "given": "$", "resolved": false, "then": { "field": "apiVersion", "function": "truthy" } }, "metadata-not-exist": { "description": "Metadata does not exist.", "severity": "error", "given": "$", "resolved": false, "then": { "field": "metadata", "function": "truthy" } }, "metadata-whitelist-check": { "description": "Metadata should not be having empty or special characters", "severity": "error", "given": "$", "resolved": false, "then": { "field": "metadata", "function": "pattern", "functionOptions": { "match": "^(?![\\s\\W_]+$).+$" } } }, "metadata-name-not-exist": { "description": "Metadata name does not exist", "severity": "error", "given": "$.metadata", "resolved": false, "then": { "field": "name", "function": "truthy" } }, "metadata-name-whitelist-check": { "description": "Metadata name should not be having empty or special characters", "severity": "error", "given": "$.metadata", "resolved": false, "then": { "field": "name", "function": "pattern", "functionOptions": { "match": "^(?![\\s\\W_]+$).+$" } } }, "metadata-version-not-exist": { "description": "Metadata version does not exist", "severity": "error", "given": "$.metadata", "resolved": false, "then": { "field": "version", "function": "truthy" } }, "metadata-version-whitelist-check": { "description": "Metadata version should not be having empty or special characters", "severity": "error", "given": "$.metadata", "resolved": false, "then": { "field": "version", "function": "pattern", "functionOptions": { "match": "^(?![\\s\\W_]+$).+$" } } }, "metadata-namespace-not-exist": { "description": "Metadata namespace does not exist", "severity": "warn", "given": "$.metadata", "resolved": false, "then": { "field": "namespace", "function": "truthy" } }, "metadata-namespace-whitelist-check": { "description": "Metadata namespace should not be having empty or special characters", "severity": "warn", "given": "$.metadata", "resolved": false, "then": { "field": "namespace", "function": "pattern", "functionOptions": { "match": "^(?![\\s\\W_]+$).+$" } } }, "spec-details-not-exist": { "description": "Spec details does not exist", "severity": "error", "given": "$", "resolved": false, "then": { "field": "spec", "function": "truthy" } }, "spec-details-whitelist-check": { "description": "Spec should not be having empty or special characters", "severity": "error", "given": "$", "resolved": false, "then": { "field": "spec", "function": "pattern", "functionOptions": { "match": "^(?![\\s\\W_]+$).+$" } } }, "tags-not-exist": { "description": "Tag does not exist", "severity": "warn", "given": "$.metadata", "resolved": false, "then": { "field": "tags", "function": "truthy" } }, "invalid-tag-type": { "description": "Invalid Tag Type", "severity": "error", "given": "$.metadata.tags", "resolved": false, "then": { "function": "schema", "functionOptions": { "schema": { "type": "array" } } } }, "$-metadata-description-type": { "description": "The description field must be of type string", "severity": "error", "given": "$.metadata.description", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-metadata-name-required": { "description": "The name field is required in the $.metadata", "severity": "error", "given": "$.metadata", "then": { "field": "name", "function": "defined" } }, "$-metadata-name-type": { "description": "The name field must be of type string", "severity": "error", "given": "$.metadata.name", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-metadata-namespace-type": { "description": "The namespace field must be of type string", "severity": "error", "given": "$.metadata.namespace", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-metadata-tags-type": { "description": "The tags field must be of type array", "severity": "error", "given": "$.metadata.tags", "then": { "function": "schema", "functionOptions": { "schema": { "type": "array" } } } }, "$-metadata-tags-items-type": { "description": "Items in the tags array must be of type string", "severity": "error", "given": "$.metadata.tags[*]", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-metadata-type-type": { "description": "The type field must be of type string", "severity": "error", "given": "$.metadata.type", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-metadata-type-enum": { "description": "The type field must be one of: REST, SWAGGER, SOAP, GRAPHQL, ODATA", "severity": "error", "given": "$.metadata.type", "then": { "function": "schema", "functionOptions": { "schema": { "enum": [ "REST", "SWAGGER", "SOAP", "GRAPHQL", "ODATA" ] } } } }, "$-metadata-version-required": { "description": "The version field is required in the $.metadata", "severity": "error", "given": "$.metadata", "then": { "field": "version", "function": "defined" } }, "$-metadata-version-type": { "description": "The version field must be of type string", "severity": "error", "given": "$.metadata.version", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-metadata-labels-type": { "description": "The labels field must be of type object", "severity": "error", "given": "$.metadata.labels", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-metadata-labels-gatewayTypes-type": { "description": "The gatewayTypes field must be of type array", "severity": "error", "given": "$.metadata.labels.gatewayTypes", "then": { "function": "schema", "functionOptions": { "schema": { "type": "array" } } } }, "$-metadata-labels-gatewayTypes-items-type": { "description": "Items in the gatewayTypes array must be of type string", "severity": "error", "given": "$.metadata.labels.gatewayTypes[*]", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-cache-type": { "description": "The cache field must be of type object", "severity": "error", "given": "$.spec.cache", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-cache-expire-oneOf": { "description": "The expire field must match the oneOf schema definition", "severity": "error", "given": "$.spec.cache.expire", "then": { "function": "schema", "functionOptions": { "schema": { "oneOf": [ { "type": "object", "required": [ "fromMessageHeader" ], "properties": { "fromMessageHeader": { "type": "object", "required": [ "headerName", "messageName" ], "properties": { "headerName": { "type": "string" }, "messageName": { "type": "string" } } } }, "additionalProperties": false }, { "type": "object", "required": [ "fromVariable" ], "properties": { "fromVariable": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string" } } } }, "additionalProperties": false }, { "type": "object", "required": [ "fromCacheControl" ], "properties": { "fromCacheControl": { "type": "object", "required": [ "messageName" ], "properties": { "messageName": { "type": "string" } } } }, "additionalProperties": false }, { "type": "object", "required": [ "static" ], "properties": { "static": { "type": "object", "required": [ "seconds" ], "properties": { "seconds": { "type": "integer", "format": "uint64", "minimum": 0 } } } }, "additionalProperties": false } ] } } } }, "$-spec-cache-expire-fromMessageHeader-type": { "description": "The fromMessageHeader field must be of type object", "severity": "error", "given": "$.spec.cache.expire.fromMessageHeader", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-cache-expire-fromMessageHeader-headerName-type": { "description": "The headerName field must be of type string", "severity": "error", "given": "$.spec.cache.expire.fromMessageHeader.headerName", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-cache-expire-fromMessageHeader-messageName-type": { "description": "The messageName field must be of type string", "severity": "error", "given": "$.spec.cache.expire.fromMessageHeader.messageName", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-cache-expire-fromVariable-type": { "description": "The fromVariable field must be of type object", "severity": "error", "given": "$.spec.cache.expire.fromVariable", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-cache-expire-fromVariable-name-type": { "description": "The name field must be of type string", "severity": "error", "given": "$.spec.cache.expire.fromVariable.name", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-cache-expire-fromCacheControl-type": { "description": "The fromCacheControl field must be of type object", "severity": "error", "given": "$.spec.cache.expire.fromCacheControl", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-cache-expire-fromCacheControl-messageName-type": { "description": "The messageName field must be of type string", "severity": "error", "given": "$.spec.cache.expire.fromCacheControl.messageName", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-cache-expire-static-type": { "description": "The static field must be of type object", "severity": "error", "given": "$.spec.cache.expire.static", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-cache-expire-static-seconds-type": { "description": "The seconds field must be of type integer", "severity": "error", "given": "$.spec.cache.expire.static.seconds", "then": { "function": "schema", "functionOptions": { "schema": { "type": "integer" } } } }, "$-spec-cache-scope-oneOf": { "description": "The scope field must match the oneOf schema definition", "severity": "error", "given": "$.spec.cache.scope", "then": { "function": "schema", "functionOptions": { "schema": { "oneOf": [ { "type": "object", "required": [ "narrowScope" ], "properties": { "narrowScope": { "type": "object" } }, "additionalProperties": false }, { "type": "object", "required": [ "wideScope" ], "properties": { "wideScope": { "type": "object" } }, "additionalProperties": false } ] } } } }, "$-spec-cache-scope-narrowScope-type": { "description": "The narrowScope field must be of type object", "severity": "error", "given": "$.spec.cache.scope.narrowScope", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-cache-scope-wideScope-type": { "description": "The wideScope field must be of type object", "severity": "error", "given": "$.spec.cache.scope.wideScope", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-cache-no-additional-properties": { "description": "The cache object should only contain the defined properties: expire, scope", "severity": "error", "given": "$.spec.cache", "then": { "function": "schema", "functionOptions": { "schema": { "additionalProperties": false, "properties": { "expire": {}, "scope": {} } } } } }, "$-spec-endpoint-oneOf": { "description": "The endpoint field must match the oneOf schema definition", "severity": "error", "given": "$.spec.endpoint", "then": { "function": "schema", "functionOptions": { "schema": { "oneOf": [ { "type": "object", "required": [ "http" ], "properties": { "http": { "type": "object", "required": [ "target" ], "properties": { "statusException": { "type": "array", "items": { "type": "object", "required": [ "pattern" ], "properties": { "pattern": { "type": "string", "pattern": "^[0-9*]{3}$" } }, "additionalProperties": false } }, "target": { "type": "object", "required": [ "url" ], "properties": { "persistentConnections": { "type": "boolean", "default": true }, "timeout": { "type": "integer", "format": "uint64", "minimum": 0, "default": 20 }, "tlsClientProfile": { "type": "string" }, "url": { "type": "string" }, "decompressResponse": { "type": "boolean", "default": false }, "followRedirects": { "type": "boolean", "default": false }, "chunkedUpload": { "type": "boolean", "default": false }, "urlType": { "type": "string", "enum": [ "plain", "variables", "jsonata", "distributedVariable" ] }, "compressRequest": { "type": "string", "enum": [ "br", "gzip", "deflate", "none" ] }, "version": { "type": "string", "enum": [ "HTTP/1.0", "HTTP/1.1", "HTTP/2" ] } }, "additionalProperties": false }, "verb": { "type": "string" } }, "additionalProperties": false } }, "additionalProperties": false } ] } } } }, "$-spec-endpoint-http-type": { "description": "The http field must be of type object", "severity": "error", "given": "$.spec.endpoint.http", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-endpoint-http-statusException-type": { "description": "The statusException field must be of type array", "severity": "error", "given": "$.spec.endpoint.http.statusException", "then": { "function": "schema", "functionOptions": { "schema": { "type": "array" } } } }, "$-spec-endpoint-http-statusException-items-type": { "description": "Items in the statusException array must be of type object", "severity": "error", "given": "$.spec.endpoint.http.statusException[*]", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-endpoint-http-statusException[*]-pattern-type": { "description": "The pattern field must be of type string", "severity": "error", "given": "$.spec.endpoint.http.statusException[*].pattern", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-endpoint-http-statusException-no-additional-properties": { "description": "The statusException object should only contain the defined properties: pattern", "severity": "error", "given": "$.spec.endpoint.http.statusException[*]", "then": { "function": "schema", "functionOptions": { "schema": { "additionalProperties": false, "properties": { "pattern": {} } } } } }, "required:$.spec.endpoint.http.statusException[*]:pattern": { "description": "The pattern field is required in statusException array items", "severity": "error", "given": "$.spec.endpoint.http.statusException[*]", "then": { "field": "pattern", "function": "defined" } }, "type:$.spec.endpoint.http.statusException[*].pattern:string": { "description": "The pattern field in statusException array items must be of type string", "severity": "error", "given": "$.spec.endpoint.http.statusException[*].pattern", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "no-additional-properties:$.spec.endpoint.http.statusException[*]": { "description": "Items in the statusException array should only contain the defined properties: pattern", "severity": "error", "given": "$.spec.endpoint.http.statusException[*]", "then": { "function": "schema", "functionOptions": { "schema": { "additionalProperties": false, "properties": { "pattern": {} } } } } }, "$-spec-endpoint-http-target-type": { "description": "The target field must be of type object", "severity": "error", "given": "$.spec.endpoint.http.target", "then": { "function": "schema", "functionOptions": { "schema": { "type": "object" } } } }, "$-spec-endpoint-http-target-persistentConnections-type": { "description": "The persistentConnections field must be of type boolean", "severity": "error", "given": "$.spec.endpoint.http.target.persistentConnections", "then": { "function": "schema", "functionOptions": { "schema": { "type": "boolean" } } } }, "$-spec-endpoint-http-target-timeout-type": { "description": "The timeout field must be of type integer", "severity": "error", "given": "$.spec.endpoint.http.target.timeout", "then": { "function": "schema", "functionOptions": { "schema": { "type": "integer" } } } }, "$-spec-endpoint-http-target-tlsClientProfile-type": { "description": "The tlsClientProfile field must be of type string", "severity": "error", "given": "$.spec.endpoint.http.target.tlsClientProfile", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-endpoint-http-target-url-type": { "description": "The url field must be of type string", "severity": "error", "given": "$.spec.endpoint.http.target.url", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-endpoint-http-target-decompressResponse-type": { "description": "The decompressResponse field must be of type boolean", "severity": "error", "given": "$.spec.endpoint.http.target.decompressResponse", "then": { "function": "schema", "functionOptions": { "schema": { "type": "boolean" } } } }, "$-spec-endpoint-http-target-followRedirects-type": { "description": "The followRedirects field must be of type boolean", "severity": "error", "given": "$.spec.endpoint.http.target.followRedirects", "then": { "function": "schema", "functionOptions": { "schema": { "type": "boolean" } } } }, "$-spec-endpoint-http-target-chunkedUpload-type": { "description": "The chunkedUpload field must be of type boolean", "severity": "error", "given": "$.spec.endpoint.http.target.chunkedUpload", "then": { "function": "schema", "functionOptions": { "schema": { "type": "boolean" } } } }, "$-spec-endpoint-http-target-urlType-type": { "description": "The urlType field must be of type string", "severity": "error", "given": "$.spec.endpoint.http.target.urlType", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-endpoint-http-target-urlType-enum": { "description": "The urlType field must be one of: plain, variables, jsonata, distributedVariable", "severity": "error", "given": "$.spec.endpoint.http.target.urlType", "then": { "function": "schema", "functionOptions": { "schema": { "enum": [ "plain", "variables", "jsonata", "distributedVariable" ] } } } }, "$-spec-endpoint-http-target-compressRequest-type": { "description": "The compressRequest field must be of type string", "severity": "error", "given": "$.spec.endpoint.http.target.compressRequest", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-endpoint-http-target-compressRequest-enum": { "description": "The compressRequest field must be one of: br, gzip, deflate, none", "severity": "error", "given": "$.spec.endpoint.http.target.compressRequest", "then": { "function": "schema", "functionOptions": { "schema": { "enum": [ "br", "gzip", "deflate", "none" ] } } } }, "$-spec-endpoint-http-target-version-type": { "description": "The version field must be of type string", "severity": "error", "given": "$.spec.endpoint.http.target.version", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-endpoint-http-target-version-enum": { "description": "The version field must be one of: HTTP/1.0, HTTP/1.1, HTTP/2", "severity": "error", "given": "$.spec.endpoint.http.target.version", "then": { "function": "schema", "functionOptions": { "schema": { "enum": [ "HTTP/1.0", "HTTP/1.1", "HTTP/2" ] } } } }, "$-spec-endpoint-http-target-no-additional-properties": { "description": "The target object should only contain the defined properties: persistentConnections, timeout, tlsClientProfile, url, decompressResponse, followRedirects, chunkedUpload, urlType, compressRequest, version", "severity": "error", "given": "$.spec.endpoint.http.target", "then": { "function": "schema", "functionOptions": { "schema": { "additionalProperties": false, "properties": { "persistentConnections": {}, "timeout": {}, "tlsClientProfile": {}, "url": {}, "decompressResponse": {}, "followRedirects": {}, "chunkedUpload": {}, "urlType": {}, "compressRequest": {}, "version": {} } } } } }, "$-spec-endpoint-http-verb-type": { "description": "The verb field must be of type string", "severity": "error", "given": "$.spec.endpoint.http.verb", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-endpoint-http-no-additional-properties": { "description": "The http object should only contain the defined properties: statusException, target, verb", "severity": "error", "given": "$.spec.endpoint.http", "then": { "function": "schema", "functionOptions": { "schema": { "additionalProperties": false, "properties": { "statusException": {}, "target": {}, "verb": {} } } } } }, "$-spec-input-type": { "description": "The input field must be of type string", "severity": "error", "given": "$.spec.input", "then": { "function": "schema", "functionOptions": { "schema": { "type": "string" } } } }, "$-spec-output-type": { "description": "The output field must be of type string", "severity": "error", "