Thanks for your feedback!
EDIT
.yaml
file structureapiVersion: api-management.sensedia.com/v1 kind: OpenAPI spec: openApi: filePath: openapi.yaml stageRef: name: AVAILABLE accessTokenExpiresIn: 60 resources: - name: Exemplo OpenAPI 3.0 description: Exemplo Kind OpenAPI 3.0 operations: - method: POST path: /users flow: destination: 'https://test.com' timeout: 60 requestInterceptors: - ipFiltering: ips: - 192.168.10.1 - 10.1.1.0 type: Allow - log: encryptContent: true encryptParams: false - oauth: allowedGrantTypes: - AuthorizationCode - Implicit - JWT - rateLimit: calls: 100 limitBy: TOTAL_CALLS interval: Second softLimit: enabled: true percentage: 5 returnQuotaHeader: true - restrictAccess: environmentRefs: - name: Production type: Allow - header: headers: - name: myHeader type: App extraField: myExtraField - httpMethod: method: PUT - logObfuscation: location: Body replaceWith: '*****' customRegex: '[A-Z]+' - spikeArrest: limit: 10 interval: Second - jsonToTxt: {} - jsonToXml: {} - txtToJson: {} - xmlToJson: forceValueAsString: true - payloadSize: maximumSizeKBytes: 500 - sqlThreatProtection: blocks: - Body - Headers - Cookies - PathParams - QueryParams ignoreContentTypes: - multipart/form-data ignoreExpressions: - expression1 - expression2 - xssThreatProtection: uriPathExpressions: includeDefaultExpression: true queryParamExpressions: includeDefaultExpression: false additionalExpressions: - expression1 bodyExpressions: includeDefaultExpression: true additionalExpressions: - expression2 - expression3
openapi.yaml
file referenced in the previous fileopenapi: 3.0.3 info: description: Sample API to demonstrate OpenAPI 3.0.3 title: Teste API OpenAPI CLI version: 1.0.0 servers: - url: https://api.example.com/v1 paths: /users: get: responses: "200": content: application/json: schema: items: $ref: "#/components/schemas/User" type: array description: A list of users tags: - Users operationId: listUsers summary: List all users post: responses: "201": content: application/json: schema: $ref: "#/components/schemas/User" description: User created tags: - Users operationId: createUser requestBody: content: application/json: schema: $ref: "#/components/schemas/NewUser" required: true summary: Create a new user components: schemas: NewUser: properties: email: type: string name: type: string type: object User: properties: email: type: string id: type: string name: type: string type: object
{ "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "https://sensedia.com/cli/api-management/OpenAPI/apply", "type": "object", "properties": { "apiVersion": { "type": "string", "enum": [ "api-management.sensedia.com/v1" ] }, "kind": { "type": "string", "enum": [ "OpenAPI" ] }, "metadata": { "type": "object", "additionalProperties": { "type": "string" } }, "spec": { "additionalProperties": false, "type": "object", "required": [ "openApi", "stageRef" ], "properties": { "openApi": { "$ref": "#/$defs/openApi" }, "stageRef": { "$ref": "#/$defs/namedRef" }, "flow": { "$ref": "#/$defs/flow" }, "resources": { "type": "array", "items": { "$ref": "#/$defs/resource" } }, "accessTokenExpiresIn": { "type": "integer" } } } }, "required": [ "apiVersion", "kind", "spec" ], "$defs": { "openApi": { "additionalProperties": false, "properties": { "filePath": { "type": "string" } }, "required": [ "filePath" ] }, "namedRef": { "additionalProperties": false, "type": "object", "properties": { "name": { "type": "string" } }, "required": [ "name" ] }, "resource": { "type": "object", "additionalProperties": false, "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "flow": { "$ref": "#/$defs/flow" }, "operations": { "type": "array", "items": { "$ref": "#/$defs/operation" } } }, "required": [ "name" ] }, "operation": { "type": "object", "additionalProperties": false, "properties": { "method": { "type": "string", "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"] }, "path": { "type": "string" }, "description": { "type": "string" }, "flow": { "$ref": "#/$defs/flow" } }, "required": [ "method", "path" ] }, "requestInterceptor": { "type": "object", "oneOf": [ { "type": "object", "additionalProperties": false, "properties": { "ipFiltering": { "$ref": "#/$defs/ipFilteringInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "log": { "$ref": "#/$defs/logInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "oauth": { "$ref": "#/$defs/oauthInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "rateLimit": { "$ref": "#/$defs/rateLimitInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "restrictAccess": { "$ref": "#/$defs/restrictAccessInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "mock": { "$ref": "#/$defs/mockInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "header": { "$ref": "#/$defs/headerInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "httpMethod": { "$ref": "#/$defs/httpMethodInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "logObfuscation": { "$ref": "#/$defs/logObfuscationInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "spikeArrest": { "$ref": "#/$defs/spikeArrestInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "jsonToTxt": { "$ref": "#/$defs/jsonToTxtInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "jsonToXml": { "$ref": "#/$defs/jsonToXmlInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "txtToJson": { "$ref": "#/$defs/txtToJsonInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "xmlToJson": { "$ref": "#/$defs/xmlToJsonInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "payloadSize": { "$ref": "#/$defs/payloadSizeInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "sqlThreatProtection": { "$ref": "#/$defs/sqlThreatProtectionRequestInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "xssThreatProtection": { "$ref": "#/$defs/xssThreatProtectionRequestInterceptor" } } } ] }, "responseInterceptor": { "type": "object", "oneOf": [ { "type": "object", "additionalProperties": false, "properties": { "log": { "$ref": "#/$defs/logInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "header": { "$ref": "#/$defs/headerInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "logObfuscation": { "$ref": "#/$defs/logObfuscationInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "jsonToTxt": { "$ref": "#/$defs/jsonToTxtInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "jsonToXml": { "$ref": "#/$defs/jsonToXmlInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "txtToJson": { "$ref": "#/$defs/txtToJsonInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "xmlToJson": { "$ref": "#/$defs/xmlToJsonInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "sqlThreatProtection": { "$ref": "#/$defs/sqlThreatProtectionResponseInterceptor" } } }, { "type": "object", "additionalProperties": false, "properties": { "xssThreatProtection": { "$ref": "#/$defs/xssThreatProtectionResponseInterceptor" } } } ] }, "flow": { "additionalProperties": false, "type": "object", "properties": { "requestInterceptors": { "type": "array", "items": { "$ref": "#/$defs/requestInterceptor" } }, "responseInterceptors": { "type": "array", "items": { "$ref": "#/$defs/responseInterceptor" } }, "destination": { "type": "string" }, "timeout": { "type": "integer" } } }, "ipFilteringInterceptor": { "type": "object", "additionalProperties": false, "properties": { "ips": { "type": "array", "items": { "type": "string" } }, "type": { "type": "string", "enum": [ "Allow", "Block" ] } }, "required": [ "ips", "type" ] }, "logInterceptor": { "type": "object", "additionalProperties": false, "properties": { "encryptContent": { "type": "boolean" }, "encryptParams": { "type": "boolean" } } }, "oauthInterceptor": { "type": "object", "additionalProperties": false, "properties": { "allowedGrantTypes": { "type": "array", "items": { "type": "string", "enum": [ "AuthorizationCode", "Implicit", "ClientCredentials", "Password", "JWT" ] } } } }, "rateLimitInterceptor": { "type": "object", "additionalProperties": false, "properties": { "calls": { "type": "integer" }, "limitBy": { "type": "string", "enum": [ "TOTAL_CALLS", "IP" ] }, "interval": { "type": "string", "enum": [ "Second", "Minute", "Hour", "Day", "Month" ] }, "softLimit": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "percentage": { "type": "integer" } } }, "returnQuotaHeader": { "type": "boolean" } }, "required": [ "calls", "interval" ] }, "restrictAccessInterceptor": { "type": "object", "additionalProperties": false, "properties": { "environmentRefs": { "type": "array", "items": { "$ref": "#/$defs/namedRef" } }, "type": { "type": "string", "enum": [ "Allow", "Block" ] } }, "required": [ "environmentRefs", "type" ] }, "mockInterceptor": { "type": "object", "additionalProperties": false, "properties": { "headers": { "type": "array", "items": { "properties": { "key": { "type": "string" }, "value": { "type": "string" } }, "required": [ "key", "value" ] } }, "statusCode": { "type": "integer" }, "body": { "type": "string" } }, "required": [ "statusCode" ] }, "headerInterceptor": { "type": "object", "additionalProperties": false, "properties": { "headers": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "type": { "type": "string", "enum": [ "App", "AccessToken", "Custom" ] }, "extraField": { "type": "string" } }, "required": [ "name", "type", "extraField" ] } } } }, "httpMethodInterceptor": { "type": "object", "additionalProperties": false, "properties": { "method": { "type": "string", "enum": [ "GET", "POST", "PUT", "DELETE" ] } }, "required": [ "method" ] }, "logObfuscationInterceptor": { "type": "object", "additionalProperties": false, "properties": { "location": { "type": "string", "enum": [ "Header", "Body" ] }, "attribute": { "type": "string" }, "customRegex": { "type": "string" }, "replaceWith": { "type": "string" } }, "required": [ "location", "replaceWith" ] }, "spikeArrestInterceptor": { "type": "object", "additionalProperties": false, "properties": { "limit": { "type": "integer" }, "interval": { "type": "string", "enum": [ "Second", "Minute", "Hour" ] } }, "required": [ "limit", "interval" ] }, "jsonToTxtInterceptor": { "type": "object", "additionalProperties": false, "properties": {} }, "jsonToXmlInterceptor": { "type": "object", "additionalProperties": false, "properties": {} }, "txtToJsonInterceptor": { "type": "object", "additionalProperties": false, "properties": {} }, "xmlToJsonInterceptor": { "type": "object", "additionalProperties": false, "properties": { "forceValueAsString": { "type": "boolean" } } }, "payloadSizeInterceptor": { "type": "object", "additionalProperties": false, "properties": { "maximumSizeKBytes": { "type": "integer" } }, "required": ["maximumSizeKBytes"] }, "sqlThreatProtectionRequestInterceptor": { "type": "object", "additionalProperties": false, "properties": { "blocks": { "type": "array", "items": { "type": "string", "enum": [ "Body", "Headers", "QueryParams", "Cookies", "PathParams" ] }, "minItems": 1 }, "ignoreContentTypes": { "type": "array", "items": { "type": "string", "enum": [ "multipart/form-data" ] }, "minItems": 1 }, "ignoreExpressions": { "type": "array", "items": { "type": "string" }, "minItems": 1 } }, "required": [ "blocks" ] }, "sqlThreatProtectionResponseInterceptor": { "type": "object", "additionalProperties": false, "properties": { "blocks": { "type": "array", "items": { "type": "string", "enum": [ "Body", "Headers" ] }, "minItems": 1 }, "ignoreContentTypes": { "type": "array", "items": { "type": "string", "enum": [ "multipart/form-data" ] }, "minItems": 1 }, "ignoreExpressions": { "type": "array", "items": { "type": "string" }, "minItems": 1 } }, "required": [ "blocks" ] }, "xssThreadProtectionExpressionConfig": { "type": "object", "additionalProperties": false, "properties": { "includeDefaultExpression": { "type": "boolean", "default": "false" }, "additionalExpressions": { "type": "array", "items": { "type": "string" }, "minItems": 1 } } }, "xssThreatProtectionRequestInterceptor": { "type": "object", "additionalProperties": false, "properties": { "uriPathExpressions": { "$ref": "#/$defs/xssThreadProtectionExpressionConfig" }, "queryParamExpressions": { "$ref": "#/$defs/xssThreadProtectionExpressionConfig" }, "headerExpressions": { "$ref": "#/$defs/xssThreadProtectionExpressionConfig" }, "bodyExpressions": { "$ref": "#/$defs/xssThreadProtectionExpressionConfig" } } }, "xssThreatProtectionResponseInterceptor": { "type": "object", "additionalProperties": false, "properties": { "headerExpressions": { "$ref": "#/$defs/xssThreadProtectionExpressionConfig" }, "bodyExpressions": { "$ref": "#/$defs/xssThreadProtectionExpressionConfig" } } } } }
Share your suggestions with us!
Click here and then [+ Submit idea]