Skip to content

Commit

Permalink
Add middleware meta
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Oct 28, 2018
1 parent 97f79ea commit 7600adb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ type Middleware interface {
// Validate request
// If returns nil, it will pass the request onwards
// If returns a pointer, request will get replied to with provided response
Request(resource string, headers map[string][]string) *middleware.RequestResponse
Request(resource string, headers map[string][]string, config interface{}) *middleware.RequestResponse

// Validate and filter response
// If returns nil, it will pass the request onwards with the returned data
// If returns a pointer, request will get replied to with provided response without data
Response(resource string, headers map[string][]string, data []map[string]interface{}) ([]map[string]interface{}, *middleware.RequestResponse)
Response(resource string, headers map[string][]string, data []map[string]interface{}, config interface{}) ([]map[string]interface{}, *middleware.RequestResponse)
}

type Registry interface {
Expand Down
10 changes: 8 additions & 2 deletions schema/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ type Schema struct {
Meta ResourceMeta
}

type MiddlewareMeta struct {
Type string `json:"type"`
Data interface{} `json:"data"`
}

type ResourceMeta struct {
Resource string `json:"resource"`
Store string `json:"store"`
Resource string `json:"resource"`
Store string `json:"store"`
Middlewares []MiddlewareMeta `json:"middlewares"`
}

0 comments on commit 7600adb

Please sign in to comment.