forked from deepmap/oapi-codegen
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix schema shadowing issue by enums (deepmap#833)
This fixes deepmap#832 by creating errors upon type conflict, and allowing renaming enum types via `x-go-name`. Co-authored-by: marcinromaszewicz <marcinromaszewicz@deepmap.ai>
- Loading branch information
1 parent
80a2aca
commit 3bd0507
Showing
6 changed files
with
193 additions
and
8 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,5 @@ | ||
package: issue_832 | ||
generate: | ||
models: true | ||
embedded-spec: true | ||
output: issue.gen.go |
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,3 @@ | ||
package issue_832 | ||
|
||
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --config=config.yaml spec.yaml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,43 @@ | ||
openapi: 3.0.2 | ||
info: | ||
version: '0.0.1' | ||
title: example | ||
description: | | ||
Make sure that recursive types are handled properly | ||
paths: | ||
/example: | ||
get: | ||
operationId: exampleGet | ||
responses: | ||
'200': | ||
description: "OK" | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/Document' | ||
/example2: | ||
get: | ||
operationId: exampleGet2 | ||
responses: | ||
'200': | ||
description: "OK" | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/DocumentStatus' | ||
components: | ||
schemas: | ||
Document: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
status: | ||
type: string | ||
x-go-name: Document_Status | ||
enum: [one, two, three, four] | ||
DocumentStatus: | ||
type: object | ||
properties: | ||
value: | ||
type: string |
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