package apiconfig import "encoding/json" type RequestType string const ( JSON RequestType = "json" FormData RequestType = "form-data" ) type APIConfig struct { ID string `json:"id" yaml:"id"` ListenPath string `json:"listenPath" yaml:"listenPath"` Method string `json:"method" yaml:"method"` Request RequestConfig `json:"request" yaml:"request"` Actions map[string]Action `json:"actions" yaml:"actions"` Conditionals map[string]Conditional `json:"conditionals" yaml:"conditionals"` Responses map[string]ResponseConfig `json:"responses" yaml:"responses"` } type RequestConfig struct { Type RequestType `json:"type" yaml:"type"` Schema string `json:"schema" yaml:"schema"` FormValues []string `json:"formValues" yaml:"formValues"` Next string `json:"next" yaml:"next"` CORSAllowedOrigins []string `json:"corsAllowedOrigins" yaml:"corsAllowedOrigins"` } type Action struct { Type string `json:"type" yaml:"type"` Config json.RawMessage `json:"config" yaml:"-"` NewConfig map[string]interface{} `yaml:"config"` Next string `json:"next" yaml:"next"` Fail string `json:"fail" yaml:"fail"` } type ConditionalExpressions struct { Value string `json:"value" yaml:"value"` Type string `json:"type" yaml:"type"` Compare string `json:"compare,omitempty" yaml:"compare,omitempty"` } type Conditional struct { ValidPath string `json:"validPath" yaml:"validPath"` InvalidPath string `json:"invalidPath" yaml:"invalidPath"` Expression string `json:"expression" yaml:"expression"` } type ActionConfig struct { ID string `yaml:"id"` Type string `yaml:"type"` Configuration string `yaml:"configuration"` } type ResponseConfig struct { Code int `json:"code" yaml:"code"` Template string `json:"template" yaml:"template"` Type string `json:"type" yaml:"type"` } type DatasourceConfig struct { ID string `json:"id" yaml:"id"` Config json.RawMessage `json:"config" yaml:"-"` NewConfig map[string]interface{} `yaml:"config"` Type string `json:"type" yaml:"type"` }