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 {
ID string `json:"id"`
ListenPath string `json:"listenPath"`
Method string `json:"method"`
Request RequestConfig `json:"request"`
Actions map[string]Action `json:"actions"`
Conditionals map[string]Conditional `json:"conditionals"`
Responses map[string]ResponseConfig `json:"responses"`
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"`
Schema string `json:"schema"`
FormValues []string `json:"formValues"`
Next string `json:"next"`
CORSAllowedOrigins []string `json:"corsAllowedOrigins"`
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"`
Config json.RawMessage `json:"config"`
Next string `json:"next"`
Fail string `json:"fail"`
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"`
Type string `json:"type"`
Compare string `json:"compare,omitempty"`
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"`
InvalidPath string `json:"invalidPath"`
Expression string `json:"expression"`
ValidPath string `json:"validPath" yaml:"validPath"`
InvalidPath string `json:"invalidPath" yaml:"invalidPath"`
Expression string `json:"expression" yaml:"expression"`
}
type ActionConfig struct {
ID string
Type string
Configuration string
ID string `yaml:"id"`
Type string `yaml:"type"`
Configuration string `yaml:"configuration"`
}
type ResponseConfig struct {
Code int `json:"code"`
Template string `json:"template"`
Type string `json:"type"`
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"`
Config json.RawMessage `json:"config"`
Type string `json:"type"`
ID string `json:"id" yaml:"id"`
Config json.RawMessage `json:"config" yaml:"-"`
NewConfig map[string]interface{} `yaml:"config"`
Type string `json:"type" yaml:"type"`
}