-
-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle Any type as a typeless schema in OpenAPI (#3561)
* Add test cases about Any type * Add Any type attributes to test of openapi v3 * Handle Any type as a typeless schema in OpenAPI * Combine types of function parameters --------- Co-authored-by: Raphael Simon <[email protected]>
- Loading branch information
Showing
11 changed files
with
213 additions
and
6 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
1 change: 1 addition & 0 deletions
1
http/codegen/openapi/v2/testdata/TestSections/with-any_file0.golden
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 @@ | ||
{"swagger":"2.0","info":{"title":"","version":"0.0.1"},"host":"localhost:80","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","parameters":[{"name":"TestEndpointRequestBody","in":"body","required":true,"schema":{"$ref":"#/definitions/TestServiceTestEndpointRequestBody"}}],"responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/TestServiceTestEndpointResponseBody"}}},"schemes":["http"]}}},"definitions":{"TestServiceTestEndpointRequestBody":{"title":"TestServiceTestEndpointRequestBody","type":"object","properties":{"any":{"example":""},"any_array":{"type":"array","items":{"example":""},"example":["","","",""]},"any_map":{"type":"object","example":{"":""},"additionalProperties":true}},"example":{"any":"","any_array":["","",""],"any_map":{"":""}}},"TestServiceTestEndpointResponseBody":{"title":"TestServiceTestEndpointResponseBody","type":"object","properties":{"any":{"example":""},"any_array":{"type":"array","items":{"example":""},"example":["","","",""]},"any_map":{"type":"object","example":{"":""},"additionalProperties":true}},"example":{"any":"","any_array":["",""],"any_map":{"":""}}}}} |
89 changes: 89 additions & 0 deletions
89
http/codegen/openapi/v2/testdata/TestSections/with-any_file1.golden
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,89 @@ | ||
swagger: "2.0" | ||
info: | ||
title: "" | ||
version: 0.0.1 | ||
host: localhost:80 | ||
consumes: | ||
- application/json | ||
- application/xml | ||
- application/gob | ||
produces: | ||
- application/json | ||
- application/xml | ||
- application/gob | ||
paths: | ||
/: | ||
post: | ||
tags: | ||
- testService | ||
summary: testEndpoint testService | ||
operationId: testService#testEndpoint | ||
parameters: | ||
- name: TestEndpointRequestBody | ||
in: body | ||
required: true | ||
schema: | ||
$ref: '#/definitions/TestServiceTestEndpointRequestBody' | ||
responses: | ||
"200": | ||
description: OK response. | ||
schema: | ||
$ref: '#/definitions/TestServiceTestEndpointResponseBody' | ||
schemes: | ||
- http | ||
definitions: | ||
TestServiceTestEndpointRequestBody: | ||
title: TestServiceTestEndpointRequestBody | ||
type: object | ||
properties: | ||
any: | ||
example: "" | ||
any_array: | ||
type: array | ||
items: | ||
example: "" | ||
example: | ||
- "" | ||
- "" | ||
- "" | ||
- "" | ||
any_map: | ||
type: object | ||
example: | ||
"": "" | ||
additionalProperties: true | ||
example: | ||
any: "" | ||
any_array: | ||
- "" | ||
- "" | ||
- "" | ||
any_map: | ||
"": "" | ||
TestServiceTestEndpointResponseBody: | ||
title: TestServiceTestEndpointResponseBody | ||
type: object | ||
properties: | ||
any: | ||
example: "" | ||
any_array: | ||
type: array | ||
items: | ||
example: "" | ||
example: | ||
- "" | ||
- "" | ||
- "" | ||
- "" | ||
any_map: | ||
type: object | ||
example: | ||
"": "" | ||
additionalProperties: true | ||
example: | ||
any: "" | ||
any_array: | ||
- "" | ||
- "" | ||
any_map: | ||
"": "" |
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 @@ | ||
{"openapi":"3.0.3","info":{"title":"Goa API","version":"0.0.1"},"servers":[{"url":"http://localhost:80","description":"Default server for test api"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"any":"","any_array":["","","",""],"any_map":{"":""}}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"any":"","any_array":["","",""],"any_map":{"":""}}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"any":{"example":""},"any_array":{"type":"array","items":{"example":""},"example":["","","",""]},"any_map":{"type":"object","example":{"":""},"additionalProperties":true}},"example":{"any":"","any_array":["",""],"any_map":{"":""}}}}},"tags":[{"name":"testService"}]} |
74 changes: 74 additions & 0 deletions
74
http/codegen/openapi/v3/testdata/golden/with-any_file1.golden
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,74 @@ | ||
openapi: 3.0.3 | ||
info: | ||
title: Goa API | ||
version: 0.0.1 | ||
servers: | ||
- url: http://localhost:80 | ||
description: Default server for test api | ||
paths: | ||
/: | ||
post: | ||
tags: | ||
- testService | ||
summary: testEndpoint testService | ||
operationId: testService#testEndpoint | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/TestEndpointRequestBody' | ||
example: | ||
any: "" | ||
any_array: | ||
- "" | ||
- "" | ||
- "" | ||
- "" | ||
any_map: | ||
"": "" | ||
responses: | ||
"200": | ||
description: OK response. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/TestEndpointRequestBody' | ||
example: | ||
any: "" | ||
any_array: | ||
- "" | ||
- "" | ||
- "" | ||
any_map: | ||
"": "" | ||
components: | ||
schemas: | ||
TestEndpointRequestBody: | ||
type: object | ||
properties: | ||
any: | ||
example: "" | ||
any_array: | ||
type: array | ||
items: | ||
example: "" | ||
example: | ||
- "" | ||
- "" | ||
- "" | ||
- "" | ||
any_map: | ||
type: object | ||
example: | ||
"": "" | ||
additionalProperties: true | ||
example: | ||
any: "" | ||
any_array: | ||
- "" | ||
- "" | ||
any_map: | ||
"": "" | ||
tags: | ||
- name: testService |
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