vendor: update buildkit to v0.29.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
+1
-1
@@ -3,4 +3,4 @@
|
||||
package aws
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.41.1"
|
||||
const goModuleVersion = "1.41.4"
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package query
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
@@ -52,7 +52,7 @@ func (m *asGetRequest) HandleSerialize(
|
||||
delim = "&"
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadAll(stream)
|
||||
b, err := io.ReadAll(stream)
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("unable to get request body %w", err)
|
||||
}
|
||||
|
||||
+11
@@ -300,6 +300,17 @@ func limitedRedirect(r *http.Request, via []*http.Request) error {
|
||||
switch resp.StatusCode {
|
||||
case 307, 308:
|
||||
// Only allow 307 and 308 redirects as they preserve the method.
|
||||
|
||||
// If redirecting to a different host, remove X-Amz-Security-Token header
|
||||
// to prevent credentials from being sent to a different host, similar to
|
||||
// how Authorization header is handled by the HTTP client.
|
||||
if len(via) > 0 {
|
||||
lastRequest := via[len(via)-1]
|
||||
if lastRequest.URL.Host != r.URL.Host {
|
||||
r.Header.Del("X-Amz-Security-Token")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+23
@@ -1,3 +1,26 @@
|
||||
# v1.32.12 (2026-03-13)
|
||||
|
||||
* **Bug Fix**: Replace usages of the old ioutil/ package throughout the SDK.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.11 (2026-03-03)
|
||||
|
||||
* **Bug Fix**: Modernize non codegen files with go fix
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.10 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.9 (2026-02-18)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.8 (2026-02-17)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.7 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+3
-3
@@ -103,7 +103,7 @@ var defaultAWSConfigResolvers = []awsConfigResolver{
|
||||
//
|
||||
// General the Config type will use type assertion against the Provider interfaces
|
||||
// to extract specific data from the Config.
|
||||
type Config interface{}
|
||||
type Config any
|
||||
|
||||
// A loader is used to load external configuration data and returns it as
|
||||
// a generic Config type.
|
||||
@@ -170,8 +170,8 @@ func (cs configs) ResolveAWSConfig(ctx context.Context, resolvers []awsConfigRes
|
||||
|
||||
// ResolveConfig calls the provide function passing slice of configuration sources.
|
||||
// This implements the aws.ConfigResolver interface.
|
||||
func (cs configs) ResolveConfig(f func(configs []interface{}) error) error {
|
||||
var cfgs []interface{}
|
||||
func (cs configs) ResolveConfig(f func(configs []any) error) error {
|
||||
var cfgs []any
|
||||
for i := range cs {
|
||||
cfgs = append(cfgs, cs[i])
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package config
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.32.7"
|
||||
const goModuleVersion = "1.32.12"
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ type IgnoreConfiguredEndpointsProvider interface {
|
||||
|
||||
// GetIgnoreConfiguredEndpoints is used in knowing when to disable configured
|
||||
// endpoints feature.
|
||||
func GetIgnoreConfiguredEndpoints(ctx context.Context, configs []interface{}) (value bool, found bool, err error) {
|
||||
func GetIgnoreConfiguredEndpoints(ctx context.Context, configs []any) (value bool, found bool, err error) {
|
||||
for _, cfg := range configs {
|
||||
if p, ok := cfg.(IgnoreConfiguredEndpointsProvider); ok {
|
||||
value, found, err = p.GetIgnoreConfiguredEndpoints(ctx)
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
// This should be used as the first resolver in the slice of resolvers when
|
||||
// resolving external configuration.
|
||||
func resolveDefaultAWSConfig(ctx context.Context, cfg *aws.Config, cfgs configs) error {
|
||||
var sources []interface{}
|
||||
var sources []any
|
||||
for _, s := range cfgs {
|
||||
sources = append(sources, s)
|
||||
}
|
||||
@@ -69,7 +69,7 @@ func resolveCustomCABundle(ctx context.Context, cfg *aws.Config, cfgs configs) e
|
||||
tr.TLSClientConfig.RootCAs = x509.NewCertPool()
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadAll(pemCerts)
|
||||
b, err := io.ReadAll(pemCerts)
|
||||
if err != nil {
|
||||
appendErr = fmt.Errorf("failed to read custom CA bundle PEM file")
|
||||
}
|
||||
@@ -106,9 +106,9 @@ func resolveRegion(ctx context.Context, cfg *aws.Config, configs configs) error
|
||||
}
|
||||
|
||||
func resolveBaseEndpoint(ctx context.Context, cfg *aws.Config, configs configs) error {
|
||||
var downcastCfgSources []interface{}
|
||||
var downcastCfgSources []any
|
||||
for _, cs := range configs {
|
||||
downcastCfgSources = append(downcastCfgSources, interface{}(cs))
|
||||
downcastCfgSources = append(downcastCfgSources, any(cs))
|
||||
}
|
||||
|
||||
if val, found, err := GetIgnoreConfiguredEndpoints(ctx, downcastCfgSources); found && val && err == nil {
|
||||
|
||||
+1
-2
@@ -3,7 +3,6 @@ package config
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -346,7 +345,7 @@ func resolveHTTPCredProvider(ctx context.Context, cfg *aws.Config, url, authToke
|
||||
options.AuthorizationTokenProvider = endpointcreds.TokenProviderFunc(func() (string, error) {
|
||||
var contents []byte
|
||||
var err error
|
||||
if contents, err = ioutil.ReadFile(authFilePath); err != nil {
|
||||
if contents, err = os.ReadFile(authFilePath); err != nil {
|
||||
return "", fmt.Errorf("failed to read authorization token from %v: %v", authFilePath, err)
|
||||
}
|
||||
return string(contents), nil
|
||||
|
||||
+1
-2
@@ -6,7 +6,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -502,7 +501,7 @@ func (c SharedConfig) getCustomCABundle(context.Context) (io.Reader, bool, error
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadFile(c.CustomCABundle)
|
||||
b, err := os.ReadFile(c.CustomCABundle)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
+22
@@ -1,3 +1,25 @@
|
||||
# v1.19.12 (2026-03-13)
|
||||
|
||||
* **Bug Fix**: Replace usages of the old ioutil/ package throughout the SDK.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.19.11 (2026-03-03)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.19.10 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.19.9 (2026-02-18)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.19.8 (2026-02-17)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.19.7 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package credentials
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.19.7"
|
||||
const goModuleVersion = "1.19.12"
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@@ -145,7 +144,7 @@ func getTokenFieldRFC3339(v interface{}, value **rfc3339) error {
|
||||
}
|
||||
|
||||
func loadCachedToken(filename string) (token, error) {
|
||||
fileBytes, err := ioutil.ReadFile(filename)
|
||||
fileBytes, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return token{}, fmt.Errorf("failed to read cached SSO token file, %w", err)
|
||||
}
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -3,7 +3,7 @@ package stscreds
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -80,7 +80,7 @@ type IdentityTokenFile string
|
||||
|
||||
// GetIdentityToken retrieves the JWT token from the file and returns the contents as a []byte
|
||||
func (j IdentityTokenFile) GetIdentityToken() ([]byte, error) {
|
||||
b, err := ioutil.ReadFile(string(j))
|
||||
b, err := os.ReadFile(string(j))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to read file at %s: %v", string(j), err)
|
||||
}
|
||||
|
||||
+15
@@ -1,3 +1,18 @@
|
||||
# v1.18.20 (2026-03-13)
|
||||
|
||||
* **Bug Fix**: Replace usages of the old ioutil/ package throughout the SDK.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.18.19 (2026-03-03)
|
||||
|
||||
* **Bug Fix**: Modernize non codegen files with go fix
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.18.18 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.18.17 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+2
-2
@@ -226,10 +226,10 @@ func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) {
|
||||
}
|
||||
|
||||
func (c *Client) invokeOperation(
|
||||
ctx context.Context, opID string, params interface{}, optFns []func(*Options),
|
||||
ctx context.Context, opID string, params any, optFns []func(*Options),
|
||||
stackFns ...func(*middleware.Stack, Options) error,
|
||||
) (
|
||||
result interface{}, metadata middleware.Metadata, err error,
|
||||
result any, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
stack := middleware.NewStack(opID, smithyhttp.NewStackRequest)
|
||||
options := c.options.Copy()
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ func addGetDynamicDataMiddleware(stack *middleware.Stack, options Options) error
|
||||
buildGetDynamicDataOutput)
|
||||
}
|
||||
|
||||
func buildGetDynamicDataPath(params interface{}) (string, error) {
|
||||
func buildGetDynamicDataPath(params any) (string, error) {
|
||||
p, ok := params.(*GetDynamicDataInput)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("unknown parameter type %T", params)
|
||||
@@ -70,7 +70,7 @@ func buildGetDynamicDataPath(params interface{}) (string, error) {
|
||||
return appendURIPath(getDynamicDataPath, p.Path), nil
|
||||
}
|
||||
|
||||
func buildGetDynamicDataOutput(resp *smithyhttp.Response) (interface{}, error) {
|
||||
func buildGetDynamicDataOutput(resp *smithyhttp.Response) (any, error) {
|
||||
return &GetDynamicDataOutput{
|
||||
Content: resp.Body,
|
||||
}, nil
|
||||
|
||||
+2
-2
@@ -59,11 +59,11 @@ func addGetIAMInfoMiddleware(stack *middleware.Stack, options Options) error {
|
||||
)
|
||||
}
|
||||
|
||||
func buildGetIAMInfoPath(params interface{}) (string, error) {
|
||||
func buildGetIAMInfoPath(params any) (string, error) {
|
||||
return getIAMInfoPath, nil
|
||||
}
|
||||
|
||||
func buildGetIAMInfoOutput(resp *smithyhttp.Response) (v interface{}, err error) {
|
||||
func buildGetIAMInfoOutput(resp *smithyhttp.Response) (v any, err error) {
|
||||
defer func() {
|
||||
closeErr := resp.Body.Close()
|
||||
if err == nil {
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -60,11 +60,11 @@ func addGetInstanceIdentityDocumentMiddleware(stack *middleware.Stack, options O
|
||||
)
|
||||
}
|
||||
|
||||
func buildGetInstanceIdentityDocumentPath(params interface{}) (string, error) {
|
||||
func buildGetInstanceIdentityDocumentPath(params any) (string, error) {
|
||||
return getInstanceIdentityDocumentPath, nil
|
||||
}
|
||||
|
||||
func buildGetInstanceIdentityDocumentOutput(resp *smithyhttp.Response) (v interface{}, err error) {
|
||||
func buildGetInstanceIdentityDocumentOutput(resp *smithyhttp.Response) (v any, err error) {
|
||||
defer func() {
|
||||
closeErr := resp.Body.Close()
|
||||
if err == nil {
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ func addGetMetadataMiddleware(stack *middleware.Stack, options Options) error {
|
||||
buildGetMetadataOutput)
|
||||
}
|
||||
|
||||
func buildGetMetadataPath(params interface{}) (string, error) {
|
||||
func buildGetMetadataPath(params any) (string, error) {
|
||||
p, ok := params.(*GetMetadataInput)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("unknown parameter type %T", params)
|
||||
@@ -70,7 +70,7 @@ func buildGetMetadataPath(params interface{}) (string, error) {
|
||||
return appendURIPath(getMetadataPath, p.Path), nil
|
||||
}
|
||||
|
||||
func buildGetMetadataOutput(resp *smithyhttp.Response) (interface{}, error) {
|
||||
func buildGetMetadataOutput(resp *smithyhttp.Response) (any, error) {
|
||||
return &GetMetadataOutput{
|
||||
Content: resp.Body,
|
||||
}, nil
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ func addGetRegionMiddleware(stack *middleware.Stack, options Options) error {
|
||||
)
|
||||
}
|
||||
|
||||
func buildGetRegionOutput(resp *smithyhttp.Response) (interface{}, error) {
|
||||
func buildGetRegionOutput(resp *smithyhttp.Response) (any, error) {
|
||||
out, err := buildGetInstanceIdentityDocumentOutput(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+2
-2
@@ -64,11 +64,11 @@ func addGetTokenMiddleware(stack *middleware.Stack, options Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildGetTokenPath(interface{}) (string, error) {
|
||||
func buildGetTokenPath(any) (string, error) {
|
||||
return getTokenPath, nil
|
||||
}
|
||||
|
||||
func buildGetTokenOutput(resp *smithyhttp.Response) (v interface{}, err error) {
|
||||
func buildGetTokenOutput(resp *smithyhttp.Response) (v any, err error) {
|
||||
defer func() {
|
||||
closeErr := resp.Body.Close()
|
||||
if err == nil {
|
||||
|
||||
+2
-2
@@ -50,11 +50,11 @@ func addGetUserDataMiddleware(stack *middleware.Stack, options Options) error {
|
||||
buildGetUserDataOutput)
|
||||
}
|
||||
|
||||
func buildGetUserDataPath(params interface{}) (string, error) {
|
||||
func buildGetUserDataPath(params any) (string, error) {
|
||||
return getUserDataPath, nil
|
||||
}
|
||||
|
||||
func buildGetUserDataOutput(resp *smithyhttp.Response) (interface{}, error) {
|
||||
func buildGetUserDataOutput(resp *smithyhttp.Response) (any, error) {
|
||||
return &GetUserDataOutput{
|
||||
Content: resp.Body,
|
||||
}, nil
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package imds
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.18.17"
|
||||
const goModuleVersion = "1.18.20"
|
||||
|
||||
+9
-9
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/url"
|
||||
"path"
|
||||
"time"
|
||||
@@ -18,8 +18,8 @@ import (
|
||||
func addAPIRequestMiddleware(stack *middleware.Stack,
|
||||
options Options,
|
||||
operation string,
|
||||
getPath func(interface{}) (string, error),
|
||||
getOutput func(*smithyhttp.Response) (interface{}, error),
|
||||
getPath func(any) (string, error),
|
||||
getOutput func(*smithyhttp.Response) (any, error),
|
||||
) (err error) {
|
||||
err = addRequestMiddleware(stack, options, "GET", operation, getPath, getOutput)
|
||||
if err != nil {
|
||||
@@ -46,8 +46,8 @@ func addRequestMiddleware(stack *middleware.Stack,
|
||||
options Options,
|
||||
method string,
|
||||
operation string,
|
||||
getPath func(interface{}) (string, error),
|
||||
getOutput func(*smithyhttp.Response) (interface{}, error),
|
||||
getPath func(any) (string, error),
|
||||
getOutput func(*smithyhttp.Response) (any, error),
|
||||
) (err error) {
|
||||
err = awsmiddleware.AddSDKAgentKey(awsmiddleware.FeatureMetadata, "ec2-imds")(stack)
|
||||
if err != nil {
|
||||
@@ -120,7 +120,7 @@ func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error {
|
||||
}
|
||||
|
||||
type serializeRequest struct {
|
||||
GetPath func(interface{}) (string, error)
|
||||
GetPath func(any) (string, error)
|
||||
Method string
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ func (m *serializeRequest) HandleSerialize(
|
||||
}
|
||||
|
||||
type deserializeResponse struct {
|
||||
GetOutput func(*smithyhttp.Response) (interface{}, error)
|
||||
GetOutput func(*smithyhttp.Response) (any, error)
|
||||
}
|
||||
|
||||
func (*deserializeResponse) ID() string {
|
||||
@@ -176,11 +176,11 @@ func (m *deserializeResponse) HandleDeserialize(
|
||||
|
||||
// read the full body so that any operation timeouts cleanup will not race
|
||||
// the body being read.
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("read response body failed, %w", err)
|
||||
}
|
||||
resp.Body = ioutil.NopCloser(bytes.NewReader(body))
|
||||
resp.Body = io.NopCloser(bytes.NewReader(body))
|
||||
|
||||
// Anything that's not 200 |< 300 is error
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
|
||||
+14
@@ -1,3 +1,17 @@
|
||||
# v1.4.20 (2026-03-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.4.19 (2026-03-03)
|
||||
|
||||
* **Bug Fix**: Modernize non codegen files with go fix
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.4.18 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.4.17 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ type EnableEndpointDiscoveryProvider interface {
|
||||
// ResolveEnableEndpointDiscovery extracts the first instance of a EnableEndpointDiscoveryProvider from the config slice.
|
||||
// Additionally returns a aws.EndpointDiscoveryEnableState to indicate if the value was found in provided configs,
|
||||
// and error if one is encountered.
|
||||
func ResolveEnableEndpointDiscovery(ctx context.Context, configs []interface{}) (value aws.EndpointDiscoveryEnableState, found bool, err error) {
|
||||
func ResolveEnableEndpointDiscovery(ctx context.Context, configs []any) (value aws.EndpointDiscoveryEnableState, found bool, err error) {
|
||||
for _, cfg := range configs {
|
||||
if p, ok := cfg.(EnableEndpointDiscoveryProvider); ok {
|
||||
value, found, err = p.GetEnableEndpointDiscovery(ctx)
|
||||
@@ -33,7 +33,7 @@ type UseDualStackEndpointProvider interface {
|
||||
|
||||
// ResolveUseDualStackEndpoint extracts the first instance of a UseDualStackEndpoint from the config slice.
|
||||
// Additionally returns a boolean to indicate if the value was found in provided configs, and error if one is encountered.
|
||||
func ResolveUseDualStackEndpoint(ctx context.Context, configs []interface{}) (value aws.DualStackEndpointState, found bool, err error) {
|
||||
func ResolveUseDualStackEndpoint(ctx context.Context, configs []any) (value aws.DualStackEndpointState, found bool, err error) {
|
||||
for _, cfg := range configs {
|
||||
if p, ok := cfg.(UseDualStackEndpointProvider); ok {
|
||||
value, found, err = p.GetUseDualStackEndpoint(ctx)
|
||||
@@ -52,7 +52,7 @@ type UseFIPSEndpointProvider interface {
|
||||
|
||||
// ResolveUseFIPSEndpoint extracts the first instance of a UseFIPSEndpointProvider from the config slice.
|
||||
// Additionally, returns a boolean to indicate if the value was found in provided configs, and error if one is encountered.
|
||||
func ResolveUseFIPSEndpoint(ctx context.Context, configs []interface{}) (value aws.FIPSEndpointState, found bool, err error) {
|
||||
func ResolveUseFIPSEndpoint(ctx context.Context, configs []any) (value aws.FIPSEndpointState, found bool, err error) {
|
||||
for _, cfg := range configs {
|
||||
if p, ok := cfg.(UseFIPSEndpointProvider); ok {
|
||||
value, found, err = p.GetUseFIPSEndpoint(ctx)
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ type IgnoreConfiguredEndpointsProvider interface {
|
||||
// Currently duplicated from github.com/aws/aws-sdk-go-v2/config because
|
||||
// service packages cannot import github.com/aws/aws-sdk-go-v2/config
|
||||
// due to result import cycle error.
|
||||
func GetIgnoreConfiguredEndpoints(ctx context.Context, configs []interface{}) (value bool, found bool, err error) {
|
||||
func GetIgnoreConfiguredEndpoints(ctx context.Context, configs []any) (value bool, found bool, err error) {
|
||||
for _, cfg := range configs {
|
||||
if p, ok := cfg.(IgnoreConfiguredEndpointsProvider); ok {
|
||||
value, found, err = p.GetIgnoreConfiguredEndpoints(ctx)
|
||||
@@ -40,7 +40,7 @@ func GetIgnoreConfiguredEndpoints(ctx context.Context, configs []interface{}) (v
|
||||
|
||||
// ResolveServiceBaseEndpoint is used to retrieve service endpoints from configured sources
|
||||
// while allowing for configured endpoints to be disabled
|
||||
func ResolveServiceBaseEndpoint(ctx context.Context, sdkID string, configs []interface{}) (value string, found bool, err error) {
|
||||
func ResolveServiceBaseEndpoint(ctx context.Context, sdkID string, configs []any) (value string, found bool, err error) {
|
||||
if val, found, _ := GetIgnoreConfiguredEndpoints(ctx, configs); found && val {
|
||||
return "", false, nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package configsources
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.4.17"
|
||||
const goModuleVersion = "1.4.20"
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -152,7 +152,7 @@
|
||||
"regionRegex" : "^eusc\\-(de)\\-\\w+\\-\\d+$",
|
||||
"regions" : {
|
||||
"eusc-de-east-1" : {
|
||||
"description" : "EU (Germany)"
|
||||
"description" : "AWS European Sovereign Cloud (Germany)"
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
||||
+14
@@ -1,3 +1,17 @@
|
||||
# v2.7.20 (2026-03-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v2.7.19 (2026-03-03)
|
||||
|
||||
* **Bug Fix**: Modernize non codegen files with go fix
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v2.7.18 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v2.7.17 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+3
-3
@@ -101,7 +101,7 @@ func (ps Partitions) ResolveEndpoint(region string, opts Options) (aws.Endpoint,
|
||||
region = opts.ResolvedRegion
|
||||
}
|
||||
|
||||
for i := 0; i < len(ps); i++ {
|
||||
for i := range ps {
|
||||
if !ps[i].canResolveEndpoint(region, opts) {
|
||||
continue
|
||||
}
|
||||
@@ -290,8 +290,8 @@ func getByPriority(s []string, p []string, def string) string {
|
||||
return def
|
||||
}
|
||||
|
||||
for i := 0; i < len(p); i++ {
|
||||
for j := 0; j < len(s); j++ {
|
||||
for i := range p {
|
||||
for j := range s {
|
||||
if s[j] == p[i] {
|
||||
return s[j]
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package endpoints
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "2.7.17"
|
||||
const goModuleVersion = "2.7.20"
|
||||
|
||||
+9
@@ -1,3 +1,12 @@
|
||||
# v1.8.6 (2026-03-13)
|
||||
|
||||
* **Bug Fix**: Replace usages of the old ioutil/ package throughout the SDK.
|
||||
|
||||
# v1.8.5 (2026-03-03)
|
||||
|
||||
* **Bug Fix**: Modernize non codegen files with go fix
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
|
||||
# v1.8.4 (2025-10-16)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.23.
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package ini
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.8.4"
|
||||
const goModuleVersion = "1.8.6"
|
||||
|
||||
Generated
Vendored
+12
@@ -1,3 +1,15 @@
|
||||
# v1.13.7 (2026-03-13)
|
||||
|
||||
* **Bug Fix**: Replace usages of the old ioutil/ package throughout the SDK.
|
||||
|
||||
# v1.13.6 (2026-03-03)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
|
||||
# v1.13.5 (2026-02-23)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.13.4 (2025-12-02)
|
||||
|
||||
* **Dependency Update**: Upgrade to smithy-go v1.24.0. Notably this version of the library reduces the allocation footprint of the middleware system. We observe a ~10% reduction in allocations per SDK call with this change.
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -3,4 +3,4 @@
|
||||
package acceptencoding
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.13.4"
|
||||
const goModuleVersion = "1.13.7"
|
||||
|
||||
+14
@@ -1,3 +1,17 @@
|
||||
# v1.13.20 (2026-03-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.13.19 (2026-03-03)
|
||||
|
||||
* **Bug Fix**: Modernize non codegen files with go fix
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.13.18 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.13.17 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
Generated
Vendored
+1
-1
@@ -3,4 +3,4 @@
|
||||
package presignedurl
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.13.17"
|
||||
const goModuleVersion = "1.13.20"
|
||||
|
||||
+6
-6
@@ -14,26 +14,26 @@ import (
|
||||
// presigned URL.
|
||||
type URLPresigner interface {
|
||||
// PresignURL presigns a URL.
|
||||
PresignURL(ctx context.Context, srcRegion string, params interface{}) (*v4.PresignedHTTPRequest, error)
|
||||
PresignURL(ctx context.Context, srcRegion string, params any) (*v4.PresignedHTTPRequest, error)
|
||||
}
|
||||
|
||||
// ParameterAccessor provides an collection of accessor to for retrieving and
|
||||
// setting the values needed to PresignedURL generation
|
||||
type ParameterAccessor struct {
|
||||
// GetPresignedURL accessor points to a function that retrieves a presigned url if present
|
||||
GetPresignedURL func(interface{}) (string, bool, error)
|
||||
GetPresignedURL func(any) (string, bool, error)
|
||||
|
||||
// GetSourceRegion accessor points to a function that retrieves source region for presigned url
|
||||
GetSourceRegion func(interface{}) (string, bool, error)
|
||||
GetSourceRegion func(any) (string, bool, error)
|
||||
|
||||
// CopyInput accessor points to a function that takes in an input, and returns a copy.
|
||||
CopyInput func(interface{}) (interface{}, error)
|
||||
CopyInput func(any) (any, error)
|
||||
|
||||
// SetDestinationRegion accessor points to a function that sets destination region on api input struct
|
||||
SetDestinationRegion func(interface{}, string) error
|
||||
SetDestinationRegion func(any, string) error
|
||||
|
||||
// SetPresignedURL accessor points to a function that sets presigned url on api input struct
|
||||
SetPresignedURL func(interface{}, string) error
|
||||
SetPresignedURL func(any, string) error
|
||||
}
|
||||
|
||||
// Options provides the set of options needed by the presigned URL middleware.
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
# v1.0.8 (2026-03-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.0.7 (2026-03-03)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.0.6 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.0.5 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@
|
||||
"internal/endpoints/endpoints.go",
|
||||
"internal/endpoints/endpoints_test.go",
|
||||
"options.go",
|
||||
"protocol_test.go",
|
||||
"serializers.go",
|
||||
"snapshot_test.go",
|
||||
"sra_operation_order_test.go",
|
||||
@@ -28,7 +27,7 @@
|
||||
"types/types.go",
|
||||
"validators.go"
|
||||
],
|
||||
"go": "1.23",
|
||||
"go": "1.24",
|
||||
"module": "github.com/aws/aws-sdk-go-v2/service/signin",
|
||||
"unstable": false
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package signin
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.0.5"
|
||||
const goModuleVersion = "1.0.8"
|
||||
|
||||
+1
-2
@@ -58,8 +58,7 @@ type Options struct {
|
||||
// the client option BaseEndpoint instead.
|
||||
EndpointResolver EndpointResolver
|
||||
|
||||
// Resolves the endpoint used for a particular service operation. This should be
|
||||
// used over the deprecated EndpointResolver.
|
||||
// Resolves the endpoint used for a particular service operation.
|
||||
EndpointResolverV2 EndpointResolverV2
|
||||
|
||||
// Signature Version 4 (SigV4) Signer
|
||||
|
||||
+17
@@ -1,3 +1,20 @@
|
||||
# v1.30.13 (2026-03-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.12 (2026-03-03)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.11 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.10 (2026-02-18)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.30.9 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+1
-2
@@ -22,7 +22,6 @@
|
||||
"internal/endpoints/endpoints.go",
|
||||
"internal/endpoints/endpoints_test.go",
|
||||
"options.go",
|
||||
"protocol_test.go",
|
||||
"serializers.go",
|
||||
"snapshot_test.go",
|
||||
"sra_operation_order_test.go",
|
||||
@@ -30,7 +29,7 @@
|
||||
"types/types.go",
|
||||
"validators.go"
|
||||
],
|
||||
"go": "1.23",
|
||||
"go": "1.24",
|
||||
"module": "github.com/aws/aws-sdk-go-v2/service/sso",
|
||||
"unstable": false
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package sso
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.30.9"
|
||||
const goModuleVersion = "1.30.13"
|
||||
|
||||
+3
@@ -240,6 +240,9 @@ var defaultPartitions = endpoints.Partitions{
|
||||
Region: "ap-southeast-5",
|
||||
},
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-6",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-7",
|
||||
}: endpoints.Endpoint{},
|
||||
|
||||
+1
-2
@@ -58,8 +58,7 @@ type Options struct {
|
||||
// the client option BaseEndpoint instead.
|
||||
EndpointResolver EndpointResolver
|
||||
|
||||
// Resolves the endpoint used for a particular service operation. This should be
|
||||
// used over the deprecated EndpointResolver.
|
||||
// Resolves the endpoint used for a particular service operation.
|
||||
EndpointResolverV2 EndpointResolverV2
|
||||
|
||||
// Signature Version 4 (SigV4) Signer
|
||||
|
||||
+17
@@ -1,3 +1,20 @@
|
||||
# v1.35.17 (2026-03-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.35.16 (2026-03-03)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.35.15 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.35.14 (2026-02-17)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.35.13 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+1
-2
@@ -22,7 +22,6 @@
|
||||
"internal/endpoints/endpoints.go",
|
||||
"internal/endpoints/endpoints_test.go",
|
||||
"options.go",
|
||||
"protocol_test.go",
|
||||
"serializers.go",
|
||||
"snapshot_test.go",
|
||||
"sra_operation_order_test.go",
|
||||
@@ -31,7 +30,7 @@
|
||||
"types/types.go",
|
||||
"validators.go"
|
||||
],
|
||||
"go": "1.23",
|
||||
"go": "1.24",
|
||||
"module": "github.com/aws/aws-sdk-go-v2/service/ssooidc",
|
||||
"unstable": false
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package ssooidc
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.35.13"
|
||||
const goModuleVersion = "1.35.17"
|
||||
|
||||
Generated
Vendored
+3
@@ -240,6 +240,9 @@ var defaultPartitions = endpoints.Partitions{
|
||||
Region: "ap-southeast-5",
|
||||
},
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-6",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-7",
|
||||
}: endpoints.Endpoint{},
|
||||
|
||||
+1
-2
@@ -58,8 +58,7 @@ type Options struct {
|
||||
// the client option BaseEndpoint instead.
|
||||
EndpointResolver EndpointResolver
|
||||
|
||||
// Resolves the endpoint used for a particular service operation. This should be
|
||||
// used over the deprecated EndpointResolver.
|
||||
// Resolves the endpoint used for a particular service operation.
|
||||
EndpointResolverV2 EndpointResolverV2
|
||||
|
||||
// Signature Version 4 (SigV4) Signer
|
||||
|
||||
+13
@@ -1,3 +1,16 @@
|
||||
# v1.41.9 (2026-03-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.41.8 (2026-03-03)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.24
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.41.7 (2026-02-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.41.6 (2026-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+1
-2
@@ -31,7 +31,6 @@
|
||||
"internal/endpoints/endpoints.go",
|
||||
"internal/endpoints/endpoints_test.go",
|
||||
"options.go",
|
||||
"protocol_test.go",
|
||||
"serializers.go",
|
||||
"snapshot_test.go",
|
||||
"sra_operation_order_test.go",
|
||||
@@ -39,7 +38,7 @@
|
||||
"types/types.go",
|
||||
"validators.go"
|
||||
],
|
||||
"go": "1.23",
|
||||
"go": "1.24",
|
||||
"module": "github.com/aws/aws-sdk-go-v2/service/sts",
|
||||
"unstable": false
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package sts
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.41.6"
|
||||
const goModuleVersion = "1.41.9"
|
||||
|
||||
+1
-2
@@ -58,8 +58,7 @@ type Options struct {
|
||||
// the client option BaseEndpoint instead.
|
||||
EndpointResolver EndpointResolver
|
||||
|
||||
// Resolves the endpoint used for a particular service operation. This should be
|
||||
// used over the deprecated EndpointResolver.
|
||||
// Resolves the endpoint used for a particular service operation.
|
||||
EndpointResolverV2 EndpointResolverV2
|
||||
|
||||
// Signature Version 4 (SigV4) Signer
|
||||
|
||||
+14
@@ -1,3 +1,17 @@
|
||||
# Release (2026-02-27)
|
||||
|
||||
## General Highlights
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# Release (2026-02-20)
|
||||
|
||||
## General Highlights
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
## Module Highlights
|
||||
* `github.com/aws/smithy-go`: v1.24.1
|
||||
* **Feature**: Add new middleware functions to get event stream output from middleware
|
||||
|
||||
# Release (2025-12-01)
|
||||
|
||||
## General Highlights
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
|
||||
[Smithy](https://smithy.io/) code generators for Go and the accompanying smithy-go runtime.
|
||||
|
||||
The smithy-go runtime requires a minimum version of Go 1.23.
|
||||
The smithy-go runtime requires a minimum version of Go 1.24.
|
||||
|
||||
**WARNING: All interfaces are subject to change.**
|
||||
|
||||
@@ -80,7 +80,7 @@ example created from `smithy init`:
|
||||
"service": "example.weather#Weather",
|
||||
"module": "github.com/example/weather",
|
||||
"generateGoMod": true,
|
||||
"goDirective": "1.23"
|
||||
"goDirective": "1.24"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@
|
||||
package smithy
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.24.0"
|
||||
const goModuleVersion = "1.24.2"
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package middleware
|
||||
|
||||
type eventStreamOutputKey struct{}
|
||||
|
||||
func AddEventStreamOutputToMetadata(metadata *Metadata, output any) {
|
||||
metadata.Set(eventStreamOutputKey{}, output)
|
||||
}
|
||||
|
||||
func GetEventStreamOutputToMetadata[T any](metadata *Metadata) (*T, bool) {
|
||||
val := metadata.Get(eventStreamOutputKey{})
|
||||
// not found
|
||||
if val == nil {
|
||||
return nil, false
|
||||
}
|
||||
// wrong type
|
||||
res, ok := val.(*T)
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
return res, true
|
||||
}
|
||||
+1
-1
@@ -24,7 +24,7 @@ var (
|
||||
Package = "github.com/containerd/containerd/v2"
|
||||
|
||||
// Version holds the complete version number. Filled in at linking time.
|
||||
Version = "2.2.1+unknown"
|
||||
Version = "2.2.2+unknown"
|
||||
|
||||
// Revision is filled with the VCS (e.g. git) revision being used to build
|
||||
// the program at linking time.
|
||||
|
||||
+51
-47
@@ -1,52 +1,56 @@
|
||||
version: "2"
|
||||
linters:
|
||||
enable:
|
||||
- staticcheck
|
||||
- unconvert
|
||||
- gofmt
|
||||
- goimports
|
||||
- revive
|
||||
- ineffassign
|
||||
- vet
|
||||
- unused
|
||||
- misspell
|
||||
- revive
|
||||
- unconvert
|
||||
disable:
|
||||
- errcheck
|
||||
|
||||
linters-settings:
|
||||
revive:
|
||||
ignore-generated-headers: true
|
||||
rules:
|
||||
- name: blank-imports
|
||||
- name: context-as-argument
|
||||
- name: context-keys-type
|
||||
- name: dot-imports
|
||||
- name: error-return
|
||||
- name: error-strings
|
||||
- name: error-naming
|
||||
- name: exported
|
||||
- name: if-return
|
||||
- name: increment-decrement
|
||||
- name: var-naming
|
||||
arguments: [["UID", "GID"], []]
|
||||
- name: var-declaration
|
||||
- name: package-comments
|
||||
- name: range
|
||||
- name: receiver-naming
|
||||
- name: time-naming
|
||||
- name: unexported-return
|
||||
- name: indent-error-flow
|
||||
- name: errorf
|
||||
- name: empty-block
|
||||
- name: superfluous-else
|
||||
- name: unused-parameter
|
||||
- name: unreachable-code
|
||||
- name: redefines-builtin-id
|
||||
|
||||
issues:
|
||||
include:
|
||||
- EXC0002
|
||||
|
||||
run:
|
||||
timeout: 8m
|
||||
skip-dirs:
|
||||
- example
|
||||
settings:
|
||||
revive:
|
||||
rules:
|
||||
- name: blank-imports
|
||||
- name: context-as-argument
|
||||
- name: context-keys-type
|
||||
- name: dot-imports
|
||||
- name: error-return
|
||||
- name: error-strings
|
||||
- name: error-naming
|
||||
- name: exported
|
||||
- name: if-return
|
||||
- name: increment-decrement
|
||||
- name: var-naming
|
||||
arguments:
|
||||
- - UID
|
||||
- GID
|
||||
- []
|
||||
- name: var-declaration
|
||||
- name: package-comments
|
||||
- name: range
|
||||
- name: receiver-naming
|
||||
- name: time-naming
|
||||
- name: unexported-return
|
||||
- name: indent-error-flow
|
||||
- name: errorf
|
||||
- name: empty-block
|
||||
- name: superfluous-else
|
||||
- name: unused-parameter
|
||||
- name: unreachable-code
|
||||
- name: redefines-builtin-id
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
paths:
|
||||
- example
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
- goimports
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- example
|
||||
|
||||
+5
-4
@@ -268,7 +268,8 @@ func (cs *clientStream) RecvMsg(m interface{}) error {
|
||||
case msg = <-cs.s.recv:
|
||||
}
|
||||
|
||||
if msg.header.Type == messageTypeResponse {
|
||||
switch msg.header.Type {
|
||||
case messageTypeResponse:
|
||||
resp := &Response{}
|
||||
err := proto.Unmarshal(msg.payload[:msg.header.Length], resp)
|
||||
// return the payload buffer for reuse
|
||||
@@ -289,7 +290,7 @@ func (cs *clientStream) RecvMsg(m interface{}) error {
|
||||
cs.remoteClosed = true
|
||||
|
||||
return nil
|
||||
} else if msg.header.Type == messageTypeData {
|
||||
case messageTypeData:
|
||||
if !cs.desc.StreamingServer {
|
||||
cs.c.deleteStream(cs.s)
|
||||
cs.remoteClosed = true
|
||||
@@ -310,9 +311,9 @@ func (cs *clientStream) RecvMsg(m interface{}) error {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("unexpected %q message received: %w", msg.header.Type, ErrProtocol)
|
||||
}
|
||||
|
||||
return fmt.Errorf("unexpected %q message received: %w", msg.header.Type, ErrProtocol)
|
||||
}
|
||||
|
||||
// Close closes the ttrpc connection and underlying connection
|
||||
|
||||
+4
-3
@@ -113,9 +113,7 @@ func (s *Server) Serve(ctx context.Context, l net.Listener) error {
|
||||
backoff *= 2
|
||||
}
|
||||
|
||||
if max := time.Second; backoff > max {
|
||||
backoff = max
|
||||
}
|
||||
backoff = min(time.Second, backoff)
|
||||
|
||||
sleep := time.Duration(rand.Int63n(int64(backoff)))
|
||||
log.G(ctx).WithError(err).Errorf("ttrpc: failed accept; backoff %v", sleep)
|
||||
@@ -415,6 +413,7 @@ func (c *serverConn) run(sctx context.Context) {
|
||||
if !sendStatus(mh.StreamID, status.Newf(codes.InvalidArgument, "StreamID is no longer active")) {
|
||||
return
|
||||
}
|
||||
continue
|
||||
}
|
||||
sh := i.(*streamHandler)
|
||||
if mh.Flags&flagNoData != flagNoData {
|
||||
@@ -428,6 +427,7 @@ func (c *serverConn) run(sctx context.Context) {
|
||||
if !sendStatus(mh.StreamID, status.Newf(codes.InvalidArgument, "data handling error: %v", err)) {
|
||||
return
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,6 +437,7 @@ func (c *serverConn) run(sctx context.Context) {
|
||||
if !sendStatus(mh.StreamID, status.Newf(codes.InvalidArgument, "data close message cannot include data")) {
|
||||
return
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
} else if mh.Type == messageTypeRequest {
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# Set default charset
|
||||
[*.{js,py,go,scala,rb,java,html,css,less,sass,md}]
|
||||
charset = utf-8
|
||||
|
||||
# Tab indentation (no size specified)
|
||||
[*.go]
|
||||
indent_style = tab
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
# Matches the exact files either package.json or .travis.yml
|
||||
[{package.json,.travis.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
+4
-3
@@ -1,5 +1,6 @@
|
||||
secrets.yml
|
||||
coverage.out
|
||||
coverage.txt
|
||||
*.out
|
||||
*.cov
|
||||
.idea
|
||||
.env
|
||||
.mcp.json
|
||||
.claude/
|
||||
|
||||
+14
-19
@@ -2,34 +2,19 @@ version: "2"
|
||||
linters:
|
||||
default: all
|
||||
disable:
|
||||
- cyclop
|
||||
- depguard
|
||||
- errchkjson
|
||||
- errorlint
|
||||
- exhaustruct
|
||||
- forcetypeassert
|
||||
- funlen
|
||||
- gochecknoglobals
|
||||
- gochecknoinits
|
||||
- gocognit
|
||||
- godot
|
||||
- godox
|
||||
- gosmopolitan
|
||||
- inamedparam
|
||||
- intrange
|
||||
- ireturn
|
||||
- lll
|
||||
- musttag
|
||||
- nestif
|
||||
- gomoddirectives
|
||||
- exhaustruct
|
||||
- nlreturn
|
||||
- noinlineerr
|
||||
- nonamedreturns
|
||||
- noinlineerr
|
||||
- paralleltest
|
||||
- recvcheck
|
||||
- testpackage
|
||||
- thelper
|
||||
- tparallel
|
||||
- unparam
|
||||
- varnamelen
|
||||
- whitespace
|
||||
- wrapcheck
|
||||
@@ -41,8 +26,17 @@ linters:
|
||||
goconst:
|
||||
min-len: 2
|
||||
min-occurrences: 3
|
||||
cyclop:
|
||||
max-complexity: 25
|
||||
gocyclo:
|
||||
min-complexity: 45
|
||||
min-complexity: 25
|
||||
gocognit:
|
||||
min-complexity: 35
|
||||
exhaustive:
|
||||
default-signifies-exhaustive: true
|
||||
default-case-required: true
|
||||
lll:
|
||||
line-length: 180
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
@@ -58,6 +52,7 @@ formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
- goimports
|
||||
- gofumpt
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
|
||||
+4
-2
@@ -23,7 +23,9 @@ include:
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
|
||||
advances
|
||||
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
@@ -55,7 +57,7 @@ further defined and clarified by project maintainers.
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ivan+abuse@flanders.co.nz. All
|
||||
reported by contacting the project team at <ivan+abuse@flanders.co.nz>. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
@@ -68,7 +70,7 @@ members of the project's leadership.
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
available at [<http://contributor-covenant.org/version/1/4>][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
# Contributors
|
||||
|
||||
- Repository: ['go-openapi/analysis']
|
||||
|
||||
| Total Contributors | Total Contributions |
|
||||
| --- | --- |
|
||||
| 15 | 202 |
|
||||
|
||||
| Username | All Time Contribution Count | All Commits |
|
||||
| --- | --- | --- |
|
||||
| @fredbi | 99 | <https://github.com/go-openapi/analysis/commits?author=fredbi> |
|
||||
| @casualjim | 70 | <https://github.com/go-openapi/analysis/commits?author=casualjim> |
|
||||
| @keramix | 9 | <https://github.com/go-openapi/analysis/commits?author=keramix> |
|
||||
| @youyuanwu | 8 | <https://github.com/go-openapi/analysis/commits?author=youyuanwu> |
|
||||
| @msample | 3 | <https://github.com/go-openapi/analysis/commits?author=msample> |
|
||||
| @kul-amr | 3 | <https://github.com/go-openapi/analysis/commits?author=kul-amr> |
|
||||
| @mbohlool | 2 | <https://github.com/go-openapi/analysis/commits?author=mbohlool> |
|
||||
| @Copilot | 1 | <https://github.com/go-openapi/analysis/commits?author=Copilot> |
|
||||
| @danielfbm | 1 | <https://github.com/go-openapi/analysis/commits?author=danielfbm> |
|
||||
| @gregmarr | 1 | <https://github.com/go-openapi/analysis/commits?author=gregmarr> |
|
||||
| @guillemj | 1 | <https://github.com/go-openapi/analysis/commits?author=guillemj> |
|
||||
| @knweiss | 1 | <https://github.com/go-openapi/analysis/commits?author=knweiss> |
|
||||
| @tklauser | 1 | <https://github.com/go-openapi/analysis/commits?author=tklauser> |
|
||||
| @cuishuang | 1 | <https://github.com/go-openapi/analysis/commits?author=cuishuang> |
|
||||
| @ujjwalsh | 1 | <https://github.com/go-openapi/analysis/commits?author=ujjwalsh> |
|
||||
|
||||
_this file was generated by the [Contributors GitHub Action](https://github.com/github/contributors)_
|
||||
+108
-8
@@ -1,22 +1,46 @@
|
||||
# OpenAPI analysis [](https://github.com/go-openapi/analysis/actions?query=workflow%3A"go+test") [](https://codecov.io/gh/go-openapi/analysis)
|
||||
# analysis
|
||||
|
||||
[](https://slackin.goswagger.io)
|
||||
[](https://raw.githubusercontent.com/go-openapi/analysis/master/LICENSE)
|
||||
[](https://pkg.go.dev/github.com/go-openapi/analysis)
|
||||
[](https://goreportcard.com/report/github.com/go-openapi/analysis)
|
||||
<!-- Badges: status -->
|
||||
[![Tests][test-badge]][test-url] [![Coverage][cov-badge]][cov-url] [![CI vuln scan][vuln-scan-badge]][vuln-scan-url] [![CodeQL][codeql-badge]][codeql-url]
|
||||
<!-- Badges: release & docker images -->
|
||||
<!-- Badges: code quality -->
|
||||
<!-- Badges: license & compliance -->
|
||||
[![Release][release-badge]][release-url] [![Go Report Card][gocard-badge]][gocard-url] [![CodeFactor Grade][codefactor-badge]][codefactor-url] [![License][license-badge]][license-url]
|
||||
<!-- Badges: documentation & support -->
|
||||
<!-- Badges: others & stats -->
|
||||
[![GoDoc][godoc-badge]][godoc-url] [![Discord Channel][discord-badge]][discord-url] [![go version][goversion-badge]][goversion-url] ![Top language][top-badge] ![Commits since latest release][commits-badge]
|
||||
|
||||
---
|
||||
|
||||
A foundational library to analyze an OAI specification document for easier reasoning about the content.
|
||||
|
||||
## What's inside?
|
||||
## Announcements
|
||||
|
||||
* **2025-12-19** : new community chat on discord
|
||||
* a new discord community channel is available to be notified of changes and support users
|
||||
* our venerable Slack channel remains open, and will be eventually discontinued on **2026-03-31**
|
||||
|
||||
You may join the discord community by clicking the invite link on the discord badge (also above). [![Discord Channel][discord-badge]][discord-url]
|
||||
|
||||
Or join our Slack channel: [![Slack Channel][slack-logo]![slack-badge]][slack-url]
|
||||
|
||||
## Status
|
||||
|
||||
API is stable.
|
||||
|
||||
## Import this library in your project
|
||||
|
||||
```cmd
|
||||
go get github.com/go-openapi/analysis
|
||||
```
|
||||
|
||||
## What's inside
|
||||
|
||||
* An analyzer providing methods to walk the functional content of a specification
|
||||
* A spec flattener producing a self-contained document bundle, while preserving `$ref`s
|
||||
* A spec merger ("mixin") to merge several spec documents into a primary spec
|
||||
* A spec "fixer" ensuring that response descriptions are non empty
|
||||
|
||||
[Documentation](https://pkg.go.dev/github.com/go-openapi/analysis)
|
||||
|
||||
## FAQ
|
||||
|
||||
* Does this library support OpenAPI 3?
|
||||
@@ -25,3 +49,79 @@ A foundational library to analyze an OAI specification document for easier reaso
|
||||
> This package currently only supports OpenAPI 2.0 (aka Swagger 2.0).
|
||||
> There is no plan to make it evolve toward supporting OpenAPI 3.x.
|
||||
> This [discussion thread](https://github.com/go-openapi/spec/issues/21) relates the full story.
|
||||
|
||||
## Change log
|
||||
|
||||
See <https://github.com/go-openapi/analysis/releases>
|
||||
|
||||
<!--
|
||||
|
||||
## References
|
||||
|
||||
-->
|
||||
|
||||
## Licensing
|
||||
|
||||
This library ships under the [SPDX-License-Identifier: Apache-2.0](./LICENSE).
|
||||
|
||||
<!--
|
||||
See the license NOTICE, which recalls the licensing terms of all the pieces of software
|
||||
on top of which it has been built.
|
||||
-->
|
||||
|
||||
<!--
|
||||
|
||||
## Limitations
|
||||
|
||||
-->
|
||||
|
||||
## Other documentation
|
||||
|
||||
* [All-time contributors](./CONTRIBUTORS.md)
|
||||
* [Contributing guidelines](.github/CONTRIBUTING.md)
|
||||
* [Maintainers documentation](docs/MAINTAINERS.md)
|
||||
* [Code style](docs/STYLE.md)
|
||||
|
||||
## Cutting a new release
|
||||
|
||||
Maintainers can cut a new release by either:
|
||||
|
||||
* running [this workflow](https://github.com/go-openapi/analysis/actions/workflows/bump-release.yml)
|
||||
* or pushing a semver tag
|
||||
* signed tags are preferred
|
||||
* The tag message is prepended to release notes
|
||||
|
||||
<!-- Badges: status -->
|
||||
[test-badge]: https://github.com/go-openapi/analysis/actions/workflows/go-test.yml/badge.svg
|
||||
[test-url]: https://github.com/go-openapi/analysis/actions/workflows/go-test.yml
|
||||
[cov-badge]: https://codecov.io/gh/go-openapi/analysis/branch/master/graph/badge.svg
|
||||
[cov-url]: https://codecov.io/gh/go-openapi/analysis
|
||||
[vuln-scan-badge]: https://github.com/go-openapi/analysis/actions/workflows/scanner.yml/badge.svg
|
||||
[vuln-scan-url]: https://github.com/go-openapi/analysis/actions/workflows/scanner.yml
|
||||
[codeql-badge]: https://github.com/go-openapi/analysis/actions/workflows/codeql.yml/badge.svg
|
||||
[codeql-url]: https://github.com/go-openapi/analysis/actions/workflows/codeql.yml
|
||||
<!-- Badges: release & docker images -->
|
||||
[release-badge]: https://badge.fury.io/gh/go-openapi%2Fanalysis.svg
|
||||
[release-url]: https://badge.fury.io/gh/go-openapi%2Fanalysis
|
||||
<!-- Badges: code quality -->
|
||||
[gocard-badge]: https://goreportcard.com/badge/github.com/go-openapi/analysis
|
||||
[gocard-url]: https://goreportcard.com/report/github.com/go-openapi/analysis
|
||||
[codefactor-badge]: https://img.shields.io/codefactor/grade/github/go-openapi/analysis
|
||||
[codefactor-url]: https://www.codefactor.io/repository/github/go-openapi/analysis
|
||||
<!-- Badges: documentation & support -->
|
||||
[godoc-badge]: https://pkg.go.dev/badge/github.com/go-openapi/analysis
|
||||
[godoc-url]: http://pkg.go.dev/github.com/go-openapi/analysis
|
||||
[slack-logo]: https://a.slack-edge.com/e6a93c1/img/icons/favicon-32.png
|
||||
[slack-badge]: https://img.shields.io/badge/slack-blue?link=https%3A%2F%2Fgoswagger.slack.com%2Farchives%2FC04R30YM
|
||||
[slack-url]: https://goswagger.slack.com/archives/C04R30YMU
|
||||
[discord-badge]: https://img.shields.io/discord/1446918742398341256?logo=discord&label=discord&color=blue
|
||||
[discord-url]: https://discord.gg/twZ9BwT3
|
||||
|
||||
<!-- Badges: license & compliance -->
|
||||
[license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg
|
||||
[license-url]: https://github.com/go-openapi/analysis/?tab=Apache-2.0-1-ov-file#readme
|
||||
<!-- Badges: others & stats -->
|
||||
[goversion-badge]: https://img.shields.io/github/go-mod/go-version/go-openapi/analysis
|
||||
[goversion-url]: https://github.com/go-openapi/analysis/blob/master/go.mod
|
||||
[top-badge]: https://img.shields.io/github/languages/top/go-openapi/analysis
|
||||
[commits-badge]: https://img.shields.io/github/commits-since/go-openapi/analysis/latest
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
# Security Policy
|
||||
|
||||
This policy outlines the commitment and practices of the go-openapi maintainers regarding security.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 0.x | :white_check_mark: |
|
||||
|
||||
## Vulnerability checks in place
|
||||
|
||||
This repository uses automated vulnerability scans, at every merged commit and at least once a week.
|
||||
|
||||
We use:
|
||||
|
||||
* [`GitHub CodeQL`][codeql-url]
|
||||
* [`trivy`][trivy-url]
|
||||
* [`govulncheck`][govulncheck-url]
|
||||
|
||||
Reports are centralized in github security reports and visible only to the maintainers.
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
If you become aware of a security vulnerability that affects the current repository,
|
||||
**please report it privately to the maintainers**
|
||||
rather than opening a publicly visible GitHub issue.
|
||||
|
||||
Please follow the instructions provided by github to [Privately report a security vulnerability][github-guidance-url].
|
||||
|
||||
> [!NOTE]
|
||||
> On Github, navigate to the project's "Security" tab then click on "Report a vulnerability".
|
||||
|
||||
[codeql-url]: https://github.com/github/codeql
|
||||
[trivy-url]: https://trivy.dev/docs/latest/getting-started
|
||||
[govulncheck-url]: https://go.dev/blog/govulncheck
|
||||
[github-guidance-url]: https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability
|
||||
+38
-38
@@ -164,13 +164,13 @@ func New(doc *spec.Swagger) *Spec {
|
||||
return a
|
||||
}
|
||||
|
||||
// SecurityRequirement is a representation of a security requirement for an operation
|
||||
// SecurityRequirement is a representation of a security requirement for an operation.
|
||||
type SecurityRequirement struct {
|
||||
Name string
|
||||
Scopes []string
|
||||
}
|
||||
|
||||
// SecurityRequirementsFor gets the security requirements for the operation
|
||||
// SecurityRequirementsFor gets the security requirements for the operation.
|
||||
func (s *Spec) SecurityRequirementsFor(operation *spec.Operation) [][]SecurityRequirement {
|
||||
if s.spec.Security == nil && operation.Security == nil {
|
||||
return nil
|
||||
@@ -204,7 +204,7 @@ func (s *Spec) SecurityRequirementsFor(operation *spec.Operation) [][]SecurityRe
|
||||
return result
|
||||
}
|
||||
|
||||
// SecurityDefinitionsForRequirements gets the matching security definitions for a set of requirements
|
||||
// SecurityDefinitionsForRequirements gets the matching security definitions for a set of requirements.
|
||||
func (s *Spec) SecurityDefinitionsForRequirements(requirements []SecurityRequirement) map[string]spec.SecurityScheme {
|
||||
result := make(map[string]spec.SecurityScheme)
|
||||
|
||||
@@ -219,7 +219,7 @@ func (s *Spec) SecurityDefinitionsForRequirements(requirements []SecurityRequire
|
||||
return result
|
||||
}
|
||||
|
||||
// SecurityDefinitionsFor gets the matching security definitions for a set of requirements
|
||||
// SecurityDefinitionsFor gets the matching security definitions for a set of requirements.
|
||||
func (s *Spec) SecurityDefinitionsFor(operation *spec.Operation) map[string]spec.SecurityScheme {
|
||||
requirements := s.SecurityRequirementsFor(operation)
|
||||
if len(requirements) == 0 {
|
||||
@@ -250,7 +250,7 @@ func (s *Spec) SecurityDefinitionsFor(operation *spec.Operation) map[string]spec
|
||||
return result
|
||||
}
|
||||
|
||||
// ConsumesFor gets the mediatypes for the operation
|
||||
// ConsumesFor gets the mediatypes for the operation.
|
||||
func (s *Spec) ConsumesFor(operation *spec.Operation) []string {
|
||||
if len(operation.Consumes) == 0 {
|
||||
cons := make(map[string]struct{}, len(s.spec.Consumes))
|
||||
@@ -269,7 +269,7 @@ func (s *Spec) ConsumesFor(operation *spec.Operation) []string {
|
||||
return s.structMapKeys(cons)
|
||||
}
|
||||
|
||||
// ProducesFor gets the mediatypes for the operation
|
||||
// ProducesFor gets the mediatypes for the operation.
|
||||
func (s *Spec) ProducesFor(operation *spec.Operation) []string {
|
||||
if len(operation.Produces) == 0 {
|
||||
prod := make(map[string]struct{}, len(s.spec.Produces))
|
||||
@@ -306,7 +306,7 @@ func fieldNameFromParam(param *spec.Parameter) string {
|
||||
// whenever an error is encountered while resolving references
|
||||
// on parameters.
|
||||
//
|
||||
// This function takes as input the spec.Parameter which triggered the
|
||||
// This function takes as input the [spec.Parameter] which triggered the
|
||||
// error and the error itself.
|
||||
//
|
||||
// If the callback function returns false, the calling function should bail.
|
||||
@@ -329,7 +329,7 @@ func (s *Spec) ParametersFor(operationID string) []spec.Parameter {
|
||||
// Does not assume parameters properly resolve references or that
|
||||
// such references actually resolve to a parameter object.
|
||||
//
|
||||
// Upon error, invoke a ErrorOnParamFunc callback with the erroneous
|
||||
// Upon error, invoke a [ErrorOnParamFunc] callback with the erroneous
|
||||
// parameters. If the callback is set to nil, panics upon errors.
|
||||
func (s *Spec) SafeParametersFor(operationID string, callmeOnError ErrorOnParamFunc) []spec.Parameter {
|
||||
gatherParams := func(pi *spec.PathItem, op *spec.Operation) []spec.Parameter {
|
||||
@@ -337,7 +337,7 @@ func (s *Spec) SafeParametersFor(operationID string, callmeOnError ErrorOnParamF
|
||||
s.paramsAsMap(pi.Parameters, bag, callmeOnError)
|
||||
s.paramsAsMap(op.Parameters, bag, callmeOnError)
|
||||
|
||||
var res []spec.Parameter
|
||||
res := make([]spec.Parameter, 0, len(bag))
|
||||
for _, v := range bag {
|
||||
res = append(res, v)
|
||||
}
|
||||
@@ -388,7 +388,7 @@ func (s *Spec) ParamsFor(method, path string) map[string]spec.Parameter {
|
||||
// Does not assume parameters properly resolve references or that
|
||||
// such references actually resolve to a parameter object.
|
||||
//
|
||||
// Upon error, invoke a ErrorOnParamFunc callback with the erroneous
|
||||
// Upon error, invoke a [ErrorOnParamFunc] callback with the erroneous
|
||||
// parameters. If the callback is set to nil, panics upon errors.
|
||||
func (s *Spec) SafeParamsFor(method, path string, callmeOnError ErrorOnParamFunc) map[string]spec.Parameter {
|
||||
res := make(map[string]spec.Parameter)
|
||||
@@ -400,7 +400,7 @@ func (s *Spec) SafeParamsFor(method, path string, callmeOnError ErrorOnParamFunc
|
||||
return res
|
||||
}
|
||||
|
||||
// OperationForName gets the operation for the given id
|
||||
// OperationForName gets the operation for the given id.
|
||||
func (s *Spec) OperationForName(operationID string) (string, string, *spec.Operation, bool) {
|
||||
for method, pathItem := range s.operations {
|
||||
for path, op := range pathItem {
|
||||
@@ -413,7 +413,7 @@ func (s *Spec) OperationForName(operationID string) (string, string, *spec.Opera
|
||||
return "", "", nil, false
|
||||
}
|
||||
|
||||
// OperationFor the given method and path
|
||||
// OperationFor the given method and path.
|
||||
func (s *Spec) OperationFor(method, path string) (*spec.Operation, bool) {
|
||||
if mp, ok := s.operations[strings.ToUpper(method)]; ok {
|
||||
op, fn := mp[path]
|
||||
@@ -424,12 +424,12 @@ func (s *Spec) OperationFor(method, path string) (*spec.Operation, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// Operations gathers all the operations specified in the spec document
|
||||
// Operations gathers all the operations specified in the spec document.
|
||||
func (s *Spec) Operations() map[string]map[string]*spec.Operation {
|
||||
return s.operations
|
||||
}
|
||||
|
||||
// AllPaths returns all the paths in the swagger spec
|
||||
// AllPaths returns all the paths in the swagger spec.
|
||||
func (s *Spec) AllPaths() map[string]spec.PathItem {
|
||||
if s.spec == nil || s.spec.Paths == nil {
|
||||
return nil
|
||||
@@ -438,7 +438,7 @@ func (s *Spec) AllPaths() map[string]spec.PathItem {
|
||||
return s.spec.Paths.Paths
|
||||
}
|
||||
|
||||
// OperationIDs gets all the operation ids based on method an dpath
|
||||
// OperationIDs gets all the operation ids based on method an dpath.
|
||||
func (s *Spec) OperationIDs() []string {
|
||||
if len(s.operations) == 0 {
|
||||
return nil
|
||||
@@ -458,7 +458,7 @@ func (s *Spec) OperationIDs() []string {
|
||||
return result
|
||||
}
|
||||
|
||||
// OperationMethodPaths gets all the operation ids based on method an dpath
|
||||
// OperationMethodPaths gets all the operation ids based on method an dpath.
|
||||
func (s *Spec) OperationMethodPaths() []string {
|
||||
if len(s.operations) == 0 {
|
||||
return nil
|
||||
@@ -474,22 +474,22 @@ func (s *Spec) OperationMethodPaths() []string {
|
||||
return result
|
||||
}
|
||||
|
||||
// RequiredConsumes gets all the distinct consumes that are specified in the specification document
|
||||
// RequiredConsumes gets all the distinct consumes that are specified in the specification document.
|
||||
func (s *Spec) RequiredConsumes() []string {
|
||||
return s.structMapKeys(s.consumes)
|
||||
}
|
||||
|
||||
// RequiredProduces gets all the distinct produces that are specified in the specification document
|
||||
// RequiredProduces gets all the distinct produces that are specified in the specification document.
|
||||
func (s *Spec) RequiredProduces() []string {
|
||||
return s.structMapKeys(s.produces)
|
||||
}
|
||||
|
||||
// RequiredSecuritySchemes gets all the distinct security schemes that are specified in the swagger spec
|
||||
// RequiredSecuritySchemes gets all the distinct security schemes that are specified in the swagger spec.
|
||||
func (s *Spec) RequiredSecuritySchemes() []string {
|
||||
return s.structMapKeys(s.authSchemes)
|
||||
}
|
||||
|
||||
// SchemaRef is a reference to a schema
|
||||
// SchemaRef is a reference to a schema.
|
||||
type SchemaRef struct {
|
||||
Name string
|
||||
Ref spec.Ref
|
||||
@@ -498,7 +498,7 @@ type SchemaRef struct {
|
||||
}
|
||||
|
||||
// SchemasWithAllOf returns schema references to all schemas that are defined
|
||||
// with an allOf key
|
||||
// with an allOf key.
|
||||
func (s *Spec) SchemasWithAllOf() (result []SchemaRef) {
|
||||
for _, v := range s.allOfs {
|
||||
result = append(result, v)
|
||||
@@ -507,7 +507,7 @@ func (s *Spec) SchemasWithAllOf() (result []SchemaRef) {
|
||||
return
|
||||
}
|
||||
|
||||
// AllDefinitions returns schema references for all the definitions that were discovered
|
||||
// AllDefinitions returns schema references for all the definitions that were discovered.
|
||||
func (s *Spec) AllDefinitions() (result []SchemaRef) {
|
||||
for _, v := range s.allSchemas {
|
||||
result = append(result, v)
|
||||
@@ -516,7 +516,7 @@ func (s *Spec) AllDefinitions() (result []SchemaRef) {
|
||||
return
|
||||
}
|
||||
|
||||
// AllDefinitionReferences returns json refs for all the discovered schemas
|
||||
// AllDefinitionReferences returns JSON references for all the discovered schemas.
|
||||
func (s *Spec) AllDefinitionReferences() (result []string) {
|
||||
for _, v := range s.references.schemas {
|
||||
result = append(result, v.String())
|
||||
@@ -525,7 +525,7 @@ func (s *Spec) AllDefinitionReferences() (result []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// AllParameterReferences returns json refs for all the discovered parameters
|
||||
// AllParameterReferences returns JSON references for all the discovered parameters.
|
||||
func (s *Spec) AllParameterReferences() (result []string) {
|
||||
for _, v := range s.references.parameters {
|
||||
result = append(result, v.String())
|
||||
@@ -534,7 +534,7 @@ func (s *Spec) AllParameterReferences() (result []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// AllResponseReferences returns json refs for all the discovered responses
|
||||
// AllResponseReferences returns JSON references for all the discovered responses.
|
||||
func (s *Spec) AllResponseReferences() (result []string) {
|
||||
for _, v := range s.references.responses {
|
||||
result = append(result, v.String())
|
||||
@@ -543,7 +543,7 @@ func (s *Spec) AllResponseReferences() (result []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// AllPathItemReferences returns the references for all the items
|
||||
// AllPathItemReferences returns the references for all the items.
|
||||
func (s *Spec) AllPathItemReferences() (result []string) {
|
||||
for _, v := range s.references.pathItems {
|
||||
result = append(result, v.String())
|
||||
@@ -564,7 +564,7 @@ func (s *Spec) AllItemsReferences() (result []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// AllReferences returns all the references found in the document, with possible duplicates
|
||||
// AllReferences returns all the references found in the document, with possible duplicates.
|
||||
func (s *Spec) AllReferences() (result []string) {
|
||||
for _, v := range s.references.allRefs {
|
||||
result = append(result, v.String())
|
||||
@@ -573,7 +573,7 @@ func (s *Spec) AllReferences() (result []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// AllRefs returns all the unique references found in the document
|
||||
// AllRefs returns all the unique references found in the document.
|
||||
func (s *Spec) AllRefs() (result []spec.Ref) {
|
||||
set := make(map[string]struct{})
|
||||
for _, v := range s.references.allRefs {
|
||||
@@ -592,61 +592,61 @@ func (s *Spec) AllRefs() (result []spec.Ref) {
|
||||
}
|
||||
|
||||
// ParameterPatterns returns all the patterns found in parameters
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) ParameterPatterns() map[string]string {
|
||||
return cloneStringMap(s.patterns.parameters)
|
||||
}
|
||||
|
||||
// HeaderPatterns returns all the patterns found in response headers
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) HeaderPatterns() map[string]string {
|
||||
return cloneStringMap(s.patterns.headers)
|
||||
}
|
||||
|
||||
// ItemsPatterns returns all the patterns found in simple array items
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) ItemsPatterns() map[string]string {
|
||||
return cloneStringMap(s.patterns.items)
|
||||
}
|
||||
|
||||
// SchemaPatterns returns all the patterns found in schemas
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) SchemaPatterns() map[string]string {
|
||||
return cloneStringMap(s.patterns.schemas)
|
||||
}
|
||||
|
||||
// AllPatterns returns all the patterns found in the spec
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) AllPatterns() map[string]string {
|
||||
return cloneStringMap(s.patterns.allPatterns)
|
||||
}
|
||||
|
||||
// ParameterEnums returns all the enums found in parameters
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) ParameterEnums() map[string][]any {
|
||||
return cloneEnumMap(s.enums.parameters)
|
||||
}
|
||||
|
||||
// HeaderEnums returns all the enums found in response headers
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) HeaderEnums() map[string][]any {
|
||||
return cloneEnumMap(s.enums.headers)
|
||||
}
|
||||
|
||||
// ItemsEnums returns all the enums found in simple array items
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) ItemsEnums() map[string][]any {
|
||||
return cloneEnumMap(s.enums.items)
|
||||
}
|
||||
|
||||
// SchemaEnums returns all the enums found in schemas
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) SchemaEnums() map[string][]any {
|
||||
return cloneEnumMap(s.enums.schemas)
|
||||
}
|
||||
|
||||
// AllEnums returns all the enums found in the spec
|
||||
// the map is cloned to avoid accidental changes
|
||||
// the map is cloned to avoid accidental changes.
|
||||
func (s *Spec) AllEnums() map[string][]any {
|
||||
return cloneEnumMap(s.enums.allEnums)
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,4 +9,4 @@ import (
|
||||
"github.com/go-openapi/analysis/internal/debug"
|
||||
)
|
||||
|
||||
var debugLog = debug.GetLogger("analysis", os.Getenv("SWAGGER_DEBUG") != "")
|
||||
var debugLog = debug.GetLogger("analysis", os.Getenv("SWAGGER_DEBUG") != "") //nolint:gochecknoglobals // it's okay to use a private global for logging
|
||||
|
||||
+27
-28
@@ -1,32 +1,31 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/*
|
||||
Package analysis provides methods to work with a Swagger specification document from
|
||||
package go-openapi/spec.
|
||||
|
||||
## Analyzing a specification
|
||||
|
||||
An analysed specification object (type Spec) provides methods to work with swagger definition.
|
||||
|
||||
## Flattening or expanding a specification
|
||||
|
||||
Flattening a specification bundles all remote $ref in the main spec document.
|
||||
Depending on flattening options, additional preprocessing may take place:
|
||||
- full flattening: replacing all inline complex constructs by a named entry in #/definitions
|
||||
- expand: replace all $ref's in the document by their expanded content
|
||||
|
||||
## Merging several specifications
|
||||
|
||||
Mixin several specifications merges all Swagger constructs, and warns about found conflicts.
|
||||
|
||||
## Fixing a specification
|
||||
|
||||
Unmarshalling a specification with golang json unmarshalling may lead to
|
||||
some unwanted result on present but empty fields.
|
||||
|
||||
## Analyzing a Swagger schema
|
||||
|
||||
Swagger schemas are analyzed to determine their complexity and qualify their content.
|
||||
*/
|
||||
// Package analysis provides methods to work with a Swagger specification document from
|
||||
// package go-openapi/spec.
|
||||
//
|
||||
// # Analyzing a specification
|
||||
//
|
||||
// An analysed specification object (type Spec) provides methods to work with swagger definition.
|
||||
//
|
||||
// # Flattening or expanding a specification
|
||||
//
|
||||
// Flattening a specification bundles all remote $ref in the main spec document.
|
||||
// Depending on flattening options, additional preprocessing may take place:
|
||||
//
|
||||
// - full flattening: replacing all inline complex constructs by a named entry in #/definitions
|
||||
// - expand: replace all $ref's in the document by their expanded content
|
||||
//
|
||||
// # Merging several specifications
|
||||
//
|
||||
// [Mixin] several specifications merges all Swagger constructs, and warns about found conflicts.
|
||||
//
|
||||
// # Fixing a specification
|
||||
//
|
||||
// Unmarshalling a specification with golang [json] unmarshalling may lead to
|
||||
// some unwanted result on present but empty fields.
|
||||
//
|
||||
// # Analyzing a Swagger schema
|
||||
//
|
||||
// Swagger schemas are analyzed to determine their complexity and qualify their content.
|
||||
package analysis
|
||||
|
||||
+47
-10
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
const definitionsPath = "#/definitions"
|
||||
|
||||
// newRef stores information about refs created during the flattening process
|
||||
// newRef stores information about refs created during the flattening process.
|
||||
type newRef struct {
|
||||
key string
|
||||
newName string
|
||||
@@ -32,7 +32,7 @@ type newRef struct {
|
||||
parents []string
|
||||
}
|
||||
|
||||
// context stores intermediary results from flatten
|
||||
// context stores intermediary results from flatten.
|
||||
type context struct {
|
||||
newRefs map[string]*newRef
|
||||
warnings []string
|
||||
@@ -52,13 +52,15 @@ func newContext() *context {
|
||||
// There is a minimal and a full flattening mode.
|
||||
//
|
||||
// Minimally flattening a spec means:
|
||||
//
|
||||
// - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left
|
||||
// unscathed)
|
||||
// - Importing external (http, file) references so they become internal to the document
|
||||
// - Importing external ([http], file) references so they become internal to the document
|
||||
// - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers
|
||||
// like "$ref": "#/definitions/myObject/allOfs/1")
|
||||
//
|
||||
// A minimally flattened spec thus guarantees the following properties:
|
||||
//
|
||||
// - all $refs point to a local definition (i.e. '#/definitions/...')
|
||||
// - definitions are unique
|
||||
//
|
||||
@@ -70,6 +72,7 @@ func newContext() *context {
|
||||
// Minimal flattening is necessary and sufficient for codegen rendering using go-swagger.
|
||||
//
|
||||
// Fully flattening a spec means:
|
||||
//
|
||||
// - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion.
|
||||
//
|
||||
// By complex, we mean every JSON object with some properties.
|
||||
@@ -80,6 +83,7 @@ func newContext() *context {
|
||||
// have been created.
|
||||
//
|
||||
// Available flattening options:
|
||||
//
|
||||
// - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched
|
||||
// - Expand: expand all $ref's in the document (inoperant if Minimal set to true)
|
||||
// - Verbose: croaks about name conflicts detected
|
||||
@@ -87,8 +91,9 @@ func newContext() *context {
|
||||
//
|
||||
// NOTE: expansion removes all $ref save circular $ref, which remain in place
|
||||
//
|
||||
// TODO: additional options
|
||||
// - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a
|
||||
// Desirable future additions: additional options.
|
||||
//
|
||||
// - PropagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a
|
||||
// x-go-name extension
|
||||
// - LiftAllOfs:
|
||||
// - limit the flattening of allOf members when simple objects
|
||||
@@ -169,7 +174,7 @@ func expand(opts *FlattenOpts) error {
|
||||
}
|
||||
|
||||
// normalizeRef strips the current file from any absolute file $ref. This works around issue go-openapi/spec#76:
|
||||
// leading absolute file in $ref is stripped
|
||||
// leading absolute file in $ref is stripped.
|
||||
func normalizeRef(opts *FlattenOpts) error {
|
||||
debugLog("normalizeRef")
|
||||
|
||||
@@ -491,14 +496,25 @@ func stripPointersAndOAIGen(opts *FlattenOpts) error {
|
||||
// pointer and name resolution again.
|
||||
func stripOAIGen(opts *FlattenOpts) (bool, error) {
|
||||
debugLog("stripOAIGen")
|
||||
// Ensure the spec analysis is fresh, as previous steps (namePointers, etc.) might have modified refs.
|
||||
opts.Spec.reload()
|
||||
|
||||
replacedWithComplex := false
|
||||
|
||||
// figure out referers of OAIGen definitions (doing it before the ref start mutating)
|
||||
for _, r := range opts.flattenContext.newRefs {
|
||||
// Sort keys to ensure deterministic processing order
|
||||
sortedKeys := make([]string, 0, len(opts.flattenContext.newRefs))
|
||||
for k := range opts.flattenContext.newRefs {
|
||||
sortedKeys = append(sortedKeys, k)
|
||||
}
|
||||
sort.Strings(sortedKeys)
|
||||
|
||||
for _, k := range sortedKeys {
|
||||
r := opts.flattenContext.newRefs[k]
|
||||
updateRefParents(opts.Spec.references.allRefs, r)
|
||||
}
|
||||
|
||||
for k := range opts.flattenContext.newRefs {
|
||||
for _, k := range sortedKeys {
|
||||
r := opts.flattenContext.newRefs[k]
|
||||
debugLog("newRefs[%s]: isOAIGen: %t, resolved: %t, name: %s, path:%s, #parents: %d, parents: %v, ref: %s",
|
||||
k, r.isOAIGen, r.resolved, r.newName, r.path, len(r.parents), r.parents, r.schema.Ref.String())
|
||||
@@ -521,7 +537,7 @@ func stripOAIGen(opts *FlattenOpts) (bool, error) {
|
||||
return replacedWithComplex, nil
|
||||
}
|
||||
|
||||
// updateRefParents updates all parents of an updated $ref
|
||||
// updateRefParents updates all parents of an updated $ref.
|
||||
func updateRefParents(allRefs map[string]spec.Ref, r *newRef) {
|
||||
if !r.isOAIGen || r.resolved { // bail on already resolved entries (avoid looping)
|
||||
return
|
||||
@@ -580,6 +596,19 @@ func stripOAIGenForRef(opts *FlattenOpts, k string, r *newRef) (bool, error) {
|
||||
replacedWithComplex = true
|
||||
}
|
||||
}
|
||||
|
||||
// update parents of the target ref (pr[0]) if it is also a newRef (OAIGen)
|
||||
// This ensures that if the target is later deleted/merged, it knows about these new referers.
|
||||
for _, nr := range opts.flattenContext.newRefs {
|
||||
if nr.path == pr[0] && nr.isOAIGen && !nr.resolved {
|
||||
for _, p := range pr[1:] {
|
||||
if !slices.Contains(nr.parents, p) {
|
||||
nr.parents = append(nr.parents, p)
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove OAIGen definition
|
||||
@@ -587,7 +616,15 @@ func stripOAIGenForRef(opts *FlattenOpts, k string, r *newRef) (bool, error) {
|
||||
delete(opts.Swagger().Definitions, path.Base(r.path))
|
||||
|
||||
// propagate changes in ref index for keys which have this one as a parent
|
||||
for kk, value := range opts.flattenContext.newRefs {
|
||||
// Sort keys to ensure deterministic update order
|
||||
propagateKeys := make([]string, 0, len(opts.flattenContext.newRefs))
|
||||
for k := range opts.flattenContext.newRefs {
|
||||
propagateKeys = append(propagateKeys, k)
|
||||
}
|
||||
sort.Strings(propagateKeys)
|
||||
|
||||
for _, kk := range propagateKeys {
|
||||
value := opts.flattenContext.newRefs[kk]
|
||||
if kk == k || !value.isOAIGen || value.resolved {
|
||||
continue
|
||||
}
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ import (
|
||||
"github.com/go-openapi/swag/mangling"
|
||||
)
|
||||
|
||||
// InlineSchemaNamer finds a new name for an inlined type
|
||||
// InlineSchemaNamer finds a new name for an inlined type.
|
||||
type InlineSchemaNamer struct {
|
||||
Spec *spec.Swagger
|
||||
Operations map[string]operations.OpRef
|
||||
@@ -25,7 +25,7 @@ type InlineSchemaNamer struct {
|
||||
opts *FlattenOpts
|
||||
}
|
||||
|
||||
// Name yields a new name for the inline schema
|
||||
// Name yields a new name for the inline schema.
|
||||
func (isn *InlineSchemaNamer) Name(key string, schema *spec.Schema, aschema *AnalyzedSchema) error {
|
||||
debugLog("naming inlined schema at %s", key)
|
||||
|
||||
@@ -108,7 +108,7 @@ func (isn *InlineSchemaNamer) Name(key string, schema *spec.Schema, aschema *Ana
|
||||
return nil
|
||||
}
|
||||
|
||||
// uniqifyName yields a unique name for a definition
|
||||
// uniqifyName yields a unique name for a definition.
|
||||
func uniqifyName(definitions spec.Definitions, name string) (string, bool) {
|
||||
isOAIGen := false
|
||||
if name == "" {
|
||||
@@ -244,7 +244,7 @@ func namesForDefinition(parts sortref.SplitKey) ([][]string, int) {
|
||||
return [][]string{}, 0
|
||||
}
|
||||
|
||||
// partAdder knows how to interpret a schema when it comes to build a name from parts
|
||||
// partAdder knows how to interpret a schema when it comes to build a name from parts.
|
||||
func partAdder(aschema *AnalyzedSchema) sortref.PartAdder {
|
||||
return func(part string) []string {
|
||||
segments := make([]string, 0, minSegments)
|
||||
|
||||
+3
-3
@@ -35,7 +35,7 @@ type FlattenOpts struct {
|
||||
_ struct{} // require keys
|
||||
}
|
||||
|
||||
// ExpandOpts creates a spec.ExpandOptions to configure expanding a specification document.
|
||||
// ExpandOpts creates a spec.[spec.ExpandOptions] to configure expanding a specification document.
|
||||
func (f *FlattenOpts) ExpandOpts(skipSchemas bool) *spec.ExpandOptions {
|
||||
return &spec.ExpandOptions{
|
||||
RelativeBase: f.BasePath,
|
||||
@@ -44,13 +44,13 @@ func (f *FlattenOpts) ExpandOpts(skipSchemas bool) *spec.ExpandOptions {
|
||||
}
|
||||
}
|
||||
|
||||
// Swagger gets the swagger specification for this flatten operation
|
||||
// Swagger gets the swagger specification for this flatten operation.
|
||||
func (f *FlattenOpts) Swagger() *spec.Swagger {
|
||||
return f.Spec.spec
|
||||
}
|
||||
|
||||
// croak logs notifications and warnings about valid, but possibly unwanted constructs resulting
|
||||
// from flattening a spec
|
||||
// from flattening a spec.
|
||||
func (f *FlattenOpts) croak() {
|
||||
if !f.Verbose {
|
||||
return
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
go 1.24.0
|
||||
|
||||
use (
|
||||
.
|
||||
./internal/testintegration
|
||||
)
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30 h1:BHT1/DKsYDGkUgQ2jmMaozVcdk+sVfz0+1ZJq4zkWgw=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
||||
go.mongodb.org/mongo-driver v1.17.6 h1:87JUG1wZfWsr6rIz3ZmpH90rL5tea7O3IHuSwHUpsss=
|
||||
go.mongodb.org/mongo-driver v1.17.6/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
||||
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
|
||||
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
|
||||
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
|
||||
golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc=
|
||||
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
|
||||
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
|
||||
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
|
||||
golang.org/x/term v0.40.0 h1:36e4zGLqU4yhjlmxEaagx2KuYbJq3EwY8K943ZsHcvg=
|
||||
golang.org/x/term v0.40.0/go.mod h1:w2P8uVp06p2iyKKuvXIm7N/y0UCRt3UfJTfZ7oOpglM=
|
||||
golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
|
||||
golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc=
|
||||
golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg=
|
||||
+2
-4
@@ -11,11 +11,9 @@ import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
output = os.Stdout
|
||||
)
|
||||
var output = os.Stdout //nolint:gochecknoglobals // this is on purpose to be overridable during tests
|
||||
|
||||
// GetLogger provides a prefix debug logger
|
||||
// GetLogger provides a prefix debug logger.
|
||||
func GetLogger(prefix string, debug bool) func(string, ...any) {
|
||||
if debug {
|
||||
logger := log.New(output, prefix+":", log.LstdFlags)
|
||||
|
||||
+6
-4
@@ -17,8 +17,9 @@ import (
|
||||
// NOTE: does not support JSONschema ID for $ref (we assume we are working with swagger specs here).
|
||||
//
|
||||
// NOTE(windows):
|
||||
// * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec)
|
||||
// * "/ in paths may appear as escape sequences
|
||||
//
|
||||
// - refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec)
|
||||
// - "/ in paths may appear as escape sequences.
|
||||
func RebaseRef(baseRef string, ref string) string {
|
||||
baseRef, _ = url.PathUnescape(baseRef)
|
||||
ref, _ = url.PathUnescape(ref)
|
||||
@@ -69,8 +70,9 @@ func RebaseRef(baseRef string, ref string) string {
|
||||
// Path renders absolute path on remote file refs
|
||||
//
|
||||
// NOTE(windows):
|
||||
// * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec)
|
||||
// * "/ in paths may appear as escape sequences
|
||||
//
|
||||
// - refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec)
|
||||
// - "/ in paths may appear as escape sequences.
|
||||
func Path(ref spec.Ref, basePath string) string {
|
||||
uri, _ := url.PathUnescape(ref.String())
|
||||
if ref.HasFragmentOnly || filepath.IsAbs(uri) {
|
||||
|
||||
+6
-6
@@ -14,12 +14,12 @@ import (
|
||||
"github.com/go-openapi/swag/mangling"
|
||||
)
|
||||
|
||||
// AllOpRefsByRef returns an index of sortable operations
|
||||
// AllOpRefsByRef returns an index of sortable operations.
|
||||
func AllOpRefsByRef(specDoc Provider, operationIDs []string) map[string]OpRef {
|
||||
return OpRefsByRef(GatherOperations(specDoc, operationIDs))
|
||||
}
|
||||
|
||||
// OpRefsByRef indexes a map of sortable operations
|
||||
// OpRefsByRef indexes a map of sortable operations.
|
||||
func OpRefsByRef(oprefs map[string]OpRef) map[string]OpRef {
|
||||
result := make(map[string]OpRef, len(oprefs))
|
||||
for _, v := range oprefs {
|
||||
@@ -29,7 +29,7 @@ func OpRefsByRef(oprefs map[string]OpRef) map[string]OpRef {
|
||||
return result
|
||||
}
|
||||
|
||||
// OpRef is an indexable, sortable operation
|
||||
// OpRef is an indexable, sortable operation.
|
||||
type OpRef struct {
|
||||
Method string
|
||||
Path string
|
||||
@@ -39,19 +39,19 @@ type OpRef struct {
|
||||
Ref spec.Ref
|
||||
}
|
||||
|
||||
// OpRefs is a sortable collection of operations
|
||||
// OpRefs is a sortable collection of operations.
|
||||
type OpRefs []OpRef
|
||||
|
||||
func (o OpRefs) Len() int { return len(o) }
|
||||
func (o OpRefs) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
|
||||
func (o OpRefs) Less(i, j int) bool { return o[i].Key < o[j].Key }
|
||||
|
||||
// Provider knows how to collect operations from a spec
|
||||
// Provider knows how to collect operations from a spec.
|
||||
type Provider interface {
|
||||
Operations() map[string]map[string]*spec.Operation
|
||||
}
|
||||
|
||||
// GatherOperations builds a map of sorted operations from a spec
|
||||
// GatherOperations builds a map of sorted operations from a spec.
|
||||
func GatherOperations(specDoc Provider, operationIDs []string) map[string]OpRef {
|
||||
var oprefs OpRefs
|
||||
mangler := mangling.NewNameMangler()
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ func ErrCyclicChain(key string) error {
|
||||
}
|
||||
|
||||
func ErrInvalidPointerType(key string, value any, err error) error {
|
||||
return fmt.Errorf("invalid type for resolved JSON pointer %s. Expected a schema a, got: %T (%v): %w",
|
||||
return fmt.Errorf("invalid type for resolved JSON pointer %s. Expected a schema a, got: %T (%w): %w",
|
||||
key, value, err, ErrReplace,
|
||||
)
|
||||
}
|
||||
|
||||
+29
-14
@@ -22,9 +22,10 @@ const (
|
||||
allocMediumMap = 64
|
||||
)
|
||||
|
||||
//nolint:gochecknoglobals // it's okay to use a private global for logging
|
||||
var debugLog = debug.GetLogger("analysis/flatten/replace", os.Getenv("SWAGGER_DEBUG") != "")
|
||||
|
||||
// RewriteSchemaToRef replaces a schema with a Ref
|
||||
// RewriteSchemaToRef replaces a schema with a Ref.
|
||||
func RewriteSchemaToRef(sp *spec.Swagger, key string, ref spec.Ref) error {
|
||||
debugLog("rewriting schema to ref for %s with %s", key, ref.String())
|
||||
_, value, err := getPointerFromKey(sp, key)
|
||||
@@ -142,7 +143,7 @@ func rewriteParentRef(sp *spec.Swagger, key string, ref spec.Ref) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// getPointerFromKey retrieves the content of the JSON pointer "key"
|
||||
// getPointerFromKey retrieves the content of the JSON pointer "key".
|
||||
func getPointerFromKey(sp any, key string) (string, any, error) {
|
||||
switch sp.(type) {
|
||||
case *spec.Schema:
|
||||
@@ -154,7 +155,10 @@ func getPointerFromKey(sp any, key string) (string, any, error) {
|
||||
return "", sp, nil
|
||||
}
|
||||
// unescape chars in key, e.g. "{}" from path params
|
||||
pth, _ := url.PathUnescape(key[1:])
|
||||
pth, err := url.PathUnescape(key[1:])
|
||||
if err != nil {
|
||||
return "", nil, errors.Join(err, ErrReplace)
|
||||
}
|
||||
ptr, err := jsonpointer.New(pth)
|
||||
if err != nil {
|
||||
return "", nil, errors.Join(err, ErrReplace)
|
||||
@@ -170,7 +174,7 @@ func getPointerFromKey(sp any, key string) (string, any, error) {
|
||||
return pth, value, nil
|
||||
}
|
||||
|
||||
// getParentFromKey retrieves the container of the JSON pointer "key"
|
||||
// getParentFromKey retrieves the container of the JSON pointer "key".
|
||||
func getParentFromKey(sp any, key string) (string, string, any, error) {
|
||||
switch sp.(type) {
|
||||
case *spec.Schema:
|
||||
@@ -196,7 +200,7 @@ func getParentFromKey(sp any, key string) (string, string, any, error) {
|
||||
return parent, entry, pvalue, nil
|
||||
}
|
||||
|
||||
// UpdateRef replaces a ref by another one
|
||||
// UpdateRef replaces a ref by another one.
|
||||
func UpdateRef(sp any, key string, ref spec.Ref) error {
|
||||
switch sp.(type) {
|
||||
case *spec.Schema:
|
||||
@@ -265,7 +269,7 @@ func UpdateRef(sp any, key string, ref spec.Ref) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateRefWithSchema replaces a ref with a schema (i.e. re-inline schema)
|
||||
// UpdateRefWithSchema replaces a ref with a schema (i.e. re-inline schema).
|
||||
func UpdateRefWithSchema(sp *spec.Swagger, key string, sch *spec.Schema) error {
|
||||
debugLog("updating ref for %s with schema", key)
|
||||
pth, value, err := getPointerFromKey(sp, key)
|
||||
@@ -324,7 +328,7 @@ func UpdateRefWithSchema(sp *spec.Swagger, key string, sch *spec.Schema) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepestRefResult holds the results from DeepestRef analysis
|
||||
// DeepestRefResult holds the results from [DeepestRef] analysis.
|
||||
type DeepestRefResult struct {
|
||||
Ref spec.Ref
|
||||
Schema *spec.Schema
|
||||
@@ -332,10 +336,13 @@ type DeepestRefResult struct {
|
||||
}
|
||||
|
||||
// DeepestRef finds the first definition ref, from a cascade of nested refs which are not definitions.
|
||||
//
|
||||
// - if no definition is found, returns the deepest ref.
|
||||
// - pointers to external files are expanded
|
||||
//
|
||||
// NOTE: all external $ref's are assumed to be already expanded at this stage.
|
||||
//
|
||||
//nolint:gocognit,gocyclo,cyclop // definitely needs a refactoring, in a follow-up PR
|
||||
func DeepestRef(sp *spec.Swagger, opts *spec.ExpandOptions, ref spec.Ref) (*DeepestRefResult, error) {
|
||||
if !ref.HasFragmentOnly {
|
||||
// we found an external $ref, which is odd at this stage:
|
||||
@@ -392,11 +399,13 @@ DOWNREF:
|
||||
case spec.Response:
|
||||
// a pointer points to a schema initially marshalled in responses section...
|
||||
// Attempt to convert this to a schema. If this fails, the spec is invalid
|
||||
asJSON, _ := refable.MarshalJSON()
|
||||
asJSON, err := refable.MarshalJSON()
|
||||
if err != nil {
|
||||
return nil, ErrInvalidPointerType(currentRef.String(), value, err)
|
||||
}
|
||||
var asSchema spec.Schema
|
||||
|
||||
err := asSchema.UnmarshalJSON(asJSON)
|
||||
if err != nil {
|
||||
if err = asSchema.UnmarshalJSON(asJSON); err != nil {
|
||||
return nil, ErrInvalidPointerType(currentRef.String(), value, err)
|
||||
}
|
||||
warnings = append(warnings, fmt.Sprintf("found $ref %q (response) interpreted as schema", currentRef.String()))
|
||||
@@ -409,9 +418,12 @@ DOWNREF:
|
||||
case spec.Parameter:
|
||||
// a pointer points to a schema initially marshalled in parameters section...
|
||||
// Attempt to convert this to a schema. If this fails, the spec is invalid
|
||||
asJSON, _ := refable.MarshalJSON()
|
||||
asJSON, err := refable.MarshalJSON()
|
||||
if err != nil {
|
||||
return nil, ErrInvalidPointerType(currentRef.String(), value, err)
|
||||
}
|
||||
var asSchema spec.Schema
|
||||
if err := asSchema.UnmarshalJSON(asJSON); err != nil {
|
||||
if err = asSchema.UnmarshalJSON(asJSON); err != nil {
|
||||
return nil, ErrInvalidPointerType(currentRef.String(), value, err)
|
||||
}
|
||||
|
||||
@@ -428,9 +440,12 @@ DOWNREF:
|
||||
break DOWNREF
|
||||
}
|
||||
|
||||
asJSON, _ := json.Marshal(refable)
|
||||
asJSON, err := json.Marshal(refable)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidPointerType(currentRef.String(), value, err)
|
||||
}
|
||||
var asSchema spec.Schema
|
||||
if err := asSchema.UnmarshalJSON(asJSON); err != nil {
|
||||
if err = asSchema.UnmarshalJSON(asJSON); err != nil {
|
||||
return nil, ErrInvalidPointerType(currentRef.String(), value, err)
|
||||
}
|
||||
warnings = append(warnings, fmt.Sprintf("found $ref %q (%T) interpreted as schema", currentRef.String(), refable))
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
const allocLargeMap = 150
|
||||
|
||||
// Save registers a schema as an entry in spec #/definitions
|
||||
// Save registers a schema as an entry in spec #/definitions.
|
||||
func Save(sp *spec.Swagger, name string, schema *spec.Schema) {
|
||||
if schema == nil {
|
||||
return
|
||||
@@ -25,7 +25,7 @@ func Save(sp *spec.Swagger, name string, schema *spec.Schema) {
|
||||
sp.Definitions[name] = *schema
|
||||
}
|
||||
|
||||
// Clone deep-clones a schema
|
||||
// Clone deep-clones a schema.
|
||||
func Clone(schema *spec.Schema) *spec.Schema {
|
||||
var sch spec.Schema
|
||||
_ = jsonutils.FromDynamicJSON(schema, &sch)
|
||||
|
||||
+20
-24
@@ -20,12 +20,8 @@ const (
|
||||
definitions = "definitions"
|
||||
)
|
||||
|
||||
//nolint:gochecknoglobals // it's okay to store small indexes like this as private globals
|
||||
var (
|
||||
ignoredKeys map[string]struct{}
|
||||
validMethods map[string]struct{}
|
||||
)
|
||||
|
||||
func init() {
|
||||
ignoredKeys = map[string]struct{}{
|
||||
"schema": {},
|
||||
"properties": {},
|
||||
@@ -43,15 +39,15 @@ func init() {
|
||||
"PUT": {},
|
||||
"DELETE": {},
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// Key represent a key item constructed from /-separated segments
|
||||
// Key represent a key item constructed from /-separated segments.
|
||||
type Key struct {
|
||||
Segments int
|
||||
Key string
|
||||
}
|
||||
|
||||
// Keys is a sortable collable collection of Keys
|
||||
// Keys is a sortable collable collection of Keys.
|
||||
type Keys []Key
|
||||
|
||||
func (k Keys) Len() int { return len(k) }
|
||||
@@ -60,7 +56,7 @@ func (k Keys) Less(i, j int) bool {
|
||||
return k[i].Segments > k[j].Segments || (k[i].Segments == k[j].Segments && k[i].Key < k[j].Key)
|
||||
}
|
||||
|
||||
// KeyParts construct a SplitKey with all its /-separated segments decomposed. It is sortable.
|
||||
// KeyParts construct a [SplitKey] with all its /-separated segments decomposed. It is sortable.
|
||||
func KeyParts(key string) SplitKey {
|
||||
var res []string
|
||||
for part := range strings.SplitSeq(key[1:], "/") {
|
||||
@@ -75,12 +71,12 @@ func KeyParts(key string) SplitKey {
|
||||
// SplitKey holds of the parts of a /-separated key, so that their location may be determined.
|
||||
type SplitKey []string
|
||||
|
||||
// IsDefinition is true when the split key is in the #/definitions section of a spec
|
||||
// IsDefinition is true when the split key is in the #/definitions section of a spec.
|
||||
func (s SplitKey) IsDefinition() bool {
|
||||
return len(s) > 1 && s[0] == definitions
|
||||
}
|
||||
|
||||
// DefinitionName yields the name of the definition
|
||||
// DefinitionName yields the name of the definition.
|
||||
func (s SplitKey) DefinitionName() string {
|
||||
if !s.IsDefinition() {
|
||||
return ""
|
||||
@@ -89,10 +85,10 @@ func (s SplitKey) DefinitionName() string {
|
||||
return s[1]
|
||||
}
|
||||
|
||||
// PartAdder know how to construct the components of a new name
|
||||
// PartAdder know how to construct the components of a new name.
|
||||
type PartAdder func(string) []string
|
||||
|
||||
// BuildName builds a name from segments
|
||||
// BuildName builds a name from segments.
|
||||
func (s SplitKey) BuildName(segments []string, startIndex int, adder PartAdder) string {
|
||||
for i, part := range s[startIndex:] {
|
||||
if _, ignored := ignoredKeys[part]; !ignored || s.isKeyName(startIndex+i) {
|
||||
@@ -103,42 +99,42 @@ func (s SplitKey) BuildName(segments []string, startIndex int, adder PartAdder)
|
||||
return strings.Join(segments, " ")
|
||||
}
|
||||
|
||||
// IsOperation is true when the split key is in the operations section
|
||||
// IsOperation is true when the split key is in the operations section.
|
||||
func (s SplitKey) IsOperation() bool {
|
||||
return len(s) > 1 && s[0] == paths
|
||||
}
|
||||
|
||||
// IsSharedOperationParam is true when the split key is in the parameters section of a path
|
||||
// IsSharedOperationParam is true when the split key is in the parameters section of a path.
|
||||
func (s SplitKey) IsSharedOperationParam() bool {
|
||||
return len(s) > 2 && s[0] == paths && s[2] == parameters
|
||||
}
|
||||
|
||||
// IsSharedParam is true when the split key is in the #/parameters section of a spec
|
||||
// IsSharedParam is true when the split key is in the #/parameters section of a spec.
|
||||
func (s SplitKey) IsSharedParam() bool {
|
||||
return len(s) > 1 && s[0] == parameters
|
||||
}
|
||||
|
||||
// IsOperationParam is true when the split key is in the parameters section of an operation
|
||||
// IsOperationParam is true when the split key is in the parameters section of an operation.
|
||||
func (s SplitKey) IsOperationParam() bool {
|
||||
return len(s) > 3 && s[0] == paths && s[3] == parameters
|
||||
}
|
||||
|
||||
// IsOperationResponse is true when the split key is in the responses section of an operation
|
||||
// IsOperationResponse is true when the split key is in the responses section of an operation.
|
||||
func (s SplitKey) IsOperationResponse() bool {
|
||||
return len(s) > 3 && s[0] == paths && s[3] == responses
|
||||
}
|
||||
|
||||
// IsSharedResponse is true when the split key is in the #/responses section of a spec
|
||||
// IsSharedResponse is true when the split key is in the #/responses section of a spec.
|
||||
func (s SplitKey) IsSharedResponse() bool {
|
||||
return len(s) > 1 && s[0] == responses
|
||||
}
|
||||
|
||||
// IsDefaultResponse is true when the split key is the default response for an operation
|
||||
// IsDefaultResponse is true when the split key is the default response for an operation.
|
||||
func (s SplitKey) IsDefaultResponse() bool {
|
||||
return len(s) > 4 && s[0] == paths && s[3] == responses && s[4] == "default"
|
||||
}
|
||||
|
||||
// IsStatusCodeResponse is true when the split key is an operation response with a status code
|
||||
// IsStatusCodeResponse is true when the split key is an operation response with a status code.
|
||||
func (s SplitKey) IsStatusCodeResponse() bool {
|
||||
isInt := func() bool {
|
||||
_, err := strconv.Atoi(s[4])
|
||||
@@ -149,7 +145,7 @@ func (s SplitKey) IsStatusCodeResponse() bool {
|
||||
return len(s) > 4 && s[0] == paths && s[3] == responses && isInt()
|
||||
}
|
||||
|
||||
// ResponseName yields either the status code or "Default" for a response
|
||||
// ResponseName yields either the status code or "Default" for a response.
|
||||
func (s SplitKey) ResponseName() string {
|
||||
if s.IsStatusCodeResponse() {
|
||||
code, _ := strconv.Atoi(s[4])
|
||||
@@ -164,7 +160,7 @@ func (s SplitKey) ResponseName() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// PathItemRef constructs a $ref object from a split key of the form /{path}/{method}
|
||||
// PathItemRef constructs a $ref object from a split key of the form /{path}/{method}.
|
||||
func (s SplitKey) PathItemRef() spec.Ref {
|
||||
const minValidPathItems = 3
|
||||
if len(s) < minValidPathItems {
|
||||
@@ -179,7 +175,7 @@ func (s SplitKey) PathItemRef() spec.Ref {
|
||||
return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(pth), strings.ToUpper(method)))
|
||||
}
|
||||
|
||||
// PathRef constructs a $ref object from a split key of the form /paths/{reference}
|
||||
// PathRef constructs a $ref object from a split key of the form /paths/{reference}.
|
||||
func (s SplitKey) PathRef() spec.Ref {
|
||||
if !s.IsOperation() {
|
||||
return spec.Ref{}
|
||||
|
||||
+13
-9
@@ -4,7 +4,9 @@
|
||||
package sortref
|
||||
|
||||
import (
|
||||
"iter"
|
||||
"reflect"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -12,10 +14,6 @@ import (
|
||||
"github.com/go-openapi/spec"
|
||||
)
|
||||
|
||||
var depthGroupOrder = []string{
|
||||
"sharedParam", "sharedResponse", "sharedOpParam", "opParam", "codeResponse", "defaultResponse", "definition",
|
||||
}
|
||||
|
||||
type mapIterator struct {
|
||||
len int
|
||||
mapIter *reflect.MapIter
|
||||
@@ -42,7 +40,7 @@ func mustMapIterator(anyMap any) *mapIterator {
|
||||
// DepthFirst sorts a map of anything. It groups keys by category
|
||||
// (shared params, op param, statuscode response, default response, definitions)
|
||||
// sort groups internally by number of parts in the key and lexical names
|
||||
// flatten groups into a single list of keys
|
||||
// flatten groups into a single list of keys.
|
||||
func DepthFirst(in any) []string {
|
||||
iterator := mustMapIterator(in)
|
||||
sorted := make([]string, 0, iterator.Len())
|
||||
@@ -77,7 +75,7 @@ func DepthFirst(in any) []string {
|
||||
grouped[pk] = append(grouped[pk], Key{Segments: len(split), Key: k})
|
||||
}
|
||||
|
||||
for _, pk := range depthGroupOrder {
|
||||
for pk := range depthGroupOrder() {
|
||||
res := grouped[pk]
|
||||
sort.Sort(res)
|
||||
|
||||
@@ -89,6 +87,12 @@ func DepthFirst(in any) []string {
|
||||
return sorted
|
||||
}
|
||||
|
||||
func depthGroupOrder() iter.Seq[string] {
|
||||
return slices.Values([]string{
|
||||
"sharedParam", "sharedResponse", "sharedOpParam", "opParam", "codeResponse", "defaultResponse", "definition",
|
||||
})
|
||||
}
|
||||
|
||||
// topMostRefs is able to sort refs by hierarchical then lexicographic order,
|
||||
// yielding refs ordered breadth-first.
|
||||
type topmostRefs []string
|
||||
@@ -104,7 +108,7 @@ func (k topmostRefs) Less(i, j int) bool {
|
||||
return li < lj
|
||||
}
|
||||
|
||||
// TopmostFirst sorts references by depth
|
||||
// TopmostFirst sorts references by depth.
|
||||
func TopmostFirst(refs []string) []string {
|
||||
res := topmostRefs(refs)
|
||||
sort.Sort(res)
|
||||
@@ -112,13 +116,13 @@ func TopmostFirst(refs []string) []string {
|
||||
return res
|
||||
}
|
||||
|
||||
// RefRevIdx is a reverse index for references
|
||||
// RefRevIdx is a reverse index for references.
|
||||
type RefRevIdx struct {
|
||||
Ref spec.Ref
|
||||
Keys []string
|
||||
}
|
||||
|
||||
// ReverseIndex builds a reverse index for references in schemas
|
||||
// ReverseIndex builds a reverse index for references in schemas.
|
||||
func ReverseIndex(schemas map[string]spec.Ref, basePath string) map[string]RefRevIdx {
|
||||
collected := make(map[string]RefRevIdx)
|
||||
for key, schRef := range schemas {
|
||||
|
||||
+3
-2
@@ -18,12 +18,13 @@ import (
|
||||
// needed.
|
||||
//
|
||||
// The following parts of primary are subject to merge, filling empty details
|
||||
//
|
||||
// - Info
|
||||
// - BasePath
|
||||
// - Host
|
||||
// - ExternalDocs
|
||||
//
|
||||
// Consider calling FixEmptyResponseDescriptions() on the modified primary
|
||||
// Consider calling [FixEmptyResponseDescriptions]() on the modified primary
|
||||
// if you read them from storage and they are valid to start with.
|
||||
//
|
||||
// Entries in "paths", "definitions", "parameters" and "responses" are
|
||||
@@ -39,7 +40,7 @@ import (
|
||||
// etc). Ensure they are canonical if your downstream tools do
|
||||
// key normalization of any form.
|
||||
//
|
||||
// Merging schemes (http, https), and consumers/producers do not account for
|
||||
// Merging schemes ([http], https), and consumers/producers do not account for
|
||||
// collisions.
|
||||
func Mixin(primary *spec.Swagger, mixins ...*spec.Swagger) []string {
|
||||
skipped := make([]string, 0, len(mixins))
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// SchemaOpts configures the schema analyzer
|
||||
// SchemaOpts configures the schema analyzer.
|
||||
type SchemaOpts struct {
|
||||
Schema *spec.Schema
|
||||
Root any
|
||||
@@ -52,7 +52,7 @@ func Schema(opts SchemaOpts) (*AnalyzedSchema, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// AnalyzedSchema indicates what the schema represents
|
||||
// AnalyzedSchema indicates what the schema represents.
|
||||
type AnalyzedSchema struct {
|
||||
schema *spec.Schema
|
||||
root any
|
||||
@@ -78,7 +78,7 @@ type AnalyzedSchema struct {
|
||||
IsEnum bool
|
||||
}
|
||||
|
||||
// Inherits copies value fields from other onto this schema
|
||||
// Inherits copies value fields from other onto this schema.
|
||||
func (a *AnalyzedSchema) inherits(other *AnalyzedSchema) {
|
||||
if other == nil {
|
||||
return
|
||||
|
||||
-181
@@ -1,181 +0,0 @@
|
||||
# git-cliff ~ configuration file
|
||||
# https://git-cliff.org/docs/configuration
|
||||
|
||||
[changelog]
|
||||
header = """
|
||||
"""
|
||||
|
||||
footer = """
|
||||
|
||||
-----
|
||||
|
||||
**[{{ remote.github.repo }}]({{ self::remote_url() }}) license terms**
|
||||
|
||||
[![License][license-badge]][license-url]
|
||||
|
||||
[license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg
|
||||
[license-url]: {{ self::remote_url() }}/?tab=Apache-2.0-1-ov-file#readme
|
||||
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
"""
|
||||
|
||||
body = """
|
||||
{%- if version %}
|
||||
## [{{ version | trim_start_matches(pat="v") }}]({{ self::remote_url() }}/tree/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
{%- else %}
|
||||
## [unreleased]
|
||||
{%- endif %}
|
||||
{%- if message %}
|
||||
{%- raw %}\n{% endraw %}
|
||||
{{ message }}
|
||||
{%- raw %}\n{% endraw %}
|
||||
{%- endif %}
|
||||
{%- if version %}
|
||||
{%- if previous.version %}
|
||||
|
||||
**Full Changelog**: <{{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}>
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
{%- raw %}\n{% endraw %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if statistics %}{% if statistics.commit_count %}
|
||||
{%- raw %}\n{% endraw %}
|
||||
{{ statistics.commit_count }} commits in this release.
|
||||
{%- raw %}\n{% endraw %}
|
||||
{%- endif %}{% endif %}
|
||||
-----
|
||||
|
||||
{%- for group, commits in commits | group_by(attribute="group") %}
|
||||
{%- raw %}\n{% endraw %}
|
||||
### {{ group | upper_first }}
|
||||
{%- raw %}\n{% endraw %}
|
||||
{%- for commit in commits %}
|
||||
{%- if commit.remote.pr_title %}
|
||||
{%- set commit_message = commit.remote.pr_title %}
|
||||
{%- else %}
|
||||
{%- set commit_message = commit.message %}
|
||||
{%- endif %}
|
||||
* {{ commit_message | split(pat="\n") | first | trim }}
|
||||
{%- if commit.remote.username %}
|
||||
{%- raw %} {% endraw %}by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }})
|
||||
{%- endif %}
|
||||
{%- if commit.remote.pr_number %}
|
||||
{%- raw %} {% endraw %}in [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }})
|
||||
{%- endif %}
|
||||
{%- raw %} {% endraw %}[...]({{ self::remote_url() }}/commit/{{ commit.id }})
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
|
||||
{%- if github %}
|
||||
{%- raw %}\n{% endraw -%}
|
||||
{%- set all_contributors = github.contributors | length %}
|
||||
{%- if github.contributors | filter(attribute="username", value="dependabot[bot]") | length < all_contributors %}
|
||||
-----
|
||||
|
||||
### People who contributed to this release
|
||||
{% endif %}
|
||||
{%- for contributor in github.contributors | filter(attribute="username") | sort(attribute="username") %}
|
||||
{%- if contributor.username != "dependabot[bot]" and contributor.username != "github-actions[bot]" %}
|
||||
* [@{{ contributor.username }}](https://github.com/{{ contributor.username }})
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
|
||||
-----
|
||||
{%- raw %}\n{% endraw %}
|
||||
|
||||
### New Contributors
|
||||
{%- endif %}
|
||||
|
||||
{%- for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
|
||||
{%- if contributor.username != "dependabot[bot]" and contributor.username != "github-actions[bot]" %}
|
||||
* @{{ contributor.username }} made their first contribution
|
||||
{%- if contributor.pr_number %}
|
||||
in [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
|
||||
{%- raw %}\n{% endraw %}
|
||||
|
||||
{%- macro remote_url() -%}
|
||||
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
||||
{%- endmacro -%}
|
||||
"""
|
||||
# Remove leading and trailing whitespaces from the changelog's body.
|
||||
trim = true
|
||||
# Render body even when there are no releases to process.
|
||||
render_always = true
|
||||
# An array of regex based postprocessors to modify the changelog.
|
||||
postprocessors = [
|
||||
# Replace the placeholder <REPO> with a URL.
|
||||
#{ pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" },
|
||||
]
|
||||
# output file path
|
||||
# output = "test.md"
|
||||
|
||||
[git]
|
||||
# Parse commits according to the conventional commits specification.
|
||||
# See https://www.conventionalcommits.org
|
||||
conventional_commits = false
|
||||
# Exclude commits that do not match the conventional commits specification.
|
||||
filter_unconventional = false
|
||||
# Require all commits to be conventional.
|
||||
# Takes precedence over filter_unconventional.
|
||||
require_conventional = false
|
||||
# Split commits on newlines, treating each line as an individual commit.
|
||||
split_commits = false
|
||||
# An array of regex based parsers to modify commit messages prior to further processing.
|
||||
commit_preprocessors = [
|
||||
# Replace issue numbers with link templates to be updated in `changelog.postprocessors`.
|
||||
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
|
||||
# Check spelling of the commit message using https://github.com/crate-ci/typos.
|
||||
# If the spelling is incorrect, it will be fixed automatically.
|
||||
#{ pattern = '.*', replace_command = 'typos --write-changes -' }
|
||||
]
|
||||
# Prevent commits that are breaking from being excluded by commit parsers.
|
||||
protect_breaking_commits = false
|
||||
# An array of regex based parsers for extracting data from the commit message.
|
||||
# Assigns commits to groups.
|
||||
# Optionally sets the commit's scope and can decide to exclude commits from further processing.
|
||||
commit_parsers = [
|
||||
{ message = "^[Cc]hore\\([Rr]elease\\): prepare for", skip = true },
|
||||
{ message = "(^[Mm]erge)|([Mm]erge conflict)", skip = true },
|
||||
{ field = "author.name", pattern = "dependabot*", group = "<!-- 0A -->Updates" },
|
||||
{ message = "([Ss]ecurity)|([Vv]uln)", group = "<!-- 08 -->Security" },
|
||||
{ body = "(.*[Ss]ecurity)|([Vv]uln)", group = "<!-- 08 -->Security" },
|
||||
{ message = "([Cc]hore\\(lint\\))|(style)|(lint)|(codeql)|(golangci)", group = "<!-- 05 -->Code quality" },
|
||||
{ message = "(^[Dd]oc)|((?i)readme)|(badge)|(typo)|(documentation)", group = "<!-- 03 -->Documentation" },
|
||||
{ message = "(^[Ff]eat)|(^[Ee]nhancement)", group = "<!-- 00 -->Implemented enhancements" },
|
||||
{ message = "(^ci)|(\\(ci\\))|(fixup\\s+ci)|(fix\\s+ci)|(license)|(example)", group = "<!-- 07 -->Miscellaneous tasks" },
|
||||
{ message = "^test", group = "<!-- 06 -->Testing" },
|
||||
{ message = "(^fix)|(panic)", group = "<!-- 01 -->Fixed bugs" },
|
||||
{ message = "(^refact)|(rework)", group = "<!-- 02 -->Refactor" },
|
||||
{ message = "(^[Pp]erf)|(performance)", group = "<!-- 04 -->Performance" },
|
||||
{ message = "(^[Cc]hore)", group = "<!-- 07 -->Miscellaneous tasks" },
|
||||
{ message = "^[Rr]evert", group = "<!-- 09 -->Reverted changes" },
|
||||
{ message = "(upgrade.*?go)|(go\\s+version)", group = "<!-- 0A -->Updates" },
|
||||
{ message = ".*", group = "<!-- 0B -->Other" },
|
||||
]
|
||||
# Exclude commits that are not matched by any commit parser.
|
||||
filter_commits = false
|
||||
# An array of link parsers for extracting external references, and turning them into URLs, using regex.
|
||||
link_parsers = []
|
||||
# Include only the tags that belong to the current branch.
|
||||
use_branch_tags = false
|
||||
# Order releases topologically instead of chronologically.
|
||||
topo_order = false
|
||||
# Order releases topologically instead of chronologically.
|
||||
topo_order_commits = true
|
||||
# Order of commits in each group/release within the changelog.
|
||||
# Allowed values: newest, oldest
|
||||
sort_commits = "newest"
|
||||
# Process submodules commits
|
||||
recurse_submodules = false
|
||||
|
||||
#[remote.github]
|
||||
#owner = "go-openapi"
|
||||
+5
-1
@@ -1,3 +1,7 @@
|
||||
secrets.yml
|
||||
*.out
|
||||
*.cov
|
||||
.idea
|
||||
.env
|
||||
.mcp.json
|
||||
.claude/
|
||||
settings.local.json
|
||||
|
||||
+5
@@ -12,6 +12,7 @@ linters:
|
||||
- paralleltest
|
||||
- recvcheck
|
||||
- testpackage
|
||||
- thelper
|
||||
- tparallel
|
||||
- varnamelen
|
||||
- whitespace
|
||||
@@ -40,6 +41,10 @@ linters:
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
rules:
|
||||
- linters:
|
||||
- revive
|
||||
text: "avoid package names that conflict with Go standard library package names"
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
|
||||
+4
-2
@@ -23,7 +23,9 @@ include:
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
|
||||
advances
|
||||
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
@@ -55,7 +57,7 @@ further defined and clarified by project maintainers.
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ivan+abuse@flanders.co.nz. All
|
||||
reported by contacting the project team at <ivan+abuse@flanders.co.nz>. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
@@ -68,7 +70,7 @@ members of the project's leadership.
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
available at [<http://contributor-covenant.org/version/1/4>][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
|
||||
+14
-13
@@ -4,21 +4,22 @@
|
||||
|
||||
| Total Contributors | Total Contributions |
|
||||
| --- | --- |
|
||||
| 12 | 105 |
|
||||
| 13 | 110 |
|
||||
|
||||
| Username | All Time Contribution Count | All Commits |
|
||||
| --- | --- | --- |
|
||||
| @casualjim | 58 | https://github.com/go-openapi/errors/commits?author=casualjim |
|
||||
| @fredbi | 32 | https://github.com/go-openapi/errors/commits?author=fredbi |
|
||||
| @youyuanwu | 5 | https://github.com/go-openapi/errors/commits?author=youyuanwu |
|
||||
| @alexandear | 2 | https://github.com/go-openapi/errors/commits?author=alexandear |
|
||||
| @fiorix | 1 | https://github.com/go-openapi/errors/commits?author=fiorix |
|
||||
| @ligustah | 1 | https://github.com/go-openapi/errors/commits?author=ligustah |
|
||||
| @artemseleznev | 1 | https://github.com/go-openapi/errors/commits?author=artemseleznev |
|
||||
| @gautierdelorme | 1 | https://github.com/go-openapi/errors/commits?author=gautierdelorme |
|
||||
| @guillemj | 1 | https://github.com/go-openapi/errors/commits?author=guillemj |
|
||||
| @maxatome | 1 | https://github.com/go-openapi/errors/commits?author=maxatome |
|
||||
| @Simon-Li | 1 | https://github.com/go-openapi/errors/commits?author=Simon-Li |
|
||||
| @ujjwalsh | 1 | https://github.com/go-openapi/errors/commits?author=ujjwalsh |
|
||||
| @casualjim | 58 | <https://github.com/go-openapi/errors/commits?author=casualjim> |
|
||||
| @fredbi | 36 | <https://github.com/go-openapi/errors/commits?author=fredbi> |
|
||||
| @youyuanwu | 5 | <https://github.com/go-openapi/errors/commits?author=youyuanwu> |
|
||||
| @alexandear | 2 | <https://github.com/go-openapi/errors/commits?author=alexandear> |
|
||||
| @fiorix | 1 | <https://github.com/go-openapi/errors/commits?author=fiorix> |
|
||||
| @ligustah | 1 | <https://github.com/go-openapi/errors/commits?author=ligustah> |
|
||||
| @artemseleznev | 1 | <https://github.com/go-openapi/errors/commits?author=artemseleznev> |
|
||||
| @gautierdelorme | 1 | <https://github.com/go-openapi/errors/commits?author=gautierdelorme> |
|
||||
| @guillemj | 1 | <https://github.com/go-openapi/errors/commits?author=guillemj> |
|
||||
| @maxatome | 1 | <https://github.com/go-openapi/errors/commits?author=maxatome> |
|
||||
| @Simon-Li | 1 | <https://github.com/go-openapi/errors/commits?author=Simon-Li> |
|
||||
| @aokumasan | 1 | <https://github.com/go-openapi/errors/commits?author=aokumasan> |
|
||||
| @ujjwalsh | 1 | <https://github.com/go-openapi/errors/commits?author=ujjwalsh> |
|
||||
|
||||
_this file was generated by the [Contributors GitHub Action](https://github.com/github/contributors)_
|
||||
|
||||
+4
-9
@@ -51,7 +51,9 @@ errNotImplemented := NotImplemented("method: %s", url)
|
||||
See <https://github.com/go-openapi/errors/releases>
|
||||
|
||||
<!--
|
||||
|
||||
## References
|
||||
|
||||
-->
|
||||
|
||||
## Licensing
|
||||
@@ -59,12 +61,9 @@ See <https://github.com/go-openapi/errors/releases>
|
||||
This library ships under the [SPDX-License-Identifier: Apache-2.0](./LICENSE).
|
||||
|
||||
<!--
|
||||
See the license [NOTICE](./NOTICE), which recalls the licensing terms of all the pieces of software
|
||||
on top of which it has been built.
|
||||
-->
|
||||
|
||||
<!--
|
||||
## Limitations
|
||||
|
||||
-->
|
||||
|
||||
## Other documentation
|
||||
@@ -95,23 +94,19 @@ Maintainers can cut a new release by either:
|
||||
<!-- Badges: release & docker images -->
|
||||
[release-badge]: https://badge.fury.io/gh/go-openapi%2Ferrors.svg
|
||||
[release-url]: https://badge.fury.io/gh/go-openapi%2Ferrors
|
||||
[gomod-badge]: https://badge.fury.io/go/github.com%2Fgo-openapi%2Ferrors.svg
|
||||
[gomod-url]: https://badge.fury.io/go/github.com%2Fgo-openapi%2Ferrors
|
||||
<!-- Badges: code quality -->
|
||||
[gocard-badge]: https://goreportcard.com/badge/github.com/go-openapi/errors
|
||||
[gocard-url]: https://goreportcard.com/report/github.com/go-openapi/errors
|
||||
[codefactor-badge]: https://img.shields.io/codefactor/grade/github/go-openapi/errors
|
||||
[codefactor-url]: https://www.codefactor.io/repository/github/go-openapi/errors
|
||||
<!-- Badges: documentation & support -->
|
||||
[doc-badge]: https://img.shields.io/badge/doc-site-blue?link=https%3A%2F%2Fgoswagger.io%2Fgo-openapi%2F
|
||||
[doc-url]: https://goswagger.io/go-openapi
|
||||
[godoc-badge]: https://pkg.go.dev/badge/github.com/go-openapi/errors
|
||||
[godoc-url]: http://pkg.go.dev/github.com/go-openapi/errors
|
||||
[slack-logo]: https://a.slack-edge.com/e6a93c1/img/icons/favicon-32.png
|
||||
[slack-badge]: https://img.shields.io/badge/slack-blue?link=https%3A%2F%2Fgoswagger.slack.com%2Farchives%2FC04R30YM
|
||||
[slack-url]: https://goswagger.slack.com/archives/C04R30YMU
|
||||
[discord-badge]: https://img.shields.io/discord/1446918742398341256?logo=discord&label=discord&color=blue
|
||||
[discord-url]: https://discord.gg/DrafRmZx
|
||||
[discord-url]: https://discord.gg/twZ9BwT3
|
||||
|
||||
<!-- Badges: license & compliance -->
|
||||
[license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg
|
||||
|
||||
+23
-5
@@ -6,14 +6,32 @@ This policy outlines the commitment and practices of the go-openapi maintainers
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 0.22.x | :white_check_mark: |
|
||||
| 0.x | :white_check_mark: |
|
||||
|
||||
## Vulnerability checks in place
|
||||
|
||||
This repository uses automated vulnerability scans, at every merged commit and at least once a week.
|
||||
|
||||
We use:
|
||||
|
||||
* [`GitHub CodeQL`][codeql-url]
|
||||
* [`trivy`][trivy-url]
|
||||
* [`govulncheck`][govulncheck-url]
|
||||
|
||||
Reports are centralized in github security reports and visible only to the maintainers.
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
If you become aware of a security vulnerability that affects the current repository,
|
||||
please report it privately to the maintainers.
|
||||
**please report it privately to the maintainers**
|
||||
rather than opening a publicly visible GitHub issue.
|
||||
|
||||
Please follow the instructions provided by github to
|
||||
[Privately report a security vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability).
|
||||
Please follow the instructions provided by github to [Privately report a security vulnerability][github-guidance-url].
|
||||
|
||||
TL;DR: on Github, navigate to the project's "Security" tab then click on "Report a vulnerability".
|
||||
> [!NOTE]
|
||||
> On Github, navigate to the project's "Security" tab then click on "Report a vulnerability".
|
||||
|
||||
[codeql-url]: https://github.com/github/codeql
|
||||
[trivy-url]: https://trivy.dev/docs/latest/getting-started
|
||||
[govulncheck-url]: https://go.dev/blog/govulncheck
|
||||
[github-guidance-url]: https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ func MethodNotAllowed(requested string, allow []string) Error {
|
||||
}
|
||||
}
|
||||
|
||||
// ServeError implements the http error handler interface.
|
||||
// ServeError implements the [http] error handler interface.
|
||||
func ServeError(rw http.ResponseWriter, r *http.Request, err error) {
|
||||
rw.Header().Set("Content-Type", "application/json")
|
||||
|
||||
|
||||
+9
-11
@@ -1,15 +1,13 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/*
|
||||
Package errors provides an Error interface and several concrete types
|
||||
implementing this interface to manage API errors and JSON-schema validation
|
||||
errors.
|
||||
|
||||
A middleware handler ServeError() is provided to serve the errors types
|
||||
it defines.
|
||||
|
||||
It is used throughout the various go-openapi toolkit libraries
|
||||
(https://github.com/go-openapi).
|
||||
*/
|
||||
// Package errors provides an Error interface and several concrete types
|
||||
// implementing this interface to manage API errors and JSON-schema validation
|
||||
// errors.
|
||||
//
|
||||
// A middleware handler [ServeError]() is provided to serve the errors types
|
||||
// it defines.
|
||||
//
|
||||
// It is used throughout the various go-openapi toolkit libraries.
|
||||
// (https://github.com/go-openapi).
|
||||
package errors
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user