@apistudio/apim-cli
Version:
CLI for API Management Products
1,046 lines (1,045 loc) • 39.1 kB
JavaScript
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' | 'test' | 'assertion' | 'environment' | 'MCPTool' | 'MCPServerConfig'",
"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",
"test",
"assertion",
"environment",
"MCPTool",
"MCPServerConfig"
]
}
}
}
},
"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 'EnforceCircuitBreaker'",
"severity": "error",
"given": "$",
"then": {
"field": "kind",
"function": "schema",
"functionOptions": {
"schema": {
"type": "string",
"enum": [
"EnforceCircuitBreaker"
]
}
}
}
},
"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-preventHalfOpen-type": {
"description": "The preventHalfOpen field must be of type boolean",
"severity": "error",
"given": "$.spec.preventHalfOpen",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "boolean"
}
}
}
},
"$-spec-recoveryDuration-type": {
"description": "The recoveryDuration field must be of type integer",
"severity": "error",
"given": "$.spec.recoveryDuration",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer"
}
}
}
},
"$-spec-recoveryDuration-minimum": {
"description": "The recoveryDuration field must have a minimum value of 1",
"severity": "error",
"given": "$.spec.recoveryDuration",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer",
"minimum": 1
}
}
}
},
"$-spec-recoveryDuration-maximum": {
"description": "The recoveryDuration field must have a maximum value of 86400",
"severity": "error",
"given": "$.spec.recoveryDuration",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer",
"maximum": 86400
}
}
}
},
"$-spec-breakConditions-type": {
"description": "The breakConditions field must be of type object",
"severity": "error",
"given": "$.spec.breakConditions",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "object"
}
}
}
},
"$-spec-breakConditions-reportedFailures-type": {
"description": "The reportedFailures field must be of type object",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailures",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "object"
}
}
}
},
"$-spec-breakConditions-reportedFailures-failureCount-type": {
"description": "The failureCount field must be of type integer",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailures.failureCount",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer"
}
}
}
},
"$-spec-breakConditions-reportedFailures-failureCount-minimum": {
"description": "The failureCount field must have a minimum value of 1",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailures.failureCount",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer",
"minimum": 1
}
}
}
},
"$-spec-breakConditions-reportedFailures-failureDuration-type": {
"description": "The failureDuration field must be of type integer",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailures.failureDuration",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer"
}
}
}
},
"$-spec-breakConditions-reportedFailures-failureDuration-minimum": {
"description": "The failureDuration field must have a minimum value of 1",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailures.failureDuration",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer",
"minimum": 1
}
}
}
},
"$-spec-breakConditions-reportedFailures-no-additional-properties": {
"description": "The reportedFailures object should only contain the defined properties: failureCount, failureDuration",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailures",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"failureCount": {},
"failureDuration": {}
}
}
}
}
},
"$-spec-breakConditions-reportedFailuresAndConcurrency-type": {
"description": "The reportedFailuresAndConcurrency field must be of type object",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailuresAndConcurrency",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "object"
}
}
}
},
"$-spec-breakConditions-reportedFailuresAndConcurrency-failureCount-type": {
"description": "The failureCount field must be of type integer",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailuresAndConcurrency.failureCount",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer"
}
}
}
},
"$-spec-breakConditions-reportedFailuresAndConcurrency-failureCount-minimum": {
"description": "The failureCount field must have a minimum value of 1",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailuresAndConcurrency.failureCount",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer",
"minimum": 1
}
}
}
},
"$-spec-breakConditions-reportedFailuresAndConcurrency-failureDuration-type": {
"description": "The failureDuration field must be of type integer",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailuresAndConcurrency.failureDuration",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer"
}
}
}
},
"$-spec-breakConditions-reportedFailuresAndConcurrency-failureDuration-minimum": {
"description": "The failureDuration field must have a minimum value of 1",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailuresAndConcurrency.failureDuration",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer",
"minimum": 1
}
}
}
},
"$-spec-breakConditions-reportedFailuresAndConcurrency-maxConcurrentRequests-type": {
"description": "The maxConcurrentRequests field must be of type integer",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailuresAndConcurrency.maxConcurrentRequests",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer"
}
}
}
},
"$-spec-breakConditions-reportedFailuresAndConcurrency-maxConcurrentRequests-minimum": {
"description": "The maxConcurrentRequests field must have a minimum value of 1",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailuresAndConcurrency.maxConcurrentRequests",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer",
"minimum": 1
}
}
}
},
"$-spec-breakConditions-reportedFailuresAndConcurrency-no-additional-properties": {
"description": "The reportedFailuresAndConcurrency object should only contain the defined properties: failureCount, failureDuration, maxConcurrentRequests",
"severity": "error",
"given": "$.spec.breakConditions.reportedFailuresAndConcurrency",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"failureCount": {},
"failureDuration": {},
"maxConcurrentRequests": {}
}
}
}
}
},
"$-spec-breakConditions-concurrency-type": {
"description": "The concurrency field must be of type object",
"severity": "error",
"given": "$.spec.breakConditions.concurrency",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "object"
}
}
}
},
"$-spec-breakConditions-concurrency-maxConcurrentRequests-type": {
"description": "The maxConcurrentRequests field must be of type integer",
"severity": "error",
"given": "$.spec.breakConditions.concurrency.maxConcurrentRequests",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer"
}
}
}
},
"$-spec-breakConditions-concurrency-maxConcurrentRequests-minimum": {
"description": "The maxConcurrentRequests field must have a minimum value of 1",
"severity": "error",
"given": "$.spec.breakConditions.concurrency.maxConcurrentRequests",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "integer",
"minimum": 1
}
}
}
},
"$-spec-breakConditions-concurrency-no-additional-properties": {
"description": "The concurrency object should only contain the defined properties: maxConcurrentRequests",
"severity": "error",
"given": "$.spec.breakConditions.concurrency",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"maxConcurrentRequests": {}
}
}
}
}
},
"$-spec-breakConditions-no-additional-properties": {
"description": "The breakConditions object should only contain the defined properties: reportedFailures, reportedFailuresAndConcurrency, concurrency",
"severity": "error",
"given": "$.spec.breakConditions",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"reportedFailures": {},
"reportedFailuresAndConcurrency": {},
"concurrency": {}
}
}
}
}
},
"$-spec-breakConditions-oneOf": {
"description": "The breakConditions field must match the oneOf schema definition",
"severity": "error",
"given": "$.spec.breakConditions",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"oneOf": [
{
"required": [
"reportedFailures"
]
},
{
"required": [
"reportedFailuresAndConcurrency"
]
},
{
"required": [
"concurrency"
]
}
]
}
}
}
},
"$-spec-execute-type": {
"description": "The execute field must be of type array",
"severity": "error",
"given": "$.spec.execute",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "array"
}
}
}
},
"$-spec-execute-items-type": {
"description": "Items in the execute array must be of type object",
"severity": "error",
"given": "$.spec.execute[*]",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "object"
}
}
}
},
"$-spec-execute[*]-$ref-type": {
"description": "The $ref field must be of type string",
"severity": "error",
"given": "$.spec.execute[*].$ref",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "string"
}
}
}
},
"$-spec-execute-no-additional-properties": {
"description": "The execute object should only contain the defined properties: $ref",
"severity": "error",
"given": "$.spec.execute[*]",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"$ref": {}
}
}
}
}
},
"required:$.spec.execute[*]:$ref": {
"description": "The $ref field is required in execute array items",
"severity": "error",
"given": "$.spec.execute[*]",
"then": {
"field": "$ref",
"function": "defined"
}
},
"type:$.spec.execute[*].$ref:string": {
"description": "The $ref field in execute array items must be of type string",
"severity": "error",
"given": "$.spec.execute[*].$ref",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "string"
}
}
}
},
"no-additional-properties:$.spec.execute[*]": {
"description": "Items in the execute array should only contain the defined properties: $ref",
"severity": "error",
"given": "$.spec.execute[*]",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"$ref": {}
}
}
}
}
},
"$-spec-fallbackExecute-type": {
"description": "The fallbackExecute field must be of type array",
"severity": "error",
"given": "$.spec.fallbackExecute",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "array"
}
}
}
},
"$-spec-fallbackExecute-items-type": {
"description": "Items in the fallbackExecute array must be of type object",
"severity": "error",
"given": "$.spec.fallbackExecute[*]",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "object"
}
}
}
},
"$-spec-fallbackExecute[*]-$ref-type": {
"description": "The $ref field must be of type string",
"severity": "error",
"given": "$.spec.fallbackExecute[*].$ref",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "string"
}
}
}
},
"$-spec-fallbackExecute-no-additional-properties": {
"description": "The fallbackExecute object should only contain the defined properties: $ref",
"severity": "error",
"given": "$.spec.fallbackExecute[*]",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"$ref": {}
}
}
}
}
},
"required:$.spec.fallbackExecute[*]:$ref": {
"description": "The $ref field is required in fallbackExecute array items",
"severity": "error",
"given": "$.spec.fallbackExecute[*]",
"then": {
"field": "$ref",
"function": "defined"
}
},
"type:$.spec.fallbackExecute[*].$ref:string": {
"description": "The $ref field in fallbackExecute array items must be of type string",
"severity": "error",
"given": "$.spec.fallbackExecute[*].$ref",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"type": "string"
}
}
}
},
"no-additional-properties:$.spec.fallbackExecute[*]": {
"description": "Items in the fallbackExecute array should only contain the defined properties: $ref",
"severity": "error",
"given": "$.spec.fallbackExecute[*]",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"$ref": {}
}
}
}
}
},
"spec-no-additional-properties": {
"description": "The spec object should only contain the defined properties: preventHalfOpen, recoveryDuration, breakConditions, execute, fallbackExecute",
"severity": "error",
"given": "$.spec",
"then": {
"function": "schema",
"functionOptions": {
"schema": {
"additionalProperties": false,
"properties": {
"preventHalfOpen": {},
"recoveryDuration": {},
"breakConditions": {},
"execute": {},
"fallbackExecute": {}
}
}
}
}
}
}
};