Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement new field: x-go-type-import (#633)
* implement new field: x-go-type-import * implement getting of request bodies imports * implement getting of responses imports * refactoring: rename GetImportsFromSchema to GetImports * refactoring: add error wrapping * update README * fix: generate import only if define x-go-type and x-go-type-import * fix: bug of import generation * fix: remove useless checking * docs: add description for 'name' field * test: add tests for x-go-type-import into codegen_test * docs: fix README.md * refactor: fix error msg * refactor: use existing importMap type * refactor: fix error msg Co-authored-by: Vladimir Stepanov <v.stepanov@redmadrobot.com>
- Loading branch information
1 parent
86d0620
commit 2cf7fcf
Showing
6 changed files
with
316 additions
and
9 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
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,47 @@ | ||
openapi: "3.0.0" | ||
info: | ||
version: 1.0.0 | ||
title: Swagger Petstore | ||
description: A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification | ||
termsOfService: http://swagger.io/terms/ | ||
contact: | ||
name: Swagger API Team | ||
email: apiteam@swagger.io | ||
url: http://swagger.io | ||
license: | ||
name: Apache 2.0 | ||
url: https://www.apache.org/licenses/LICENSE-2.0.html | ||
servers: | ||
- url: http://petstore.swagger.io/api | ||
paths: | ||
/pets/{id}: | ||
get: | ||
summary: Returns a pet by ID | ||
description: Returns a pet based on a single ID | ||
operationId: findPetByID | ||
parameters: | ||
- name: id | ||
in: path | ||
description: ID of pet to fetch | ||
required: true | ||
schema: | ||
type: integer | ||
format: int64 | ||
responses: | ||
'200': | ||
description: pet response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Pet' | ||
components: | ||
schemas: | ||
Pet: | ||
properties: | ||
age: | ||
x-go-type: myuuid.UUID | ||
x-go-type-import: | ||
path: github.com/google/uuid | ||
name: myuuid | ||
required: | ||
- age |
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
Oops, something went wrong.