Skip to content

Commit

Permalink
[go-server] Add tests for primitive types in request/response (#20474)
Browse files Browse the repository at this point in the history
* add test for primitive request/response

* add new files
  • Loading branch information
wing328 authored Jan 15, 2025
1 parent dcf472a commit 4c73faf
Show file tree
Hide file tree
Showing 13 changed files with 360 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,37 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/fake/collection/test:
post:
summary: POST a test batch
operationId: fakePostTest
tags:
- fake
requestBody:
$ref: '#/components/requestBodies/TestBody'
responses:
'200':
$ref: '#/components/responses/SuccessfulOp'
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
components:
responses:
SuccessfulOp:
description: Successful Operation
content:
application/json:
schema:
type: bool
requestBodies:
TestBody:
description: Test body
required: true
content:
text/plain:
schema:
type: string
format: byte
UserArray:
content:
application/json:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ README.md
api/openapi.yaml
go.mod
go/api.go
go/api_fake.go
go/api_fake_service.go
go/api_pet.go
go/api_pet_service.go
go/api_store.go
Expand Down
30 changes: 30 additions & 0 deletions samples/server/petstore/go-api-server/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,31 @@ paths:
summary: Get the pets by time
tags:
- pet
/fake/collection/test:
post:
operationId: fakePostTest
requestBody:
$ref: '#/components/requestBodies/TestBody'
responses:
"200":
content:
application/json:
schema:
type: bool
description: Successful Operation
summary: POST a test batch
tags:
- fake
components:
requestBodies:
TestBody:
content:
text/plain:
schema:
format: byte
type: string
description: Test body
required: true
UserArray:
content:
application/json:
Expand All @@ -914,6 +937,13 @@ components:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
required: true
responses:
SuccessfulOp:
content:
application/json:
schema:
type: bool
description: Successful Operation
schemas:
OrderInfo:
description: An order info for a pets from the pet store
Expand Down
15 changes: 15 additions & 0 deletions samples/server/petstore/go-api-server/go/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions samples/server/petstore/go-api-server/go/api_fake.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions samples/server/petstore/go-api-server/go/api_fake_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion samples/server/petstore/go-api-server/main.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ README.md
api/openapi.yaml
go.mod
go/api.go
go/api_fake.go
go/api_fake_service.go
go/api_pet.go
go/api_pet_service.go
go/api_store.go
Expand Down
30 changes: 30 additions & 0 deletions samples/server/petstore/go-chi-server/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,31 @@ paths:
summary: Get the pets by time
tags:
- pet
/fake/collection/test:
post:
operationId: fakePostTest
requestBody:
$ref: '#/components/requestBodies/TestBody'
responses:
"200":
content:
application/json:
schema:
type: bool
description: Successful Operation
summary: POST a test batch
tags:
- fake
components:
requestBodies:
TestBody:
content:
text/plain:
schema:
format: byte
type: string
description: Test body
required: true
UserArray:
content:
application/json:
Expand All @@ -914,6 +937,13 @@ components:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
required: true
responses:
SuccessfulOp:
content:
application/json:
schema:
type: bool
description: Successful Operation
schemas:
OrderInfo:
description: An order info for a pets from the pet store
Expand Down
15 changes: 15 additions & 0 deletions samples/server/petstore/go-chi-server/go/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4c73faf

Please sign in to comment.