RestAPI .yaml File Structure (apply command)

apiVersion: api-management.sensedia.com/v1
kind: RestAPI
metadata:
  # Open text description with only example values
  type: production
  owner: engineering
spec:
  # Identifying fields
  name: "My Api"
  version: "1.0.0"
  # Other fields
  description: "string"
  basePath: "string"
  stageRef:
    name: "my stage"
  visibility:
    type: Team
    teamRef:
      name: MyTeam
  resources:
  - name: "my-resource"
    description: "string"
    operations:
    - method: GET
      path: "operation path"
      description: "operation description"
      flow:
        requestInterceptors:
        - ipFiltering:
            ips: ["192.168.10.1", "10.1.1.0"]
            type: "Allow"
        - log:
            encryptContent: true
            encryptParams: false
        - oauth:
            allowedGrantTypes: ["AuthorizationCode", "Implicit"]
        - rateLimit:
            calls: 100
            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: Header
             attribute: MyAttribute
             customRegex: "[A-Z]+"
             replaceWith: "*****"
        - spikeArrest:
             limit: 10
             interval: Second
        - jsonToText: {}
        - jsonToXml: {}
        - textToJson: {}
        - xmlToJson:
            forceValueAsString: true

RestAPI Schema (apply command)

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://sensedia.com/cli/api-management/restapi",
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string",
      "enum": [
        "api-management.sensedia.com/v1"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "RestAPI"
      ]
    },
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "spec": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "version",
        "basePath",
        "stageRef"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "basePath": {
          "type": "string"
        },
        "stageRef": {
          "$ref": "#/$defs/namedRef"
        },
        "visibility": {
          "$ref": "#/$defs/visibility"
        },
        "flow": {
          "$ref": "#/$defs/flow"
        },
        "resources": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/resource"
          }
        }
      }
    }
  },
  "required": [
    "apiVersion",
    "kind",
    "spec"
  ],
  "$defs": {
    "visibility": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "Team",
            "Organization",
            "Me"
          ],
          "default": "Organization"
        },
        "teamRef": {
          "$ref": "#/$defs/namedRef"
        }
      }
    },
    "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"]
        },
        "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": {
            "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": {
            "jsonToText": {
              "$ref": "#/$defs/jsonToTextInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "jsonToXml": {
              "$ref": "#/$defs/jsonToXmlInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "textToJson": {
              "$ref": "#/$defs/textToJsonInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "xmlToJson": {
              "$ref": "#/$defs/xmlToJsonInterceptor"
            }
          }
        }
      ]
    },
    "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": {
            "jsonToText": {
              "$ref": "#/$defs/jsonToTextInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "jsonToXml": {
              "$ref": "#/$defs/jsonToXmlInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "textToJson": {
              "$ref": "#/$defs/textToJsonInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "xmlToJson": {
              "$ref": "#/$defs/xmlToJsonInterceptor"
            }
          }
        }
      ]
    },
    "flow": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "requestInterceptors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/requestInterceptor"
          }
        },
        "responseInterceptors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/responseInterceptor"
          }
        },
        "destination": {
          "type": "string"
        }
      }
    },
    "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"
            ]
          }
        }
      }
    },
    "rateLimitInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "calls": {
          "type": "integer"
        },
        "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",
            "Deny"
          ]
        }
      },
      "required": [
        "environmentRefs",
        "type"
      ]
    },
    "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"
      ]
    },
    "jsonToTextInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {}
    },
    "jsonToXmlInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {}
    },
    "textToJsonInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {}
    },
    "xmlToJsonInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "forceValueAsString": {
          "type": "boolean"
        }
      }
    }
  }
}
Thanks for your feedback!
EDIT

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