-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(flatten): asserts that the ExpandSpec fix in spec works
This reproduces the $ref issue with relative paths in sibling folders in responses (same applies to parameters, but not schemas). Added a test to verify that: * (i) the invalid path that used to work no longer does * (ii) the valid path that used not to work now does * contributes go-swagger/go-swagger#2743 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
- Loading branch information
Showing
23 changed files
with
195 additions
and
2 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
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,7 @@ | ||
swagger: '2.0' | ||
info: | ||
version: 0.0.0 | ||
title: Simple API | ||
paths: | ||
/bar: | ||
$ref: 'swagger/paths/bar.yml' |
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,11 @@ | ||
swagger: '2.0' | ||
info: | ||
version: 0.0.0 | ||
title: Simple API | ||
paths: | ||
/foo: | ||
$ref: 'swagger/paths/foo.yml' | ||
/bar: | ||
$ref: 'swagger/paths/bar.yml' | ||
/nested: | ||
$ref: 'swagger/paths/nested.yml#/response' |
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,9 @@ | ||
ErrorPayload: | ||
title: Error Payload | ||
required: | ||
- errors | ||
properties: | ||
errors: | ||
type: array | ||
items: | ||
$ref: './items.yml#/ErrorDetailsItem' |
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 @@ | ||
ErrorDetailsItem: | ||
title: Error details item | ||
description: Represents an item of the list of details of an error. | ||
required: | ||
- message | ||
- code | ||
properties: | ||
message: | ||
type: string | ||
code: | ||
type: string | ||
details: | ||
type: array | ||
items: | ||
type: string |
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,8 @@ | ||
get: | ||
responses: | ||
200: | ||
description: OK | ||
schema: | ||
type: array | ||
items: | ||
$ref: '../user/index.yml#/User' ## this doesn't work |
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,8 @@ | ||
get: | ||
responses: | ||
200: | ||
description: OK | ||
500: | ||
description: OK | ||
schema: | ||
$ref: '../definitions.yml#/ErrorPayload' |
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,6 @@ | ||
/foo: | ||
$ref: ./foo.yml | ||
/bar: | ||
$ref: ./bar.yml | ||
/nested: | ||
$ref: ./nested.yml#/response |
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,14 @@ | ||
response: | ||
get: | ||
responses: | ||
200: | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/SameFileReference' | ||
|
||
definitions: | ||
SameFileReference: | ||
type: object | ||
properties: | ||
name: | ||
type: string |
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,2 @@ | ||
User: | ||
$ref: './model.yml' |
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,4 @@ | ||
type: object | ||
properties: | ||
name: | ||
type: string |
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,11 @@ | ||
swagger: '2.0' | ||
info: | ||
version: 0.0.0 | ||
title: Simple API | ||
paths: | ||
/foo: | ||
$ref: 'swagger/paths/foo.yml' | ||
/bar: | ||
$ref: 'swagger/paths/bar.yml' | ||
/nested: | ||
$ref: 'swagger/paths/nested.yml#/response' |
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,9 @@ | ||
ErrorPayload: | ||
title: Error Payload | ||
required: | ||
- errors | ||
properties: | ||
errors: | ||
type: array | ||
items: | ||
$ref: './items.yml#/ErrorDetailsItem' |
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 @@ | ||
ErrorDetailsItem: | ||
title: Error details item | ||
description: Represents an item of the list of details of an error. | ||
required: | ||
- message | ||
- code | ||
properties: | ||
message: | ||
type: string | ||
code: | ||
type: string | ||
details: | ||
type: array | ||
items: | ||
type: string |
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,8 @@ | ||
get: | ||
responses: | ||
200: | ||
description: OK | ||
schema: | ||
type: array | ||
items: | ||
$ref: './swagger/user/index.yml#/User' ## this works |
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,8 @@ | ||
get: | ||
responses: | ||
200: | ||
description: OK | ||
500: | ||
description: OK | ||
schema: | ||
$ref: '../definitions.yml#/ErrorPayload' |
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,6 @@ | ||
/foo: | ||
$ref: ./foo.yml | ||
/bar: | ||
$ref: ./bar.yml | ||
/nested: | ||
$ref: ./nested.yml#/response |
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,14 @@ | ||
response: | ||
get: | ||
responses: | ||
200: | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/SameFileReference' | ||
|
||
definitions: | ||
SameFileReference: | ||
type: object | ||
properties: | ||
name: | ||
type: string |
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,2 @@ | ||
User: | ||
$ref: './model.yml' |
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,4 @@ | ||
type: object | ||
properties: | ||
name: | ||
type: string |
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
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