Skip to content

Commit 582ec73

Browse files
authored
Update dependencies (#27)
1 parent 38b1273 commit 582ec73

File tree

7 files changed

+66
-32
lines changed

7 files changed

+66
-32
lines changed

.github/workflows/gorelease.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
gorelease:
99
strategy:
1010
matrix:
11-
go-version: [ 1.16.x ]
11+
go-version: [ 1.17.x ]
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Install Go
@@ -38,7 +38,7 @@ jobs:
3838
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3939
header: gorelease
4040
message: |
41-
### Exported API Changes Report
41+
### API Changes
4242
4343
<pre>
4444
${{ steps.gorelease.outputs.report }}

.github/workflows/test-unit.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
test:
1414
strategy:
1515
matrix:
16-
go-version: [ 1.13.x, 1.14.x, 1.15.x, 1.16.x ]
16+
go-version: [ 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x ]
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Install Go
@@ -35,21 +35,21 @@ jobs:
3535
restore-keys: |
3636
${{ runner.os }}-go-cache
3737
- name: Restore base test coverage
38-
if: matrix.go-version == '1.16.x'
38+
if: matrix.go-version == '1.17.x'
3939
uses: actions/cache@v2
4040
with:
4141
path: |
4242
unit-base.txt
4343
# Use base sha for PR or new commit hash for master/main push in test result key.
4444
key: ${{ runner.os }}-unit-test-coverage-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }}
4545
- name: Checkout base code
46-
if: matrix.go-version == '1.16.x' && env.RUN_BASE_COVERAGE == 'on' && steps.benchmark-base.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
46+
if: matrix.go-version == '1.17.x' && env.RUN_BASE_COVERAGE == 'on' && steps.benchmark-base.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
4747
uses: actions/checkout@v2
4848
with:
4949
ref: ${{ github.event.pull_request.base.sha }}
5050
path: __base
5151
- name: Run test for base code
52-
if: matrix.go-version == '1.16.x' && env.RUN_BASE_COVERAGE == 'on' && steps.benchmark-base.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
52+
if: matrix.go-version == '1.17.x' && env.RUN_BASE_COVERAGE == 'on' && steps.benchmark-base.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
5353
run: |
5454
cd __base
5555
make | grep test-unit && (make test-unit && go tool cover -func=./unit.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > ../unit-base.txt) || echo "No test-unit in base"
@@ -69,7 +69,7 @@ jobs:
6969
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
7070
run: cp unit.txt unit-base.txt
7171
- name: Comment Test Coverage
72-
if: matrix.go-version == '1.16.x'
72+
if: matrix.go-version == '1.17.x'
7373
uses: marocchino/sticky-pull-request-comment@v2
7474
with:
7575
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -85,7 +85,7 @@ jobs:
8585
</details>
8686
8787
- name: Upload code coverage
88-
if: matrix.go-version == '1.16.x'
88+
if: matrix.go-version == '1.17.x'
8989
uses: codecov/codecov-action@v1
9090
with:
9191
file: ./unit.coverprofile

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ifeq ($(DEVGO_PATH),)
2424
DEVGO_PATH := $(shell GO111MODULE=on $(GO) list ${modVendor} -f '{{.Dir}}' -m github.com/bool64/dev)
2525
ifeq ($(DEVGO_PATH),)
2626
$(info Module github.com/bool64/dev not found, downloading.)
27-
DEVGO_PATH := $(shell export GO111MODULE=on && $(GO) mod tidy && $(GO) list -f '{{.Dir}}' -m github.com/bool64/dev)
27+
DEVGO_PATH := $(shell export GO111MODULE=on && $(GO) get github.com/bool64/dev && $(GO) list -f '{{.Dir}}' -m github.com/bool64/dev)
2828
endif
2929
endif
3030

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ module github.com/swaggest/openapi-go
33
go 1.13
44

55
require (
6-
github.com/bool64/dev v0.1.37
6+
github.com/bool64/dev v0.1.42
77
github.com/stretchr/testify v1.7.0
8-
github.com/swaggest/assertjson v1.6.6
9-
github.com/swaggest/jsonschema-go v0.3.22
10-
github.com/swaggest/refl v1.0.0
8+
github.com/swaggest/assertjson v1.6.8
9+
github.com/swaggest/jsonschema-go v0.3.24
10+
github.com/swaggest/refl v1.0.1
1111
gopkg.in/yaml.v2 v2.4.0
1212
)

go.sum

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
github.com/bool64/dev v0.1.17/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
22
github.com/bool64/dev v0.1.25/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
3-
github.com/bool64/dev v0.1.35/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
4-
github.com/bool64/dev v0.1.37 h1:/c8U4emt4xjMDx8Au+POOYo5LJIw+Mzi4e48j5CmGQo=
5-
github.com/bool64/dev v0.1.37/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
3+
github.com/bool64/dev v0.1.41/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
4+
github.com/bool64/dev v0.1.42 h1:Ps0IvNNf/v1MlIXt8Q5YKcKjYsIVLY/fb/5BmA7gepg=
5+
github.com/bool64/dev v0.1.42/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
66
github.com/bool64/shared v0.1.3 h1:gj7XZPYa1flQsCg3q9AIju+W2A1jaexK0fdFu2XtaG0=
77
github.com/bool64/shared v0.1.3/go.mod h1:RF1p1Oi29ofgOvinBpetbF5mceOUP3kpMkvLbWOmtm0=
88
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -51,18 +51,20 @@ github.com/onsi/gomega v1.11.0 h1:+CqWgvj0OZycCaqclBD1pxKHAU+tOkHmQIWvDHq2aug=
5151
github.com/onsi/gomega v1.11.0/go.mod h1:azGKhqFUon9Vuj0YmTfLSmx0FUwqXYSTl5re8lQLTUg=
5252
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
5353
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
54-
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
5554
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
55+
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
56+
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
5657
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
5758
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
5859
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
5960
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
60-
github.com/swaggest/assertjson v1.6.6 h1:QO//07sfx9KR6h4t/8L+I5qOWUifLnu8gblhFYwkVQM=
61-
github.com/swaggest/assertjson v1.6.6/go.mod h1:HNfIAKxJJkeDmtrBU01dcWvEFjhghO96gx9Eo4rRjIc=
62-
github.com/swaggest/jsonschema-go v0.3.22 h1:9tdd1vc6jF+I6Uy4lIJFshoekZJ3uOowhAS7Ed1DxLg=
63-
github.com/swaggest/jsonschema-go v0.3.22/go.mod h1:UMMhyRN4FIUjy6ivVycElnWq+C7ql/1+L2R0BG01LkE=
64-
github.com/swaggest/refl v1.0.0 h1:yAFdjLQjmFuH4FHiD+HMaDUbF4cW0PbH5uhNoN4bme4=
61+
github.com/swaggest/assertjson v1.6.8 h1:1O/9UI5M+2OJI7BeEWKGj0wTvpRXZt5FkOJ4nRkY4rA=
62+
github.com/swaggest/assertjson v1.6.8/go.mod h1:Euf0upn9Vlaf1/llYHTs+Kx5K3vVbpMbsZhth7zlN7M=
63+
github.com/swaggest/jsonschema-go v0.3.24 h1:vVtFhWQWT9sgsvgMdh0n3O1F0+TnhOWz4+lbz5p5ChY=
64+
github.com/swaggest/jsonschema-go v0.3.24/go.mod h1:B2ZSqrrlkj21zhywlkh8VnKBmuqUwDv3dLQoPjgHk7M=
6565
github.com/swaggest/refl v1.0.0/go.mod h1:acYd5x8NNxivp+ZHdRZKJYz66n/qjo3Q9Sa/jAivljQ=
66+
github.com/swaggest/refl v1.0.1 h1:YQHb7Ic6EMpdUpxQmTWmf/O4IWN6iIErxJNWA7LwyyM=
67+
github.com/swaggest/refl v1.0.1/go.mod h1:dnx+n9YaI0o+FH+OR2tJZWLABBVIPs9qc4VY9UdrhLE=
6668
github.com/yosuke-furukawa/json5 v0.1.2-0.20201207051438-cf7bb3f354ff/go.mod h1:sw49aWDqNdRJ6DYUtIQiaA3xyj2IL9tjeNYmX2ixwcU=
6769
github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA=
6870
github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
@@ -126,5 +128,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
126128
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
127129
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
128130
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
129-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
130131
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
132+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
133+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

openapi3/reflect.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ func (r *Reflector) SetRequest(o *Operation, input interface{}, httpMethod strin
103103
})
104104
}
105105

106-
var (
107-
typeOfMultipartFile = reflect.TypeOf((*multipart.File)(nil)).Elem()
108-
typeOfMultipartFileHeader = reflect.TypeOf((*multipart.FileHeader)(nil)).Elem()
109-
)
110-
111106
const (
112107
tagJSON = "json"
113108
tagFormData = "formData"
@@ -174,10 +169,6 @@ func (r *Reflector) parseRequestBody(
174169
found = true
175170
}
176171

177-
if v.Type().Implements(typeOfMultipartFile) || v.Type() == typeOfMultipartFileHeader {
178-
found = true
179-
}
180-
181172
if found {
182173
s.AddType(jsonschema.String)
183174
s.WithFormat("binary")

openapi3/reflect_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,46 @@ func TestReflector_SetRequest_array(t *testing.T) {
114114
assertjson.Equal(t, expected, b)
115115
}
116116

117+
func TestReflector_SetRequest_uploadInterface(t *testing.T) {
118+
type req struct {
119+
File1 multipart.File `formData:"upload1"`
120+
}
121+
122+
reflector := openapi3.Reflector{}
123+
s := reflector.SpecEns()
124+
op := openapi3.Operation{}
125+
126+
err := reflector.SetRequest(&op, new(req), http.MethodPost)
127+
assert.NoError(t, err)
128+
129+
require.NoError(t, s.AddOperation(http.MethodPost, "/somewhere", op))
130+
131+
assertjson.EqualMarshal(t, []byte(`{
132+
"openapi":"3.0.3","info":{"title":"","version":""},
133+
"paths":{
134+
"/somewhere":{
135+
"post":{
136+
"requestBody":{
137+
"content":{
138+
"multipart/form-data":{"schema":{"$ref":"#/components/schemas/FormDataOpenapi3TestReq"}}
139+
}
140+
},
141+
"responses":{"204":{"description":"No Content"}}
142+
}
143+
}
144+
},
145+
"components":{
146+
"schemas":{
147+
"FormDataMultipartFile":{"type":"string","format":"binary","nullable":true},
148+
"FormDataOpenapi3TestReq":{
149+
"type":"object",
150+
"properties":{"upload1":{"$ref":"#/components/schemas/FormDataMultipartFile"}}
151+
}
152+
}
153+
}
154+
}`), s)
155+
}
156+
117157
func TestReflector_SetRequest(t *testing.T) {
118158
reflector := openapi3.Reflector{}
119159

0 commit comments

Comments
 (0)