forked from go-openapi/analysis
-
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): allows the use of pointers to schemas in x-... extensions
This PR allows for reusing schemas stored in x-... extensions of the spec, via json pointers. We have seen some specs using such extensions to create "alternate definitions". The spec flattening canonicalizes such schemas by reintroducing them as #/definitions, so they can be consumed by codegen. * requires: go-openapi/jsonpointer#16 * contributes: go-swagger/go-swagger#1898 Signed-off-by: Frederic BIDON <[email protected]>
- Loading branch information
Showing
8 changed files
with
183 additions
and
15 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,105 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "example.proto", | ||
"version": "version not set" | ||
}, | ||
"schemes": [ | ||
"http", | ||
"https" | ||
], | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"paths": { | ||
"/example/v2/GetEvents": { | ||
"get": { | ||
"operationId": "GetEvents", | ||
"responses": { | ||
"200": { | ||
"description": "A successful response.(streaming responses)", | ||
"schema": { | ||
"$ref": "#/x-stream-definitions/v2EventMsg" | ||
} | ||
} | ||
}, | ||
"parameters": [ | ||
{ | ||
"name": "afterEventID", | ||
"description": ".", | ||
"in": "query", | ||
"required": false, | ||
"type": "string" | ||
} | ||
], | ||
"tags": [ | ||
"Matchmaking" | ||
] | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"protobufAny": { | ||
"type": "object", | ||
"properties": { | ||
"type_url": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string", | ||
"format": "byte" | ||
} | ||
} | ||
}, | ||
"runtimeStreamError": { | ||
"type": "object", | ||
"properties": { | ||
"grpc_code": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"http_code": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"message": { | ||
"type": "string" | ||
}, | ||
"http_status": { | ||
"type": "string" | ||
}, | ||
"details": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/protobufAny" | ||
} | ||
} | ||
} | ||
}, | ||
"v2EventMsg": { | ||
"type": "object", | ||
"properties": { | ||
"eventID": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"x-stream-definitions": { | ||
"v2EventMsg": { | ||
"type": "object", | ||
"properties": { | ||
"result": { | ||
"$ref": "#/definitions/v2EventMsg" | ||
}, | ||
"error": { | ||
"$ref": "#/definitions/runtimeStreamError" | ||
} | ||
}, | ||
"title": "Stream result of v2EventMsg" | ||
} | ||
} | ||
} |
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
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