Skip to content

Commit

Permalink
update tests and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
meteran committed May 17, 2023
1 parent dfe1489 commit 3dfac53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

---

## gNext v0.9.0 (09.05.2023) Latest
## gNext v0.10.0 (17.05.2023) Latest

* [NEW] Ability to define security schemas in docs

---

## gNext v0.9.0 (09.05.2023)

* [EDIT] Do not generate endpoint tags if are overridden
* [EDIT] Update openapi library
Expand Down
10 changes: 5 additions & 5 deletions docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestDocsWithGlobalSecuritySchema(t *testing.T) {

doc := generateDocs(t, r)

require.Equal(t, openapi3.Components{
assert.Equal(t, openapi3.Components{
Extensions: map[string]interface{}{},
SecuritySchemes: openapi3.SecuritySchemes{"HTTPBearer": &openapi3.SecuritySchemeRef{Value: &openapi3.SecurityScheme{
Extensions: map[string]interface{}{},
Expand All @@ -117,7 +117,7 @@ func TestDocsWithGlobalSecuritySchema(t *testing.T) {
BearerFormat: "JWT",
}}},
}, *doc.Components)
require.Equal(t, openapi3.SecurityRequirements{openapi3.SecurityRequirement{"HTTPBearer": []string{}}}, doc.Security)
assert.Equal(t, openapi3.SecurityRequirements{openapi3.SecurityRequirement{"HTTPBearer": []string{}}}, doc.Security)
}

func TestDocsWithEndpointSecuritySchema(t *testing.T) {
Expand All @@ -140,7 +140,7 @@ func TestDocsWithEndpointSecuritySchema(t *testing.T) {

doc := generateDocs(t, r)

require.Equal(t, openapi3.Components{
assert.Equal(t, openapi3.Components{
Extensions: map[string]interface{}{},
SecuritySchemes: openapi3.SecuritySchemes{"HTTPBearer": &openapi3.SecuritySchemeRef{Value: &openapi3.SecurityScheme{
Extensions: map[string]interface{}{},
Expand All @@ -150,6 +150,6 @@ func TestDocsWithEndpointSecuritySchema(t *testing.T) {
}}},
}, *doc.Components)
assert.Nil(t, doc.Security)
require.Nil(t, doc.Paths["/my/example1"].Post.Security)
require.Equal(t, openapi3.SecurityRequirements{openapi3.SecurityRequirement{"HTTPBearer": []string{}}}, *doc.Paths["/my/example2"].Post.Security)
assert.Nil(t, doc.Paths["/my/example1"].Post.Security)
assert.Equal(t, openapi3.SecurityRequirements{openapi3.SecurityRequirement{"HTTPBearer": []string{}}}, *doc.Paths["/my/example2"].Post.Security)
}

0 comments on commit 3dfac53

Please sign in to comment.