-
-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for relative refs in spec (#1648)
Fixes #254 Fixes #967 This PR fixes the very long-standing issue of being able to handle relative references, which allows users to split their specification into multiple files.
- Loading branch information
1 parent
05c32d5
commit 2f9a461
Showing
8 changed files
with
176 additions
and
16 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
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,37 @@ | ||
components: | ||
schemas: | ||
Pet: | ||
required: | ||
- name | ||
properties: | ||
name: | ||
type: string | ||
example: fluffy | ||
tag: | ||
type: string | ||
example: red | ||
id: | ||
type: integer | ||
format: int64 | ||
readOnly: true | ||
example: 1 | ||
last_updated: | ||
type: string | ||
readOnly: true | ||
example: 2019-01-16T23:52:54.309102Z | ||
|
||
Pets: | ||
type: array | ||
items: | ||
$ref: "#/components/schemas/Pet" | ||
|
||
Error: | ||
properties: | ||
code: | ||
type: integer | ||
format: int32 | ||
message: | ||
type: string | ||
required: | ||
- code | ||
- message |
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,29 @@ | ||
definitions: | ||
Pet: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
name: | ||
type: string | ||
registered: | ||
type: string | ||
format: date-time | ||
|
||
Pets: | ||
type: array | ||
items: | ||
$ref: "#/definitions/Pet" | ||
|
||
Error: | ||
type: object | ||
properties: | ||
code: | ||
type: integer | ||
format: int32 | ||
message: | ||
type: string | ||
required: | ||
- code | ||
- message |
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,45 @@ | ||
openapi: 3.0.0 | ||
|
||
info: | ||
version: 1.0.0 | ||
title: Swagger Petstore | ||
license: | ||
name: MIT | ||
|
||
servers: | ||
- url: /openapi | ||
|
||
paths: | ||
/pets: | ||
get: | ||
summary: List all pets | ||
responses: | ||
'200': | ||
description: A paged array of pets | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "components.yaml#/components/schemas/Pets" | ||
default: | ||
description: Unexpected error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "components.yaml#/components/schemas/Error" | ||
|
||
'/pets/{petId}': | ||
get: | ||
summary: Info for a specific pet | ||
responses: | ||
'200': | ||
description: Expected response to a valid request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "components.yaml#/components/schemas/Pet" | ||
default: | ||
description: Unexpected error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "components.yaml#/components/schemas/Error" |
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,36 @@ | ||
swagger: "2.0" | ||
|
||
info: | ||
title: "{{title}}" | ||
version: "1.0" | ||
|
||
basePath: /swagger | ||
|
||
paths: | ||
/pets: | ||
get: | ||
summary: List all pets | ||
responses: | ||
'200': | ||
description: A paged array of pets | ||
schema: | ||
type: array | ||
items: | ||
$ref: 'definitions.yaml#/definitions/Pets' | ||
default: | ||
description: Unexpected Error | ||
schema: | ||
$ref: 'definitions.yaml#/definitions/Error' | ||
|
||
'/pets/{id}': | ||
get: | ||
summary: Info for a specific pet | ||
responses: | ||
'200': | ||
description: Expected response to a valid request | ||
schema: | ||
$ref: 'definitions.yaml#/definitions/Pet' | ||
default: | ||
description: Unexpected Error | ||
schema: | ||
$ref: 'definitions.yaml#/definitions/Error' |
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