-
-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make form required field order deterministic (#1008)
- Loading branch information
1 parent
2a0cad9
commit c606b55
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package openapi2conv | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestIssue1008(t *testing.T) { | ||
v2 := []byte(` | ||
swagger: '2.0' | ||
info: | ||
version: '1.10' | ||
title: title | ||
paths: | ||
"/ping": | ||
post: | ||
consumes: | ||
- multipart/form-data | ||
parameters: | ||
- name: zebra | ||
in: formData | ||
description: stripes | ||
required: true | ||
type: string | ||
- name: alpaca | ||
in: formData | ||
description: chewy | ||
required: true | ||
type: string | ||
- name: bee | ||
in: formData | ||
description: buzz | ||
required: true | ||
type: string | ||
responses: | ||
'200': | ||
description: OK | ||
`) | ||
|
||
v3, err := v2v3YAML(v2) | ||
require.NoError(t, err) | ||
|
||
err = v3.Validate(context.Background()) | ||
require.NoError(t, err) | ||
assert.Equal(t, []string{"alpaca", "bee", "zebra"}, v3.Paths.Value("/ping").Post.RequestBody.Value.Content.Get("multipart/form-data").Schema.Value.Required) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters