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

fix that test situation #506

Merged
merged 4 commits into from
Mar 10, 2022
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
17 changes: 4 additions & 13 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ jobs:
strategy:
fail-fast: true
matrix:
go: ['1.14', '1.x']
# Locked at https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
go: ['1.16', '1.x']
os:
- ubuntu-20.04
- windows-2019
- macos-10.15
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down Expand Up @@ -47,8 +46,6 @@ jobs:
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-${{ matrix.go }}-mod-${{ hashFiles('**/go.sum') }}
if: matrix.go != '1.14'


- uses: actions/checkout@v2

Expand All @@ -70,12 +67,6 @@ jobs:
CGO_ENABLED: '1'
- if: runner.os == 'Linux'
run: git --no-pager diff && [[ $(git --no-pager diff --name-only | wc -l) = 0 ]]
- run: |
cp openapi3/testdata/load_with_go_embed_test.go openapi3/
cat go.mod | sed 's%go 1.14%go 1.16%' >gomod && mv gomod go.mod
go test ./...
if: matrix.go != '1.14'


- if: runner.os == 'Linux'
name: Errors must not be capitalized https://github.com/golang/go/wiki/CodeReviewComments#error-strings
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@

# IntelliJ / GoLand
.idea

/openapi3/load_with_go_embed_test.go
.vscode
.vscode
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/getkin/kin-openapi

go 1.14
go 1.16

require (
github.com/ghodss/yaml v1.0.0
Expand Down
3 changes: 2 additions & 1 deletion openapi3/external_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package openapi3

import (
"context"
"errors"
"fmt"
"net/url"

Expand All @@ -26,7 +27,7 @@ func (e *ExternalDocs) UnmarshalJSON(data []byte) error {

func (e *ExternalDocs) Validate(ctx context.Context) error {
if e.URL == "" {
return fmt.Errorf("url is required")
return errors.New("url is required")
}
if _, err := url.Parse(e.URL); err != nil {
return fmt.Errorf("url is incorrect: %w", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build go1.16
// +build go1.16

package openapi3_test

import (
Expand Down
3 changes: 2 additions & 1 deletion openapi3/request_body.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package openapi3

import (
"context"
"errors"
"fmt"

"github.com/getkin/kin-openapi/jsoninfo"
Expand Down Expand Up @@ -99,7 +100,7 @@ func (requestBody *RequestBody) UnmarshalJSON(data []byte) error {

func (value *RequestBody) Validate(ctx context.Context) error {
if value.Content == nil {
return fmt.Errorf("content of the request body is required")
return errors.New("content of the request body is required")
}
return value.Content.Validate(ctx)
}