Files
node-problem-detector/vendor/github.com/go-openapi/swag/loading/json.go
Bruno Chauvet 877b6d6908 Fix Grype CVEs: update logrus and prometheus/prometheus
- Update github.com/sirupsen/logrus v1.9.0 -> v1.9.3 in test/go.mod
  to fix GHSA-4f99-4q7p-p3gh (High)
- Update github.com/prometheus/prometheus v0.35.0 -> v0.311.3
  to fix GHSA-vffh-x6r8-xx99 (Medium)
- Run go mod tidy and go mod vendor to update vendor directory
2026-05-03 10:05:37 -04:00

26 lines
639 B
Go

// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
// SPDX-License-Identifier: Apache-2.0
package loading
import (
"encoding/json"
"errors"
"path/filepath"
)
// JSONMatcher matches json for a file loader.
func JSONMatcher(path string) bool {
ext := filepath.Ext(path)
return ext == ".json" || ext == ".jsn" || ext == ".jso"
}
// JSONDoc loads a json document from either a file or a remote url.
func JSONDoc(path string, opts ...Option) (json.RawMessage, error) {
data, err := LoadFromFileOrHTTP(path, opts...)
if err != nil {
return nil, errors.Join(err, ErrLoader)
}
return json.RawMessage(data), nil
}