Add new option allArgConstructor for java client, spring generators (#18538)

* allArgConstructor for java

* Remove leftover from builder pattern branch

* Rename generateConstructorWithAllArgs and use x- in vendorExtensions

* Test issue #18340

* Add evidences for allVars issue (#18340)

* remove eol

* update doc

---------

Co-authored-by: jpfinne <jeanpaul@finne.be>
This commit is contained in:
William Cheng
2024-05-01 18:10:35 +08:00
committed by GitHub
parent 98d026118c
commit 2a1b4f90df
565 changed files with 1715 additions and 1869 deletions

View File

@@ -95,7 +95,6 @@ public class AdditionalPropertiesClass {
this.mapProperty = mapProperty;
}
public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
this.mapOfMapProperty = mapOfMapProperty;

View File

@@ -78,7 +78,6 @@ public class AllOfWithSingleRef {
this.username = username;
}
public AllOfWithSingleRef singleRefType(SingleRefType singleRefType) {
this.singleRefType = singleRefType;

View File

@@ -58,7 +58,7 @@ public class Animal {
public static final String JSON_PROPERTY_COLOR = "color";
@XmlElement(name = "color")
private String color = "red";
protected String color = "red";
public Animal() {
}
@@ -90,7 +90,6 @@ public class Animal {
this.className = className;
}
public Animal color(String color) {
this.color = color;

View File

@@ -105,7 +105,6 @@ public class ArrayTest {
this.arrayOfString = arrayOfString;
}
public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
this.arrayArrayOfInteger = arrayArrayOfInteger;
@@ -143,7 +142,6 @@ public class ArrayTest {
this.arrayArrayOfInteger = arrayArrayOfInteger;
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;

View File

@@ -97,7 +97,6 @@ public class Capitalization {
this.smallCamel = smallCamel;
}
public Capitalization capitalCamel(String capitalCamel) {
this.capitalCamel = capitalCamel;
@@ -125,7 +124,6 @@ public class Capitalization {
this.capitalCamel = capitalCamel;
}
public Capitalization smallSnake(String smallSnake) {
this.smallSnake = smallSnake;
@@ -153,7 +151,6 @@ public class Capitalization {
this.smallSnake = smallSnake;
}
public Capitalization capitalSnake(String capitalSnake) {
this.capitalSnake = capitalSnake;
@@ -181,7 +178,6 @@ public class Capitalization {
this.capitalSnake = capitalSnake;
}
public Capitalization scAETHFlowPoints(String scAETHFlowPoints) {
this.scAETHFlowPoints = scAETHFlowPoints;
@@ -209,7 +205,6 @@ public class Capitalization {
this.scAETHFlowPoints = scAETHFlowPoints;
}
public Capitalization ATT_NAME(String ATT_NAME) {
this.ATT_NAME = ATT_NAME;

View File

@@ -77,7 +77,6 @@ public class Category {
this.id = id;
}
public Category name(String name) {
this.name = name;

View File

@@ -161,7 +161,6 @@ public class EnumArrays {
this.justSymbol = justSymbol;
}
public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) {
this.arrayEnum = arrayEnum;

View File

@@ -278,7 +278,6 @@ public class EnumTest {
this.enumString = enumString;
}
public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) {
this.enumStringRequired = enumStringRequired;
@@ -306,7 +305,6 @@ public class EnumTest {
this.enumStringRequired = enumStringRequired;
}
public EnumTest enumInteger(EnumIntegerEnum enumInteger) {
this.enumInteger = enumInteger;
@@ -334,7 +332,6 @@ public class EnumTest {
this.enumInteger = enumInteger;
}
public EnumTest enumNumber(EnumNumberEnum enumNumber) {
this.enumNumber = enumNumber;
@@ -362,7 +359,6 @@ public class EnumTest {
this.enumNumber = enumNumber;
}
public EnumTest outerEnum(OuterEnum outerEnum) {
this.outerEnum = JsonNullable.<OuterEnum>of(outerEnum);
@@ -397,7 +393,6 @@ public class EnumTest {
this.outerEnum = JsonNullable.<OuterEnum>of(outerEnum);
}
public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) {
this.outerEnumInteger = outerEnumInteger;
@@ -425,7 +420,6 @@ public class EnumTest {
this.outerEnumInteger = outerEnumInteger;
}
public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) {
this.outerEnumDefaultValue = outerEnumDefaultValue;
@@ -453,7 +447,6 @@ public class EnumTest {
this.outerEnumDefaultValue = outerEnumDefaultValue;
}
public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) {
this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue;

View File

@@ -84,7 +84,6 @@ public class FakeBigDecimalMap200Response {
this.someId = someId;
}
public FakeBigDecimalMap200Response someMap(Map<String, BigDecimal> someMap) {
this.someMap = someMap;

View File

@@ -84,7 +84,6 @@ public class FileSchemaTestClass {
this._file = _file;
}
public FileSchemaTestClass files(List<ModelFile> files) {
this.files = files;

View File

@@ -156,7 +156,6 @@ public class FormatTest {
this.integer = integer;
}
public FormatTest int32(Integer int32) {
this.int32 = int32;
@@ -186,7 +185,6 @@ public class FormatTest {
this.int32 = int32;
}
public FormatTest int64(Long int64) {
this.int64 = int64;
@@ -214,7 +212,6 @@ public class FormatTest {
this.int64 = int64;
}
public FormatTest number(BigDecimal number) {
this.number = number;
@@ -244,7 +241,6 @@ public class FormatTest {
this.number = number;
}
public FormatTest _float(Float _float) {
this._float = _float;
@@ -274,7 +270,6 @@ public class FormatTest {
this._float = _float;
}
public FormatTest _double(Double _double) {
this._double = _double;
@@ -304,7 +299,6 @@ public class FormatTest {
this._double = _double;
}
public FormatTest decimal(BigDecimal decimal) {
this.decimal = decimal;
@@ -332,7 +326,6 @@ public class FormatTest {
this.decimal = decimal;
}
public FormatTest string(String string) {
this.string = string;
@@ -360,7 +353,6 @@ public class FormatTest {
this.string = string;
}
public FormatTest _byte(byte[] _byte) {
this._byte = _byte;
@@ -388,7 +380,6 @@ public class FormatTest {
this._byte = _byte;
}
public FormatTest binary(File binary) {
this.binary = binary;
@@ -416,7 +407,6 @@ public class FormatTest {
this.binary = binary;
}
public FormatTest date(LocalDate date) {
this.date = date;
@@ -444,7 +434,6 @@ public class FormatTest {
this.date = date;
}
public FormatTest dateTime(OffsetDateTime dateTime) {
this.dateTime = dateTime;
@@ -472,7 +461,6 @@ public class FormatTest {
this.dateTime = dateTime;
}
public FormatTest uuid(UUID uuid) {
this.uuid = uuid;
@@ -500,7 +488,6 @@ public class FormatTest {
this.uuid = uuid;
}
public FormatTest password(String password) {
this.password = password;
@@ -528,7 +515,6 @@ public class FormatTest {
this.password = password;
}
public FormatTest patternWithDigits(String patternWithDigits) {
this.patternWithDigits = patternWithDigits;
@@ -556,7 +542,6 @@ public class FormatTest {
this.patternWithDigits = patternWithDigits;
}
public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) {
this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter;

View File

@@ -66,7 +66,6 @@ public class HasOnlyReadOnly {
/**
* Get foo
* @return foo

View File

@@ -150,7 +150,6 @@ public class MapTest {
this.mapMapOfString = mapMapOfString;
}
public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) {
this.mapOfEnumString = mapOfEnumString;
@@ -188,7 +187,6 @@ public class MapTest {
this.mapOfEnumString = mapOfEnumString;
}
public MapTest directMap(Map<String, Boolean> directMap) {
this.directMap = directMap;
@@ -226,7 +224,6 @@ public class MapTest {
this.directMap = directMap;
}
public MapTest indirectMap(Map<String, Boolean> indirectMap) {
this.indirectMap = indirectMap;

View File

@@ -91,7 +91,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
this.uuid = uuid;
}
public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) {
this.dateTime = dateTime;
@@ -119,7 +118,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
this.dateTime = dateTime;
}
public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map) {
this.map = map;

View File

@@ -78,7 +78,6 @@ public class Model200Response {
this.name = name;
}
public Model200Response propertyClass(String propertyClass) {
this.propertyClass = propertyClass;

View File

@@ -83,7 +83,6 @@ public class ModelApiResponse {
this.code = code;
}
public ModelApiResponse type(String type) {
this.type = type;
@@ -111,7 +110,6 @@ public class ModelApiResponse {
this.type = type;
}
public ModelApiResponse message(String message) {
this.message = message;

View File

@@ -87,7 +87,6 @@ public class Name {
this.name = name;
}
/**
* Get snakeCase
* @return snakeCase
@@ -103,7 +102,6 @@ public class Name {
public Name property(String property) {
this.property = property;
@@ -131,7 +129,6 @@ public class Name {
this.property = property;
}
/**
* Get _123number
* @return _123number

View File

@@ -166,7 +166,6 @@ public class NullableClass extends HashMap<String, Object> {
this.integerProp = JsonNullable.<Integer>of(integerProp);
}
public NullableClass numberProp(BigDecimal numberProp) {
this.numberProp = JsonNullable.<BigDecimal>of(numberProp);
@@ -201,7 +200,6 @@ public class NullableClass extends HashMap<String, Object> {
this.numberProp = JsonNullable.<BigDecimal>of(numberProp);
}
public NullableClass booleanProp(Boolean booleanProp) {
this.booleanProp = JsonNullable.<Boolean>of(booleanProp);
@@ -236,7 +234,6 @@ public class NullableClass extends HashMap<String, Object> {
this.booleanProp = JsonNullable.<Boolean>of(booleanProp);
}
public NullableClass stringProp(String stringProp) {
this.stringProp = JsonNullable.<String>of(stringProp);
@@ -271,7 +268,6 @@ public class NullableClass extends HashMap<String, Object> {
this.stringProp = JsonNullable.<String>of(stringProp);
}
public NullableClass dateProp(LocalDate dateProp) {
this.dateProp = JsonNullable.<LocalDate>of(dateProp);
@@ -306,7 +302,6 @@ public class NullableClass extends HashMap<String, Object> {
this.dateProp = JsonNullable.<LocalDate>of(dateProp);
}
public NullableClass datetimeProp(OffsetDateTime datetimeProp) {
this.datetimeProp = JsonNullable.<OffsetDateTime>of(datetimeProp);
@@ -341,7 +336,6 @@ public class NullableClass extends HashMap<String, Object> {
this.datetimeProp = JsonNullable.<OffsetDateTime>of(datetimeProp);
}
public NullableClass arrayNullableProp(List<Object> arrayNullableProp) {
this.arrayNullableProp = JsonNullable.<List<Object>>of(arrayNullableProp);
@@ -389,7 +383,6 @@ public class NullableClass extends HashMap<String, Object> {
this.arrayNullableProp = JsonNullable.<List<Object>>of(arrayNullableProp);
}
public NullableClass arrayAndItemsNullableProp(List<Object> arrayAndItemsNullableProp) {
this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(arrayAndItemsNullableProp);
@@ -437,7 +430,6 @@ public class NullableClass extends HashMap<String, Object> {
this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(arrayAndItemsNullableProp);
}
public NullableClass arrayItemsNullable(List<Object> arrayItemsNullable) {
this.arrayItemsNullable = arrayItemsNullable;
@@ -475,7 +467,6 @@ public class NullableClass extends HashMap<String, Object> {
this.arrayItemsNullable = arrayItemsNullable;
}
public NullableClass objectNullableProp(Map<String, Object> objectNullableProp) {
this.objectNullableProp = JsonNullable.<Map<String, Object>>of(objectNullableProp);
@@ -523,7 +514,6 @@ public class NullableClass extends HashMap<String, Object> {
this.objectNullableProp = JsonNullable.<Map<String, Object>>of(objectNullableProp);
}
public NullableClass objectAndItemsNullableProp(Map<String, Object> objectAndItemsNullableProp) {
this.objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp);
@@ -571,7 +561,6 @@ public class NullableClass extends HashMap<String, Object> {
this.objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp);
}
public NullableClass objectItemsNullable(Map<String, Object> objectItemsNullable) {
this.objectItemsNullable = objectItemsNullable;

View File

@@ -95,7 +95,6 @@ public class ObjectWithDeprecatedFields {
this.uuid = uuid;
}
public ObjectWithDeprecatedFields id(BigDecimal id) {
this.id = id;
@@ -125,7 +124,6 @@ public class ObjectWithDeprecatedFields {
this.id = id;
}
public ObjectWithDeprecatedFields deprecatedRef(DeprecatedObject deprecatedRef) {
this.deprecatedRef = deprecatedRef;
@@ -155,7 +153,6 @@ public class ObjectWithDeprecatedFields {
this.deprecatedRef = deprecatedRef;
}
public ObjectWithDeprecatedFields bars(List<String> bars) {
this.bars = bars;

View File

@@ -141,7 +141,6 @@ public class Order {
this.id = id;
}
public Order petId(Long petId) {
this.petId = petId;
@@ -169,7 +168,6 @@ public class Order {
this.petId = petId;
}
public Order quantity(Integer quantity) {
this.quantity = quantity;
@@ -197,7 +195,6 @@ public class Order {
this.quantity = quantity;
}
public Order shipDate(OffsetDateTime shipDate) {
this.shipDate = shipDate;
@@ -225,7 +222,6 @@ public class Order {
this.shipDate = shipDate;
}
public Order status(StatusEnum status) {
this.status = status;
@@ -253,7 +249,6 @@ public class Order {
this.status = status;
}
public Order complete(Boolean complete) {
this.complete = complete;

View File

@@ -83,7 +83,6 @@ public class OuterComposite {
this.myNumber = myNumber;
}
public OuterComposite myString(String myString) {
this.myString = myString;
@@ -111,7 +110,6 @@ public class OuterComposite {
this.myString = myString;
}
public OuterComposite myBoolean(Boolean myBoolean) {
this.myBoolean = myBoolean;

View File

@@ -97,7 +97,7 @@ public class ParentWithNullable {
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
@XmlElement(name = "nullableProperty")
private JsonNullable<String> nullableProperty = JsonNullable.<String>undefined();
protected JsonNullable<String> nullableProperty = JsonNullable.<String>undefined();
public ParentWithNullable() {
}
@@ -129,7 +129,6 @@ public class ParentWithNullable {
this.type = type;
}
public ParentWithNullable nullableProperty(String nullableProperty) {
this.nullableProperty = JsonNullable.<String>of(nullableProperty);

View File

@@ -155,7 +155,6 @@ public class Pet {
this.id = id;
}
public Pet category(Category category) {
this.category = category;
@@ -183,7 +182,6 @@ public class Pet {
this.category = category;
}
public Pet name(String name) {
this.name = name;
@@ -211,7 +209,6 @@ public class Pet {
this.name = name;
}
public Pet photoUrls(Set<String> photoUrls) {
this.photoUrls = photoUrls;
@@ -252,7 +249,6 @@ public class Pet {
this.photoUrls = photoUrls;
}
public Pet tags(List<Tag> tags) {
this.tags = tags;
@@ -292,7 +288,6 @@ public class Pet {
this.tags = tags;
}
public Pet status(StatusEnum status) {
this.status = status;

View File

@@ -65,7 +65,6 @@ public class ReadOnlyFirst {
public ReadOnlyFirst baz(String baz) {
this.baz = baz;

View File

@@ -77,7 +77,6 @@ public class Tag {
this.id = id;
}
public Tag name(String name) {
this.name = name;

View File

@@ -107,7 +107,6 @@ public class User {
this.id = id;
}
public User username(String username) {
this.username = username;
@@ -135,7 +134,6 @@ public class User {
this.username = username;
}
public User firstName(String firstName) {
this.firstName = firstName;
@@ -163,7 +161,6 @@ public class User {
this.firstName = firstName;
}
public User lastName(String lastName) {
this.lastName = lastName;
@@ -191,7 +188,6 @@ public class User {
this.lastName = lastName;
}
public User email(String email) {
this.email = email;
@@ -219,7 +215,6 @@ public class User {
this.email = email;
}
public User password(String password) {
this.password = password;
@@ -247,7 +242,6 @@ public class User {
this.password = password;
}
public User phone(String phone) {
this.phone = phone;
@@ -275,7 +269,6 @@ public class User {
this.phone = phone;
}
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;