JavaScriptInterceptor .yaml File Structure (apply command)

Example 1:

apiVersion: api-management.sensedia.com/v1
kind: JavaScriptInterceptor
metadata:
  # Open text description with only example values
  type: production
  owner: engineering
spec:
  # Identifying fields
  name: "My Interceptor"
  # Other fields
  source:
    script: |
       console.log('Welcome To Sensedia');
       console.log('This is a demo interceptor');
  visibility:
     type: Team
     teamRef:
       name:  "MyTeam"
     users: ["user1", "user2"]
  tags: ["tag1", "tag2"]
  abortRequestOnFailure: true

Example 2:

apiVersion: api-management.sensedia.com/v1
kind: JavaScriptInterceptor
metadata:
  # Open text description with only example values
  type: production
  owner: engineering
spec:
  # Identifying fields
  name: "My Interceptor"
  # Other fields
  source:
    file: /scripts/myinterceptor.js
  visibility:
     type: Organization
  tags: ["tag1", "tag2"]
  abortRequestOnFailure: true

JavaScriptInterceptor Schema (apply command)

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://sensedia.com/cli/api-management/javascript-interceptor/apply",
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string",
      "enum": [
        "api-management.sensedia.com/v1"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "JavaScriptInterceptor"
      ]
    },
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "spec": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "source"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "source": {
          "$ref": "#/$defs/source"
        },
        "visibility": {
          "$ref": "#/$defs/visibility"
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "abortRequestOnFailure": {
          "type": "boolean",
          "default": false
        }
      }
    }
  },
  "required": [
    "apiVersion",
    "kind",
    "spec"
  ],
  "$defs": {
    "namedRef": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "source": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "script": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "file": {
              "type": "string"
            }
          }
        }
      ]
    },
    "visibility": {
      "additionalProperties": false,
      "type": "object",
      "default": {
        "type": "Organization"
      },
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "Team",
            "Organization",
            "Me"
          ],
          "default": "Organization"
        },
        "teamRef": {
          "$ref": "#/$defs/namedRef"
        },
        "users": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "uniqueItems": true
        }
      }
    }
  }
}
Thanks for your feedback!
EDIT

Share your suggestions with us!
Click here and then [+ Submit idea]