added yaml

This commit is contained in:
Kofo Okesola 2025-04-16 17:23:33 +01:00
parent b9b66db86f
commit cc4ffc9abc
1 changed files with 33 additions and 31 deletions

View File

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