Refactor default and example values in Java generators (#1045)

* fix default, example for java okhttp

* update java feign samples

* update samples, doc

* add new doc for dart-jaguar

* update model template

* update jaxrs spec model

* update resteasy sample

* update java samples
This commit is contained in:
William Cheng
2018-10-07 03:56:16 +08:00
committed by GitHub
parent a1d242595e
commit 999f472e4b
1233 changed files with 4917 additions and 4909 deletions

View File

@@ -18,7 +18,7 @@ public interface AnotherFakeApi extends ApiClient.Api {
/**
* To test special tags
* To test special tags and operation ID starting with number
* @param client client model (required)
* @param client client model (required)
* @return Client
*/
@RequestLine("PATCH /another-fake/dummy")

View File

@@ -25,7 +25,7 @@ public interface FakeApi extends ApiClient.Api {
/**
*
* Test serialization of outer boolean types
* @param body Input boolean as post body (optional)
* @param body Input boolean as post body (optional)
* @return Boolean
*/
@RequestLine("POST /fake/outer/boolean")
@@ -38,7 +38,7 @@ public interface FakeApi extends ApiClient.Api {
/**
*
* Test serialization of object with outer number type
* @param outerComposite Input composite as post body (optional)
* @param outerComposite Input composite as post body (optional)
* @return OuterComposite
*/
@RequestLine("POST /fake/outer/composite")
@@ -51,7 +51,7 @@ public interface FakeApi extends ApiClient.Api {
/**
*
* Test serialization of outer number types
* @param body Input number as post body (optional)
* @param body Input number as post body (optional)
* @return BigDecimal
*/
@RequestLine("POST /fake/outer/number")
@@ -64,7 +64,7 @@ public interface FakeApi extends ApiClient.Api {
/**
*
* Test serialization of outer string types
* @param body Input string as post body (optional)
* @param body Input string as post body (optional)
* @return String
*/
@RequestLine("POST /fake/outer/string")
@@ -77,7 +77,7 @@ public interface FakeApi extends ApiClient.Api {
/**
*
* For this test, the body for this request much reference a schema named `File`.
* @param fileSchemaTestClass (required)
* @param fileSchemaTestClass (required)
*/
@RequestLine("PUT /fake/body-with-file-schema")
@Headers({
@@ -89,8 +89,8 @@ public interface FakeApi extends ApiClient.Api {
/**
*
*
* @param query (required)
* @param user (required)
* @param query (required)
* @param user (required)
*/
@RequestLine("PUT /fake/body-with-query-params?query={query}")
@Headers({
@@ -135,7 +135,7 @@ public interface FakeApi extends ApiClient.Api {
/**
* To test \"client\" model
* To test \"client\" model
* @param client client model (required)
* @param client client model (required)
* @return Client
*/
@RequestLine("PATCH /fake")
@@ -148,20 +148,20 @@ public interface FakeApi extends ApiClient.Api {
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* @param number None (required)
* @param _double None (required)
* @param patternWithoutDelimiter None (required)
* @param _byte None (required)
* @param integer None (optional, default to null)
* @param int32 None (optional, default to null)
* @param int64 None (optional, default to null)
* @param _float None (optional, default to null)
* @param string None (optional, default to null)
* @param binary None (optional, default to null)
* @param date None (optional, default to null)
* @param dateTime None (optional, default to null)
* @param password None (optional, default to null)
* @param paramCallback None (optional, default to null)
* @param number None (required)
* @param _double None (required)
* @param patternWithoutDelimiter None (required)
* @param _byte None (required)
* @param integer None (optional)
* @param int32 None (optional)
* @param int64 None (optional)
* @param _float None (optional)
* @param string None (optional)
* @param binary None (optional)
* @param date None (optional)
* @param dateTime None (optional)
* @param password None (optional)
* @param paramCallback None (optional)
*/
@RequestLine("POST /fake")
@Headers({
@@ -173,14 +173,14 @@ public interface FakeApi extends ApiClient.Api {
/**
* To test enum parameters
* To test enum parameters
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @param enumFormStringArray Form parameter enum test (string array) (optional, default to $)
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
* @param enumQueryStringArray Query parameter enum test (string array) (optional)
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
* @param enumQueryInteger Query parameter enum test (double) (optional)
* @param enumQueryDouble Query parameter enum test (double) (optional)
* @param enumFormStringArray Form parameter enum test (string array) (optional)
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
*/
@RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}")
@Headers({
@@ -202,7 +202,7 @@ public interface FakeApi extends ApiClient.Api {
* building up this map in a fluent style.
* @param enumHeaderStringArray Header parameter enum test (string array) (optional)
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
* @param enumFormStringArray Form parameter enum test (string array) (optional, default to $)
* @param enumFormStringArray Form parameter enum test (string array) (optional)
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
* @param queryParams Map of query parameters as name-value pairs
* <p>The following elements may be specified in the query map:</p>
@@ -249,7 +249,7 @@ public interface FakeApi extends ApiClient.Api {
/**
* test inline additionalProperties
*
* @param requestBody request body (required)
* @param requestBody request body (required)
*/
@RequestLine("POST /fake/inline-additionalProperties")
@Headers({
@@ -261,8 +261,8 @@ public interface FakeApi extends ApiClient.Api {
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @param param field1 (required)
* @param param2 field2 (required)
*/
@RequestLine("GET /fake/jsonFormData")
@Headers({

View File

@@ -18,7 +18,7 @@ public interface FakeClassnameTags123Api extends ApiClient.Api {
/**
* To test class name in snake case
* To test class name in snake case
* @param client client model (required)
* @param client client model (required)
* @return Client
*/
@RequestLine("PATCH /fake_classname_test")

View File

@@ -20,7 +20,7 @@ public interface PetApi extends ApiClient.Api {
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store (required)
* @param pet Pet object that needs to be added to the store (required)
*/
@RequestLine("POST /pet")
@Headers({
@@ -32,8 +32,8 @@ public interface PetApi extends ApiClient.Api {
/**
* Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param petId Pet id to delete (required)
* @param apiKey (optional)
*/
@RequestLine("DELETE /pet/{petId}")
@Headers({
@@ -45,7 +45,7 @@ public interface PetApi extends ApiClient.Api {
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @param status Status values that need to be considered for filter (required)
* @return List&lt;Pet&gt;
*/
@RequestLine("GET /pet/findByStatus?status={status}")
@@ -89,7 +89,7 @@ public interface PetApi extends ApiClient.Api {
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @param tags Tags to filter by (required)
* @return List&lt;Pet&gt;
*/
@RequestLine("GET /pet/findByTags?tags={tags}")
@@ -133,7 +133,7 @@ public interface PetApi extends ApiClient.Api {
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return (required)
* @param petId ID of pet to return (required)
* @return Pet
*/
@RequestLine("GET /pet/{petId}")
@@ -145,7 +145,7 @@ public interface PetApi extends ApiClient.Api {
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store (required)
* @param pet Pet object that needs to be added to the store (required)
*/
@RequestLine("PUT /pet")
@Headers({
@@ -157,9 +157,9 @@ public interface PetApi extends ApiClient.Api {
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional, default to null)
* @param status Updated status of the pet (optional, default to null)
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
*/
@RequestLine("POST /pet/{petId}")
@Headers({
@@ -171,9 +171,9 @@ public interface PetApi extends ApiClient.Api {
/**
* uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional, default to null)
* @param file file to upload (optional, default to null)
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ModelApiResponse
*/
@RequestLine("POST /pet/{petId}/uploadImage")
@@ -186,9 +186,9 @@ public interface PetApi extends ApiClient.Api {
/**
* uploads an image (required)
*
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional, default to null)
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @return ModelApiResponse
*/
@RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile")

View File

@@ -18,7 +18,7 @@ public interface StoreApi extends ApiClient.Api {
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param orderId ID of the order that needs to be deleted (required)
*/
@RequestLine("DELETE /store/order/{orderId}")
@Headers({
@@ -40,7 +40,7 @@ public interface StoreApi extends ApiClient.Api {
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param orderId ID of pet that needs to be fetched (required)
* @return Order
*/
@RequestLine("GET /store/order/{orderId}")
@@ -52,7 +52,7 @@ public interface StoreApi extends ApiClient.Api {
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param order order placed for purchasing the pet (required)
* @return Order
*/
@RequestLine("POST /store/order")

View File

@@ -18,7 +18,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param user Created user object (required)
*/
@RequestLine("POST /user")
@Headers({
@@ -30,7 +30,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param user List of user object (required)
*/
@RequestLine("POST /user/createWithArray")
@Headers({
@@ -42,7 +42,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param user List of user object (required)
*/
@RequestLine("POST /user/createWithList")
@Headers({
@@ -54,7 +54,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param username The name that needs to be deleted (required)
*/
@RequestLine("DELETE /user/{username}")
@Headers({
@@ -65,7 +65,7 @@ public interface UserApi extends ApiClient.Api {
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return User
*/
@RequestLine("GET /user/{username}")
@@ -77,8 +77,8 @@ public interface UserApi extends ApiClient.Api {
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return String
*/
@RequestLine("GET /user/login?username={username}&password={password}")
@@ -137,8 +137,8 @@ public interface UserApi extends ApiClient.Api {
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
*/
@RequestLine("PUT /user/{username}")
@Headers({

View File

@@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty;
public class Animal {
@JsonProperty("className")
private String className = null;
private String className;
@JsonProperty("color")
private String color = "red";

View File

@@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty;
public class Capitalization {
@JsonProperty("smallCamel")
private String smallCamel = null;
private String smallCamel;
@JsonProperty("CapitalCamel")
private String capitalCamel = null;
private String capitalCamel;
@JsonProperty("small_Snake")
private String smallSnake = null;
private String smallSnake;
@JsonProperty("Capital_Snake")
private String capitalSnake = null;
private String capitalSnake;
@JsonProperty("SCA_ETH_Flow_Points")
private String scAETHFlowPoints = null;
private String scAETHFlowPoints;
@JsonProperty("ATT_NAME")
private String ATT_NAME = null;
private String ATT_NAME;
public Capitalization smallCamel(String smallCamel) {
this.smallCamel = smallCamel;

View File

@@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal;
public class Cat extends Animal {
@JsonProperty("declawed")
private Boolean declawed = null;
private Boolean declawed;
public Cat declawed(Boolean declawed) {
this.declawed = declawed;

View File

@@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty;
public class Category {
@JsonProperty("id")
private Long id = null;
private Long id;
@JsonProperty("name")
private String name = null;
private String name;
public Category id(Long id) {
this.id = id;

View File

@@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty;
public class ClassModel {
@JsonProperty("_class")
private String propertyClass = null;
private String propertyClass;
public ClassModel propertyClass(String propertyClass) {
this.propertyClass = propertyClass;

View File

@@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty;
public class Client {
@JsonProperty("client")
private String client = null;
private String client;
public Client client(String client) {
this.client = client;

View File

@@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal;
public class Dog extends Animal {
@JsonProperty("breed")
private String breed = null;
private String breed;
public Dog breed(String breed) {
this.breed = breed;

View File

@@ -64,7 +64,7 @@ public class EnumArrays {
}
@JsonProperty("just_symbol")
private JustSymbolEnum justSymbol = null;
private JustSymbolEnum justSymbol;
/**
* Gets or Sets arrayEnum

View File

@@ -65,7 +65,7 @@ public class EnumTest {
}
@JsonProperty("enum_string")
private EnumStringEnum enumString = null;
private EnumStringEnum enumString;
/**
* Gets or Sets enumStringRequired
@@ -105,7 +105,7 @@ public class EnumTest {
}
@JsonProperty("enum_string_required")
private EnumStringRequiredEnum enumStringRequired = null;
private EnumStringRequiredEnum enumStringRequired;
/**
* Gets or Sets enumInteger
@@ -143,7 +143,7 @@ public class EnumTest {
}
@JsonProperty("enum_integer")
private EnumIntegerEnum enumInteger = null;
private EnumIntegerEnum enumInteger;
/**
* Gets or Sets enumNumber
@@ -181,7 +181,7 @@ public class EnumTest {
}
@JsonProperty("enum_number")
private EnumNumberEnum enumNumber = null;
private EnumNumberEnum enumNumber;
@JsonProperty("outerEnum")
private OuterEnum outerEnum = null;

View File

@@ -32,43 +32,43 @@ import org.threeten.bp.OffsetDateTime;
public class FormatTest {
@JsonProperty("integer")
private Integer integer = null;
private Integer integer;
@JsonProperty("int32")
private Integer int32 = null;
private Integer int32;
@JsonProperty("int64")
private Long int64 = null;
private Long int64;
@JsonProperty("number")
private BigDecimal number = null;
private BigDecimal number;
@JsonProperty("float")
private Float _float = null;
private Float _float;
@JsonProperty("double")
private Double _double = null;
private Double _double;
@JsonProperty("string")
private String string = null;
private String string;
@JsonProperty("byte")
private byte[] _byte = null;
private byte[] _byte;
@JsonProperty("binary")
private File binary = null;
private File binary;
@JsonProperty("date")
private LocalDate date = null;
private LocalDate date;
@JsonProperty("dateTime")
private OffsetDateTime dateTime = null;
private OffsetDateTime dateTime;
@JsonProperty("uuid")
private UUID uuid = null;
private UUID uuid;
@JsonProperty("password")
private String password = null;
private String password;
public FormatTest integer(Integer integer) {
this.integer = integer;

View File

@@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty;
public class HasOnlyReadOnly {
@JsonProperty("bar")
private String bar = null;
private String bar;
@JsonProperty("foo")
private String foo = null;
private String foo;
/**
* Get bar

View File

@@ -33,10 +33,10 @@ import org.threeten.bp.OffsetDateTime;
public class MixedPropertiesAndAdditionalPropertiesClass {
@JsonProperty("uuid")
private UUID uuid = null;
private UUID uuid;
@JsonProperty("dateTime")
private OffsetDateTime dateTime = null;
private OffsetDateTime dateTime;
@JsonProperty("map")
private Map<String, Animal> map = null;

View File

@@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty;
public class Model200Response {
@JsonProperty("name")
private Integer name = null;
private Integer name;
@JsonProperty("class")
private String propertyClass = null;
private String propertyClass;
public Model200Response name(Integer name) {
this.name = name;

View File

@@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty;
public class ModelApiResponse {
@JsonProperty("code")
private Integer code = null;
private Integer code;
@JsonProperty("type")
private String type = null;
private String type;
@JsonProperty("message")
private String message = null;
private String message;
public ModelApiResponse code(Integer code) {
this.code = code;

View File

@@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty;
public class ModelReturn {
@JsonProperty("return")
private Integer _return = null;
private Integer _return;
public ModelReturn _return(Integer _return) {
this._return = _return;

View File

@@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty;
public class Name {
@JsonProperty("name")
private Integer name = null;
private Integer name;
@JsonProperty("snake_case")
private Integer snakeCase = null;
private Integer snakeCase;
@JsonProperty("property")
private String property = null;
private String property;
@JsonProperty("123Number")
private Integer _123number = null;
private Integer _123number;
public Name name(Integer name) {
this.name = name;

View File

@@ -28,7 +28,7 @@ import java.math.BigDecimal;
public class NumberOnly {
@JsonProperty("JustNumber")
private BigDecimal justNumber = null;
private BigDecimal justNumber;
public NumberOnly justNumber(BigDecimal justNumber) {
this.justNumber = justNumber;

View File

@@ -28,16 +28,16 @@ import org.threeten.bp.OffsetDateTime;
public class Order {
@JsonProperty("id")
private Long id = null;
private Long id;
@JsonProperty("petId")
private Long petId = null;
private Long petId;
@JsonProperty("quantity")
private Integer quantity = null;
private Integer quantity;
@JsonProperty("shipDate")
private OffsetDateTime shipDate = null;
private OffsetDateTime shipDate;
/**
* Order Status
@@ -77,7 +77,7 @@ public class Order {
}
@JsonProperty("status")
private StatusEnum status = null;
private StatusEnum status;
@JsonProperty("complete")
private Boolean complete = false;

View File

@@ -28,13 +28,13 @@ import java.math.BigDecimal;
public class OuterComposite {
@JsonProperty("my_number")
private BigDecimal myNumber = null;
private BigDecimal myNumber;
@JsonProperty("my_string")
private String myString = null;
private String myString;
@JsonProperty("my_boolean")
private Boolean myBoolean = null;
private Boolean myBoolean;
public OuterComposite myNumber(BigDecimal myNumber) {
this.myNumber = myNumber;

View File

@@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag;
public class Pet {
@JsonProperty("id")
private Long id = null;
private Long id;
@JsonProperty("category")
private Category category = null;
@JsonProperty("name")
private String name = null;
private String name;
@JsonProperty("photoUrls")
private List<String> photoUrls = new ArrayList<String>();
@@ -83,7 +83,7 @@ public class Pet {
}
@JsonProperty("status")
private StatusEnum status = null;
private StatusEnum status;
public Pet id(Long id) {
this.id = id;

View File

@@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty;
public class ReadOnlyFirst {
@JsonProperty("bar")
private String bar = null;
private String bar;
@JsonProperty("baz")
private String baz = null;
private String baz;
/**
* Get bar

View File

@@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty;
public class SpecialModelName {
@JsonProperty("$special[property.name]")
private Long $specialPropertyName = null;
private Long $specialPropertyName;
public SpecialModelName $specialPropertyName(Long $specialPropertyName) {
this.$specialPropertyName = $specialPropertyName;

View File

@@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty;
public class Tag {
@JsonProperty("id")
private Long id = null;
private Long id;
@JsonProperty("name")
private String name = null;
private String name;
public Tag id(Long id) {
this.id = id;

View File

@@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty;
public class User {
@JsonProperty("id")
private Long id = null;
private Long id;
@JsonProperty("username")
private String username = null;
private String username;
@JsonProperty("firstName")
private String firstName = null;
private String firstName;
@JsonProperty("lastName")
private String lastName = null;
private String lastName;
@JsonProperty("email")
private String email = null;
private String email;
@JsonProperty("password")
private String password = null;
private String password;
@JsonProperty("phone")
private String phone = null;
private String phone;
@JsonProperty("userStatus")
private Integer userStatus = null;
private Integer userStatus;
public User id(Long id) {
this.id = id;