Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded dependencies which required a few updates. #94

Merged
merged 25 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.23
id: go

- name: Checkout code
Expand Down
38 changes: 38 additions & 0 deletions errors/error_utilities_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2023-2024 Princess Beef Heavy Industries, LLC / Dave Shanley
// https://pb33f.io

package errors

import (
"github.com/stretchr/testify/require"
"net/http"
"testing"
)

// Helper function to create a mock ValidationError
func createMockValidationError() *ValidationError {
return &ValidationError{
Message: "Test validation error",
}
}

func TestPopulateValidationErrors(t *testing.T) {
// Create a mock request
req, _ := http.NewRequest(http.MethodGet, "/test/path", nil)

// Create mock validation errors
validationErrors := []*ValidationError{
createMockValidationError(),
createMockValidationError(),
}

// Call the function
PopulateValidationErrors(validationErrors, req, "/spec/path")

// Validate the results
for _, validationError := range validationErrors {
require.Equal(t, "/spec/path", validationError.SpecPath)
require.Equal(t, http.MethodGet, validationError.RequestMethod)
require.Equal(t, "/test/path", validationError.RequestPath)
}
}
2 changes: 1 addition & 1 deletion errors/parameter_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func IncorrectPathParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *V
ValidationSubType: helpers.ParameterValidationPath,
Message: fmt.Sprintf("Path parameter '%s' does not match allowed values", param.Name),
Reason: fmt.Sprintf("The path parameter '%s' has pre-defined "+
"values setvia an enum. The value '%s' is not one of those values.", param.Name, ef),
"values set via an enum. The value '%s' is not one of those values.", param.Name, ef),
SpecLine: param.GoLow().Schema.Value.Schema().Enum.KeyNode.Line,
SpecCol: param.GoLow().Schema.Value.Schema().Enum.KeyNode.Column,
Context: sch,
Expand Down
Loading
Loading