Skip to content

Commit 7600adb

Browse files
committed
Add middleware meta
1 parent 97f79ea commit 7600adb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

plugins/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ type Middleware interface {
7777
// Validate request
7878
// If returns nil, it will pass the request onwards
7979
// If returns a pointer, request will get replied to with provided response
80-
Request(resource string, headers map[string][]string) *middleware.RequestResponse
80+
Request(resource string, headers map[string][]string, config interface{}) *middleware.RequestResponse
8181

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

8888
type Registry interface {

schema/types.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ type Schema struct {
1919
Meta ResourceMeta
2020
}
2121

22+
type MiddlewareMeta struct {
23+
Type string `json:"type"`
24+
Data interface{} `json:"data"`
25+
}
26+
2227
type ResourceMeta struct {
23-
Resource string `json:"resource"`
24-
Store string `json:"store"`
28+
Resource string `json:"resource"`
29+
Store string `json:"store"`
30+
Middlewares []MiddlewareMeta `json:"middlewares"`
2531
}

0 commit comments

Comments
 (0)