forked from go-swagger/go-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(flatten): onboard fix for relative $ref in params&responses
* fixes go-swagger#2743 This PR onboards the fix to go-openapi/spec#182: * invalid relative path in $ref in schema for parameters or response when SkipSchema=true (flatten use-case) Added a test to assert that the fix works fine with the version update. Signed-off-by: Frederic BIDON <[email protected]>
- Loading branch information
Showing
21 changed files
with
189 additions
and
7 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,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