-
-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: detects circular references that can't be handled at the moment …
…to avoid infinite loops loading documents (#607)
- Loading branch information
1 parent
6610338
commit a8f69f4
Showing
5 changed files
with
269 additions
and
19 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,15 @@ | ||
package openapi3 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestIssue542(t *testing.T) { | ||
sl := NewLoader() | ||
|
||
_, err := sl.LoadFromFile("testdata/issue542.yml") | ||
require.Error(t, err) | ||
require.Contains(t, err.Error(), CircularReferenceError) | ||
} |
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,15 @@ | ||
package openapi3 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestIssue570(t *testing.T) { | ||
loader := NewLoader() | ||
_, err := loader.LoadFromFile("testdata/issue570.json") | ||
require.Error(t, err) | ||
assert.Contains(t, err.Error(), CircularReferenceError) | ||
} |
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
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,43 @@ | ||
openapi: "3.0.0" | ||
info: | ||
version: 1.0.0 | ||
title: Swagger Petstore | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://petstore.swagger.io/v1 | ||
paths: {} | ||
#paths: | ||
# /pets: | ||
# patch: | ||
# requestBody: | ||
# content: | ||
# application/json: | ||
# schema: | ||
# oneOf: | ||
# - $ref: '#/components/schemas/Cat' | ||
# - $ref: '#/components/schemas/Kitten' | ||
# discriminator: | ||
# propertyName: pet_type | ||
# responses: | ||
# '200': | ||
# description: Updated | ||
components: | ||
schemas: | ||
Cat: | ||
anyOf: | ||
- $ref: "#/components/schemas/Kitten" | ||
- type: object | ||
# properties: | ||
# hunts: | ||
# type: boolean | ||
# age: | ||
# type: integer | ||
# offspring: | ||
Kitten: | ||
$ref: "#/components/schemas/Cat" #ko | ||
|
||
# type: string #ok | ||
|
||
# allOf: #ko | ||
# - $ref: '#/components/schemas/Cat' |
Large diffs are not rendered by default.
Oops, something went wrong.