init commit

This commit is contained in:
Kofo Okesola 2024-10-04 04:58:44 +01:00
commit 2f853b3ade
3 changed files with 63 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.DS_Store
.idea

58
apiconfig/apiconfig.go Normal file
View File

@ -0,0 +1,58 @@
package apiconfig
import "encoding/json"
type RequestType string
const (
JSON RequestType = "json"
FormData RequestType = "form-data"
)
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"`
}
type RequestConfig struct {
Type RequestType `json:"type"`
Schema string `json:"schema"`
FormValues []string `json:"formValues"`
Next string `json:"next"`
CORSAllowedOrigins []string `json:"corsAllowedOrigins"`
}
type Action struct {
Type string `json:"type"`
Config json.RawMessage `json:"config"`
Next string `json:"next"`
}
type ConditionalExpressions struct {
Value string `json:"value"`
Type string `json:"type"`
Compare string `json:"compare,omitempty"`
}
type Conditional struct {
ValidPath string `json:"validPath"`
InvalidPath string `json:"invalidPath"`
Expression string `json:"expression"`
}
type ActionConfig struct {
ID string
Type string
Configuration string
}
type ResponseConfig struct {
Code int `json:"code"`
Template string `json:"template"`
Type string `json:"type"`
}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.servflow.io/servflow/servflow-definitions
go 1.22.4