Skip to content

Commit c947670

Browse files
authored
some fixes to please my moulinette (#1232)
Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
1 parent 68ac2af commit c947670

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

openapi3/origin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ func originFromSeq(s []any) *Origin {
9494
}
9595
count := toInt(s[idx])
9696
idx++
97-
locs := make([]Location, count)
97+
locs := make([]Location, 0, count)
9898
for j := 0; j < count && idx+2 < len(s); j++ {
9999
name, _ := s[idx].(string)
100100
delta := toInt(s[idx+1])
101101
col := toInt(s[idx+2])
102-
locs[j] = Location{File: file, Line: keyLine + delta, Column: col, Name: name}
102+
locs = append(locs, Location{File: file, Line: keyLine + delta, Column: col, Name: name})
103103
idx += 3
104104
}
105105
o.Sequences[sname] = locs

openapi3filter/req_resp_decoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ func pathFromKeys(kk []string) []any {
11421142
// The function returns an error when an error happened while parse array's items.
11431143
func parseArray(raw []string, schemaRef *openapi3.SchemaRef) ([]any, error) {
11441144
if schemaRef.Value.Items == nil || schemaRef.Value.Items.Value == nil {
1145-
return nil, fmt.Errorf("array items schema is required for decoding")
1145+
return nil, errors.New("array items schema is required for decoding")
11461146
}
11471147
var value []any
11481148
for i, v := range raw {

0 commit comments

Comments
 (0)