-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10563 from swagger-api/enum-values-issue
Enum values issue
- Loading branch information
Showing
369 changed files
with
7,653 additions
and
423 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
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
46 changes: 46 additions & 0 deletions
46
modules/swagger-codegen/src/test/resources/2_0/issue-10546.yaml
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,46 @@ | ||
swagger: '2.0' | ||
info: | ||
description: Demo | ||
version: 1.0.0 | ||
title: Demo for Boolean-element Bug | ||
schemes: | ||
- https | ||
consumes: | ||
- application/json | ||
produces: | ||
- application/json | ||
paths: | ||
/types: | ||
get: | ||
produces: | ||
- application/json | ||
responses: | ||
200: | ||
description: OK | ||
definitions: | ||
Boolean: | ||
type: boolean | ||
description: True or False indicator | ||
enum: | ||
- true | ||
- false | ||
Interos: | ||
type: integer | ||
format: int32 | ||
description: True or False indicator | ||
enum: | ||
- 0 | ||
- 1 | ||
- 2 | ||
- 3 | ||
- 4 | ||
- 5 | ||
- 6 | ||
Numeros: | ||
type: number | ||
description: some number | ||
enum: | ||
- 7 | ||
- 8 | ||
- 9 | ||
- 10 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
2.4.8-SNAPSHOT | ||
2.4.18-SNAPSHOT |
68 changes: 68 additions & 0 deletions
68
samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/Ints.java
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,68 @@ | ||
/* | ||
* Swagger Petstore | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: apiteam@swagger.io | ||
* | ||
* NOTE: This class is auto generated by the swagger code generator program. | ||
* https://github.com/swagger-api/swagger-codegen.git | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
package io.swagger.client.model; | ||
|
||
import java.util.Objects; | ||
import java.util.Arrays; | ||
import io.swagger.annotations.ApiModel; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
/** | ||
* True or False indicator | ||
*/ | ||
public enum Ints { | ||
|
||
NUMBER_0(0), | ||
|
||
NUMBER_1(1), | ||
|
||
NUMBER_2(2), | ||
|
||
NUMBER_3(3), | ||
|
||
NUMBER_4(4), | ||
|
||
NUMBER_5(5), | ||
|
||
NUMBER_6(6); | ||
|
||
private Integer value; | ||
|
||
Ints(Integer value) { | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public Integer getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.valueOf(value); | ||
} | ||
|
||
@JsonCreator | ||
public static Ints fromValue(String text) { | ||
for (Ints b : Ints.values()) { | ||
if (String.valueOf(b.value).equals(text)) { | ||
return b; | ||
} | ||
} | ||
return null; | ||
} | ||
} | ||
|
58 changes: 58 additions & 0 deletions
58
samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/ModelBoolean.java
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,58 @@ | ||
/* | ||
* Swagger Petstore | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: apiteam@swagger.io | ||
* | ||
* NOTE: This class is auto generated by the swagger code generator program. | ||
* https://github.com/swagger-api/swagger-codegen.git | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
package io.swagger.client.model; | ||
|
||
import java.util.Objects; | ||
import java.util.Arrays; | ||
import io.swagger.annotations.ApiModel; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
/** | ||
* True or False indicator | ||
*/ | ||
public enum ModelBoolean { | ||
|
||
TRUE(true), | ||
|
||
FALSE(false); | ||
|
||
private Boolean value; | ||
|
||
ModelBoolean(Boolean value) { | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public Boolean getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.valueOf(value); | ||
} | ||
|
||
@JsonCreator | ||
public static ModelBoolean fromValue(String text) { | ||
for (ModelBoolean b : ModelBoolean.values()) { | ||
if (String.valueOf(b.value).equals(text)) { | ||
return b; | ||
} | ||
} | ||
return null; | ||
} | ||
} | ||
|
Oops, something went wrong.