Skip to content

Commit 4c73faf

Browse files
authored
[go-server] Add tests for primitive types in request/response (#20474)
* add test for primitive request/response * add new files
1 parent dcf472a commit 4c73faf

File tree

13 files changed

+360
-2
lines changed

13 files changed

+360
-2
lines changed

modules/openapi-generator/src/test/resources/3_0/go-server/petstore.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,11 +849,37 @@ paths:
849849
application/json:
850850
schema:
851851
$ref: '#/components/schemas/ApiResponse'
852+
/fake/collection/test:
853+
post:
854+
summary: POST a test batch
855+
operationId: fakePostTest
856+
tags:
857+
- fake
858+
requestBody:
859+
$ref: '#/components/requestBodies/TestBody'
860+
responses:
861+
'200':
862+
$ref: '#/components/responses/SuccessfulOp'
852863
externalDocs:
853864
description: Find out more about Swagger
854865
url: 'http://swagger.io'
855866
components:
867+
responses:
868+
SuccessfulOp:
869+
description: Successful Operation
870+
content:
871+
application/json:
872+
schema:
873+
type: bool
856874
requestBodies:
875+
TestBody:
876+
description: Test body
877+
required: true
878+
content:
879+
text/plain:
880+
schema:
881+
type: string
882+
format: byte
857883
UserArray:
858884
content:
859885
application/json:

samples/server/petstore/go-api-server/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ README.md
33
api/openapi.yaml
44
go.mod
55
go/api.go
6+
go/api_fake.go
7+
go/api_fake_service.go
68
go/api_pet.go
79
go/api_pet_service.go
810
go/api_store.go

samples/server/petstore/go-api-server/api/openapi.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,31 @@ paths:
893893
summary: Get the pets by time
894894
tags:
895895
- pet
896+
/fake/collection/test:
897+
post:
898+
operationId: fakePostTest
899+
requestBody:
900+
$ref: '#/components/requestBodies/TestBody'
901+
responses:
902+
"200":
903+
content:
904+
application/json:
905+
schema:
906+
type: bool
907+
description: Successful Operation
908+
summary: POST a test batch
909+
tags:
910+
- fake
896911
components:
897912
requestBodies:
913+
TestBody:
914+
content:
915+
text/plain:
916+
schema:
917+
format: byte
918+
type: string
919+
description: Test body
920+
required: true
898921
UserArray:
899922
content:
900923
application/json:
@@ -914,6 +937,13 @@ components:
914937
$ref: '#/components/schemas/Pet'
915938
description: Pet object that needs to be added to the store
916939
required: true
940+
responses:
941+
SuccessfulOp:
942+
content:
943+
application/json:
944+
schema:
945+
type: bool
946+
description: Successful Operation
917947
schemas:
918948
OrderInfo:
919949
description: An order info for a pets from the pet store

samples/server/petstore/go-api-server/go/api.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/server/petstore/go-api-server/go/api_fake.go

Lines changed: 77 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/server/petstore/go-api-server/go/api_fake_service.go

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/server/petstore/go-api-server/main.go

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/server/petstore/go-chi-server/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ README.md
33
api/openapi.yaml
44
go.mod
55
go/api.go
6+
go/api_fake.go
7+
go/api_fake_service.go
68
go/api_pet.go
79
go/api_pet_service.go
810
go/api_store.go

samples/server/petstore/go-chi-server/api/openapi.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,31 @@ paths:
893893
summary: Get the pets by time
894894
tags:
895895
- pet
896+
/fake/collection/test:
897+
post:
898+
operationId: fakePostTest
899+
requestBody:
900+
$ref: '#/components/requestBodies/TestBody'
901+
responses:
902+
"200":
903+
content:
904+
application/json:
905+
schema:
906+
type: bool
907+
description: Successful Operation
908+
summary: POST a test batch
909+
tags:
910+
- fake
896911
components:
897912
requestBodies:
913+
TestBody:
914+
content:
915+
text/plain:
916+
schema:
917+
format: byte
918+
type: string
919+
description: Test body
920+
required: true
898921
UserArray:
899922
content:
900923
application/json:
@@ -914,6 +937,13 @@ components:
914937
$ref: '#/components/schemas/Pet'
915938
description: Pet object that needs to be added to the store
916939
required: true
940+
responses:
941+
SuccessfulOp:
942+
content:
943+
application/json:
944+
schema:
945+
type: bool
946+
description: Successful Operation
917947
schemas:
918948
OrderInfo:
919949
description: An order info for a pets from the pet store

samples/server/petstore/go-chi-server/go/api.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)