-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref in paths / responses / parameters: flatten $ref in Paths (covers …
…skip schemas) (#111) * fix(expander): support SkipSchema case for in Paths section * added some quick patches to keep things running on windows: a more elaborate approach is still needed to fully support file $ref on windows Signed-off-by: Frederic BIDON <[email protected]> * fixed some missing nested schema rebasing when SkipSchema is enabled Signed-off-by: Frederic BIDON <[email protected]> * more fixes Signed-off-by: Frederic BIDON <[email protected]> * added test and fixture on self-referencing pointers Signed-off-by: Frederic BIDON <[email protected]> * fixup ci: useless install step Signed-off-by: Frederic BIDON <[email protected]> * cleanup code Signed-off-by: Frederic BIDON <[email protected]> * fixup linting Signed-off-by: Frederic BIDON <[email protected]>
- Loading branch information
Showing
29 changed files
with
991 additions
and
22 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 |
---|---|---|
|
@@ -36,3 +36,4 @@ linters: | |
- nestif | ||
- godot | ||
- gofumpt | ||
- paralleltest |
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,50 @@ | ||
definitions: | ||
named: | ||
type: string | ||
tag: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
value: | ||
type: string | ||
audit: | ||
$ref: "#/definitions/record" | ||
record: | ||
type: object | ||
properties: | ||
createdAt: | ||
type: string | ||
format: date-time | ||
|
||
nestedThing: | ||
type: object | ||
properties: | ||
record: | ||
type: array | ||
items: | ||
- type: string | ||
format: date-time | ||
- type: object | ||
properties: | ||
createdAt: | ||
type: string | ||
format: date-time | ||
- allOf: | ||
- type: string | ||
format: date | ||
- type: object | ||
additionalProperties: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
value: | ||
type: string | ||
properties: | ||
value: | ||
type: string | ||
name: | ||
$ref: "definitions2.yml#/coordinate" |
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 @@ | ||
coordinate: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
createdAt: | ||
type: string | ||
format: date-time |
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,13 @@ | ||
error: | ||
type: object | ||
required: | ||
- id | ||
- message | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
readOnly: true | ||
message: | ||
type: string | ||
readOnly: true |
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,35 @@ | ||
bodyParam: | ||
name: body | ||
in: body | ||
schema: | ||
type: object | ||
properties: | ||
record: | ||
type: array | ||
items: | ||
- type: string | ||
format: date-time | ||
- type: object | ||
properties: | ||
createdAt: | ||
type: string | ||
format: date-time | ||
- allOf: | ||
- type: string | ||
format: date | ||
- type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
value: | ||
type: string | ||
name: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
createdAt: | ||
type: string | ||
format: date-time |
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,32 @@ | ||
genericResponse: | ||
type: object | ||
properties: | ||
record: | ||
type: array | ||
items: | ||
- type: string | ||
format: date-time | ||
- type: object | ||
properties: | ||
createdAt: | ||
type: string | ||
format: date-time | ||
- allOf: | ||
- type: string | ||
format: date | ||
- type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
value: | ||
type: string | ||
name: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
createdAt: | ||
type: string | ||
format: date-time |
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,12 @@ | ||
parameters: | ||
idParam: | ||
name: id | ||
in: path | ||
type: integer | ||
format: int32 | ||
limitParam: | ||
name: limit | ||
in: query | ||
type: integer | ||
format: int32 | ||
required: false |
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 @@ | ||
get: | ||
operationId: modelOp | ||
summary: many model variations | ||
description: Used to see if a codegen can render all the possible parameter variations for a header param | ||
tags: | ||
- testcgen | ||
responses: | ||
default: | ||
description: Generic Out |
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 @@ | ||
responses: | ||
notFound: | ||
schema: | ||
$ref: "errors.yml#/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,85 @@ | ||
--- | ||
swagger: "2.0" | ||
info: | ||
version: "0.1.0" | ||
title: reference analysis | ||
|
||
parameters: | ||
someParam: | ||
name: some | ||
in: query | ||
type: string | ||
responses: | ||
notFound: | ||
description: "Not Found" | ||
schema: | ||
$ref: "external/errors.yml#/error" | ||
|
||
paths: | ||
"/some/where/{id}": | ||
parameters: | ||
- $ref: "external/parameters.yml#/parameters/idParam" | ||
|
||
get: | ||
parameters: | ||
- $ref: "external/parameters.yml#/parameters/limitParam" | ||
- $ref: "#/parameters/someParam" | ||
- name: other | ||
in: query | ||
type: string | ||
- $ref: "external/nestedParams.yml#/bodyParam" | ||
|
||
responses: | ||
default: | ||
$ref: "external/nestedResponses.yml#/genericResponse" | ||
404: | ||
$ref: "#/responses/notFound" | ||
200: | ||
description: "RecordHolder" | ||
schema: | ||
type: object | ||
properties: | ||
record: | ||
$ref: "external/definitions.yml#/definitions/nestedThing" | ||
"/other/place": | ||
$ref: "external/pathItem.yml" | ||
|
||
definitions: | ||
namedAgain: | ||
$ref: "external/definitions.yml#/definitions/named" | ||
|
||
datedTag: | ||
allOf: | ||
- type: string | ||
format: date | ||
- $ref: "external/definitions.yml#/definitions/tag" | ||
|
||
records: | ||
type: array | ||
items: | ||
- $ref: "external/definitions.yml#/definitions/record" | ||
|
||
datedRecords: | ||
type: array | ||
items: | ||
- type: string | ||
format: date-time | ||
- $ref: "external/definitions.yml#/definitions/record" | ||
|
||
otherRecords: | ||
type: array | ||
items: | ||
$ref: "external/definitions.yml#/definitions/record" | ||
|
||
tags: | ||
type: object | ||
additionalProperties: | ||
$ref: "external/definitions.yml#/definitions/tag" | ||
|
||
namedThing: | ||
type: object | ||
properties: | ||
name: | ||
$ref: "external/definitions.yml#/definitions/named" | ||
namedAgain: | ||
$ref: "#/definitions/namedAgain" |
29 changes: 29 additions & 0 deletions
29
fixtures/more_circulars/pointers/fixture-pointers-loop.yaml
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 @@ | ||
--- | ||
swagger: '2.0' | ||
info: | ||
version: '0.1.0' | ||
title: JSON pointers | ||
|
||
paths: | ||
/some/where: | ||
get: | ||
responses: | ||
default: | ||
schema: | ||
$ref: '#/definitions/whiteStone/properties/p1' | ||
definitions: | ||
whiteStone: | ||
type: object | ||
properties: | ||
p1: | ||
$ref: '#/definitions/blackStone/properties/p2' | ||
blackStone: | ||
type: object | ||
properties: | ||
p2: | ||
$ref: '#/definitions/redStone/properties/p3' | ||
redStone: | ||
type: object | ||
properties: | ||
p3: | ||
$ref: '#/definitions/whiteStone/properties/p1' |
Oops, something went wrong.