Skip to content

Commit fd95b36

Browse files
committed
chore(lint): fix various
1 parent f13a22b commit fd95b36

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

cmd/oas3validate/main.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/grokify/gocharts/v2/data/histogram"
1010
"github.com/grokify/mogo/fmt/fmtutil"
1111
"github.com/grokify/mogo/net/urlutil"
12-
"github.com/grokify/mogo/type/maputil"
1312
"github.com/grokify/spectrum/openapi3"
1413
flags "github.com/jessevdk/go-flags"
1514
)
@@ -56,9 +55,7 @@ func main() {
5655
log.Fatal(err)
5756
}
5857

59-
ops2a := maputil.Records(ops2)
60-
61-
md := ops2a.Markdown("1. Count: ", ", Category: ", true, true)
58+
md := ops2.Markdown("1. Count: ", ", Category: ", true, true)
6259
fmt.Println(md)
6360
opts.XlsxWrite = strings.TrimSpace(opts.XlsxWrite)
6461
if len(opts.XlsxWrite) > 0 {

openapi3/spec_more.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,20 +561,19 @@ func (sm *SpecMore) SchemaRefSet(schemaName string, schemaRef *oas3.SchemaRef) e
561561
return nil
562562
}
563563

564-
// ServerURL returns the OAS3 Spec URL for the index
565-
// specified.
566-
func (sm *SpecMore) ServerURL(index uint) string {
567-
if int(index)+1 > len(sm.Spec.Servers) {
564+
// ServerURL returns the OAS3 Spec URL for the index specified.
565+
func (sm *SpecMore) ServerURL(index int) string {
566+
if index < 0 || ((index + 1) > len(sm.Spec.Servers)) {
568567
return ""
569568
}
570569
server := sm.Spec.Servers[index]
571570
return strings.TrimSpace(server.URL)
572571
}
573572

574573
// ServerURLBasePath extracts the base path from a OAS URL which can include variables.
575-
func (sm *SpecMore) ServerURLBasePath(index uint) (string, error) {
574+
func (sm *SpecMore) ServerURLBasePath(index int) (string, error) {
576575
serverURL := sm.ServerURL(index)
577-
if len(serverURL) == 0 {
576+
if serverURL == "" {
578577
return "", nil
579578
}
580579
serverURLParsed, err := urlutil.ParseURLTemplate(serverURL)

openapi3lint/lintutil/violations.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ func (vlrs *ViolationLocationsByRuleSet) Condense() {
182182
}
183183
}
184184

185-
func (vlrs *ViolationLocationsByRuleSet) Count() uint {
185+
func (vlrs *ViolationLocationsByRuleSet) Count() int {
186186
count := 0
187187
for _, vals := range vlrs.ViolationLocationsByRule {
188188
count += len(vals)
189189
}
190-
return uint(count)
190+
return count
191191
}

0 commit comments

Comments
 (0)