make captures public
This commit is contained in:
parent
d1ab4fefb0
commit
2c1b9cf5ff
|
@ -65,10 +65,10 @@ func (svc *Service) checkPattern() error {
|
||||||
braceName := matches[0][1]
|
braceName := matches[0][1]
|
||||||
|
|
||||||
// append
|
// append
|
||||||
if svc.captures == nil {
|
if svc.Captures == nil {
|
||||||
svc.captures = make([]*braceCapture, 0)
|
svc.Captures = make([]*BraceCapture, 0)
|
||||||
}
|
}
|
||||||
svc.captures = append(svc.captures, &braceCapture{
|
svc.Captures = append(svc.Captures, &BraceCapture{
|
||||||
Index: i,
|
Index: i,
|
||||||
Name: braceName,
|
Name: braceName,
|
||||||
Ref: nil,
|
Ref: nil,
|
||||||
|
@ -105,7 +105,7 @@ func (svc *Service) checkAndFormatInput(types []datatype.DataType) error {
|
||||||
braceName := matches[0][1]
|
braceName := matches[0][1]
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, capture := range svc.captures {
|
for _, capture := range svc.Captures {
|
||||||
if capture.Name == braceName {
|
if capture.Name == braceName {
|
||||||
capture.Ref = param
|
capture.Ref = param
|
||||||
found = true
|
found = true
|
||||||
|
|
|
@ -24,7 +24,7 @@ type Service struct {
|
||||||
// Download *bool `json:"download"`
|
// Download *bool `json:"download"`
|
||||||
// Output map[string]*Parameter `json:"out"`
|
// Output map[string]*Parameter `json:"out"`
|
||||||
|
|
||||||
captures []*braceCapture
|
Captures []*BraceCapture
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parameter represents a parameter definition (from api.json)
|
// Parameter represents a parameter definition (from api.json)
|
||||||
|
@ -39,8 +39,8 @@ type Parameter struct {
|
||||||
Validator datatype.Validator
|
Validator datatype.Validator
|
||||||
}
|
}
|
||||||
|
|
||||||
// links to the related URI parameter
|
// BraceCapture links to the related URI parameter
|
||||||
type braceCapture struct {
|
type BraceCapture struct {
|
||||||
Name string
|
Name string
|
||||||
Index int
|
Index int
|
||||||
Ref *Parameter
|
Ref *Parameter
|
||||||
|
@ -48,6 +48,6 @@ type braceCapture struct {
|
||||||
|
|
||||||
// links to the related URI parameter and hold a value
|
// links to the related URI parameter and hold a value
|
||||||
type braceCaptureValue struct {
|
type braceCaptureValue struct {
|
||||||
braceCapture
|
BraceCapture
|
||||||
Value interface{}
|
Value interface{}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue