Skip to content

Commit

Permalink
test(operation): add test for extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightapes committed Oct 2, 2021
1 parent 291d8a9 commit 3d689e5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,30 @@ func TestParseAndExtractionParamAttribute(t *testing.T) {
assert.NoError(t, err)
}

func TestParseParamCommentByExtensions(t *testing.T) {
comment := `@Param some_id path int true "Some ID" extensions(x-example=test,x-custom=Goopher,x-custom2)`
operation := NewOperation(nil)
err := operation.ParseComment(comment, nil)

assert.NoError(t, err)
b, _ := json.MarshalIndent(operation, "", " ")
expected := `{
"parameters": [
{
"type": "integer",
"x-custom": "Goopher",
"x-custom2": true,
"x-example": "test",
"description": "Some ID",
"name": "some_id",
"in": "path",
"required": true
}
]
}`
assert.Equal(t, expected, string(b))
}

func TestParseIdComment(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 3d689e5

Please sign in to comment.