Compare commits
No commits in common. "a15a5c1f7a676e492efc21d1e32188b81a1a55b1" and "3017cc5ba962bf922f187b0b03bec9011b4025ec" have entirely different histories.
a15a5c1f7a
...
3017cc5ba9
|
@ -85,16 +85,16 @@ func (server *Server) collide() error {
|
|||
|
||||
// both captures -> as we cannot check, consider a collision
|
||||
if aIsCapture && bIsCapture {
|
||||
partErrors = append(partErrors, fmt.Errorf("(%s '%s') vs (%s '%s'): %w (path %s and %s)", aService.Method, aService.Pattern, bService.Method, bService.Pattern, ErrPatternCollision, aPart, bPart))
|
||||
partErrors = append(partErrors, fmt.Errorf("%s '%s': %w (path %s and %s)", aService.Method, aService.Pattern, ErrPatternCollision, aPart, bPart))
|
||||
continue
|
||||
}
|
||||
|
||||
// no capture -> check equal
|
||||
if !aIsCapture && !bIsCapture {
|
||||
if aPart == bPart {
|
||||
partErrors = append(partErrors, fmt.Errorf("(%s '%s') vs (%s '%s'): %w (same path '%s')", aService.Method, aService.Pattern, bService.Method, bService.Pattern, ErrPatternCollision, aPart))
|
||||
continue
|
||||
partErrors = append(partErrors, fmt.Errorf("%s '%s': %w (same path '%s')", aService.Method, aService.Pattern, ErrPatternCollision, aPart))
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// A captures B -> check type (B is A ?)
|
||||
|
@ -103,29 +103,29 @@ func (server *Server) collide() error {
|
|||
|
||||
// fail if no type or no validator
|
||||
if !exists || input.Validator == nil {
|
||||
partErrors = append(partErrors, fmt.Errorf("(%s '%s') vs (%s '%s'): %w (invalid type for %s)", aService.Method, aService.Pattern, bService.Method, bService.Pattern, ErrPatternCollision, aPart))
|
||||
partErrors = append(partErrors, fmt.Errorf("%s '%s': %w (invalid type for %s)", aService.Method, aService.Pattern, ErrPatternCollision, aPart))
|
||||
continue
|
||||
}
|
||||
|
||||
// fail if not valid
|
||||
if _, valid := input.Validator(bPart); valid {
|
||||
partErrors = append(partErrors, fmt.Errorf("(%s '%s') vs (%s '%s'): %w (%s captures '%s')", aService.Method, aService.Pattern, bService.Method, bService.Pattern, ErrPatternCollision, aPart, bPart))
|
||||
partErrors = append(partErrors, fmt.Errorf("%s '%s': %w (%s captures '%s')", aService.Method, aService.Pattern, ErrPatternCollision, aPart, bPart))
|
||||
continue
|
||||
}
|
||||
|
||||
// B captures A -> check type (A is B ?)
|
||||
} else if bIsCapture {
|
||||
} else {
|
||||
input, exists := bService.Input[bPart]
|
||||
|
||||
// fail if no type or no validator
|
||||
if !exists || input.Validator == nil {
|
||||
partErrors = append(partErrors, fmt.Errorf("(%s '%s') vs (%s '%s'): %w (invalid type for %s)", aService.Method, aService.Pattern, bService.Method, bService.Pattern, ErrPatternCollision, bPart))
|
||||
partErrors = append(partErrors, fmt.Errorf("%s '%s': %w (invalid type for %s)", bService.Method, bService.Pattern, ErrPatternCollision, bPart))
|
||||
continue
|
||||
}
|
||||
|
||||
// fail if not valid
|
||||
if _, valid := input.Validator(aPart); valid {
|
||||
partErrors = append(partErrors, fmt.Errorf("(%s '%s') vs (%s '%s'): %w (%s captures '%s')", aService.Method, aService.Pattern, bService.Method, bService.Pattern, ErrPatternCollision, bPart, aPart))
|
||||
partErrors = append(partErrors, fmt.Errorf("%s '%s': %w (%s captures '%s')", bService.Method, bService.Pattern, ErrPatternCollision, bPart, aPart))
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue