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

@@ -114,7 +114,6 @@ public class AdditionalPropertiesClass {
this.mapString = mapString;
}
public AdditionalPropertiesClass mapNumber(Map<String, BigDecimal> mapNumber) {
this.mapNumber = mapNumber;
@@ -148,7 +147,6 @@ public class AdditionalPropertiesClass {
this.mapNumber = mapNumber;
}
public AdditionalPropertiesClass mapInteger(Map<String, Integer> mapInteger) {
this.mapInteger = mapInteger;
@@ -182,7 +180,6 @@ public class AdditionalPropertiesClass {
this.mapInteger = mapInteger;
}
public AdditionalPropertiesClass mapBoolean(Map<String, Boolean> mapBoolean) {
this.mapBoolean = mapBoolean;
@@ -216,7 +213,6 @@ public class AdditionalPropertiesClass {
this.mapBoolean = mapBoolean;
}
public AdditionalPropertiesClass mapArrayInteger(Map<String, List<Integer>> mapArrayInteger) {
this.mapArrayInteger = mapArrayInteger;
@@ -250,7 +246,6 @@ public class AdditionalPropertiesClass {
this.mapArrayInteger = mapArrayInteger;
}
public AdditionalPropertiesClass mapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) {
this.mapArrayAnytype = mapArrayAnytype;
@@ -284,7 +279,6 @@ public class AdditionalPropertiesClass {
this.mapArrayAnytype = mapArrayAnytype;
}
public AdditionalPropertiesClass mapMapString(Map<String, Map<String, String>> mapMapString) {
this.mapMapString = mapMapString;
@@ -318,7 +312,6 @@ public class AdditionalPropertiesClass {
this.mapMapString = mapMapString;
}
public AdditionalPropertiesClass mapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) {
this.mapMapAnytype = mapMapAnytype;
@@ -352,7 +345,6 @@ public class AdditionalPropertiesClass {
this.mapMapAnytype = mapMapAnytype;
}
public AdditionalPropertiesClass anytype1(Object anytype1) {
this.anytype1 = anytype1;
@@ -378,7 +370,6 @@ public class AdditionalPropertiesClass {
this.anytype1 = anytype1;
}
public AdditionalPropertiesClass anytype2(Object anytype2) {
this.anytype2 = anytype2;
@@ -404,7 +395,6 @@ public class AdditionalPropertiesClass {
this.anytype2 = anytype2;
}
public AdditionalPropertiesClass anytype3(Object anytype3) {
this.anytype3 = anytype3;

View File

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

View File

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

View File

@@ -82,7 +82,6 @@ public class Capitalization {
this.smallCamel = smallCamel;
}
public Capitalization capitalCamel(String capitalCamel) {
this.capitalCamel = capitalCamel;
@@ -108,7 +107,6 @@ public class Capitalization {
this.capitalCamel = capitalCamel;
}
public Capitalization smallSnake(String smallSnake) {
this.smallSnake = smallSnake;
@@ -134,7 +132,6 @@ public class Capitalization {
this.smallSnake = smallSnake;
}
public Capitalization capitalSnake(String capitalSnake) {
this.capitalSnake = capitalSnake;
@@ -160,7 +157,6 @@ public class Capitalization {
this.capitalSnake = capitalSnake;
}
public Capitalization scAETHFlowPoints(String scAETHFlowPoints) {
this.scAETHFlowPoints = scAETHFlowPoints;
@@ -186,7 +182,6 @@ public class Capitalization {
this.scAETHFlowPoints = scAETHFlowPoints;
}
public Capitalization ATT_NAME(String ATT_NAME) {
this.ATT_NAME = ATT_NAME;

View File

@@ -45,7 +45,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
public class Cat extends Animal {
public static final String JSON_PROPERTY_DECLAWED = "declawed";
private Boolean declawed;
protected Boolean declawed;
public Cat() {

View File

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

View File

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

View File

@@ -224,7 +224,6 @@ public class EnumTest {
this.enumString = enumString;
}
public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) {
this.enumStringRequired = enumStringRequired;
@@ -250,7 +249,6 @@ public class EnumTest {
this.enumStringRequired = enumStringRequired;
}
public EnumTest enumInteger(EnumIntegerEnum enumInteger) {
this.enumInteger = enumInteger;
@@ -276,7 +274,6 @@ public class EnumTest {
this.enumInteger = enumInteger;
}
public EnumTest enumNumber(EnumNumberEnum enumNumber) {
this.enumNumber = enumNumber;
@@ -302,7 +299,6 @@ public class EnumTest {
this.enumNumber = enumNumber;
}
public EnumTest outerEnum(OuterEnum outerEnum) {
this.outerEnum = outerEnum;

View File

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

View File

@@ -122,7 +122,6 @@ public class FormatTest {
this.integer = integer;
}
public FormatTest int32(Integer int32) {
this.int32 = int32;
@@ -150,7 +149,6 @@ public class FormatTest {
this.int32 = int32;
}
public FormatTest int64(Long int64) {
this.int64 = int64;
@@ -176,7 +174,6 @@ public class FormatTest {
this.int64 = int64;
}
public FormatTest number(BigDecimal number) {
this.number = number;
@@ -204,7 +201,6 @@ public class FormatTest {
this.number = number;
}
public FormatTest _float(Float _float) {
this._float = _float;
@@ -232,7 +228,6 @@ public class FormatTest {
this._float = _float;
}
public FormatTest _double(Double _double) {
this._double = _double;
@@ -260,7 +255,6 @@ public class FormatTest {
this._double = _double;
}
public FormatTest string(String string) {
this.string = string;
@@ -286,7 +280,6 @@ public class FormatTest {
this.string = string;
}
public FormatTest _byte(byte[] _byte) {
this._byte = _byte;
@@ -312,7 +305,6 @@ public class FormatTest {
this._byte = _byte;
}
public FormatTest binary(File binary) {
this.binary = binary;
@@ -338,7 +330,6 @@ public class FormatTest {
this.binary = binary;
}
public FormatTest date(LocalDate date) {
this.date = date;
@@ -364,7 +355,6 @@ public class FormatTest {
this.date = date;
}
public FormatTest dateTime(OffsetDateTime dateTime) {
this.dateTime = dateTime;
@@ -390,7 +380,6 @@ public class FormatTest {
this.dateTime = dateTime;
}
public FormatTest uuid(UUID uuid) {
this.uuid = uuid;
@@ -416,7 +405,6 @@ public class FormatTest {
this.uuid = uuid;
}
public FormatTest password(String password) {
this.password = password;
@@ -442,7 +430,6 @@ public class FormatTest {
this.password = password;
}
public FormatTest bigDecimal(BigDecimal bigDecimal) {
this.bigDecimal = bigDecimal;

View File

@@ -41,7 +41,9 @@ public class HasOnlyReadOnly {
public HasOnlyReadOnly() {
}
/**
* Constructor with only readonly parameters
*/
@JsonCreator
public HasOnlyReadOnly(
@JsonProperty(JSON_PROPERTY_BAR) String bar,
@@ -66,7 +68,6 @@ public class HasOnlyReadOnly {
/**
* Get foo
* @return foo

View File

@@ -119,7 +119,6 @@ public class MapTest {
this.mapMapOfString = mapMapOfString;
}
public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) {
this.mapOfEnumString = mapOfEnumString;
@@ -153,7 +152,6 @@ public class MapTest {
this.mapOfEnumString = mapOfEnumString;
}
public MapTest directMap(Map<String, Boolean> directMap) {
this.directMap = directMap;
@@ -187,7 +185,6 @@ public class MapTest {
this.directMap = directMap;
}
public MapTest indirectMap(Map<String, Boolean> indirectMap) {
this.indirectMap = indirectMap;

View File

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

View File

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

View File

@@ -71,7 +71,6 @@ public class ModelApiResponse {
this.code = code;
}
public ModelApiResponse type(String type) {
this.type = type;
@@ -97,7 +96,6 @@ public class ModelApiResponse {
this.type = type;
}
public ModelApiResponse message(String message) {
this.message = message;

View File

@@ -48,7 +48,9 @@ public class Name {
public Name() {
}
/**
* Constructor with only readonly parameters
*/
@JsonCreator
public Name(
@JsonProperty(JSON_PROPERTY_SNAKE_CASE) Integer snakeCase,
@@ -84,7 +86,6 @@ public class Name {
this.name = name;
}
/**
* Get snakeCase
* @return snakeCase
@@ -99,7 +100,6 @@ public class Name {
public Name property(String property) {
this.property = property;
@@ -125,7 +125,6 @@ public class Name {
this.property = property;
}
/**
* Get _123number
* @return _123number

View File

@@ -120,7 +120,6 @@ public class Order {
this.id = id;
}
public Order petId(Long petId) {
this.petId = petId;
@@ -146,7 +145,6 @@ public class Order {
this.petId = petId;
}
public Order quantity(Integer quantity) {
this.quantity = quantity;
@@ -172,7 +170,6 @@ public class Order {
this.quantity = quantity;
}
public Order shipDate(OffsetDateTime shipDate) {
this.shipDate = shipDate;
@@ -198,7 +195,6 @@ public class Order {
this.shipDate = shipDate;
}
public Order status(StatusEnum status) {
this.status = status;
@@ -224,7 +220,6 @@ public class Order {
this.status = status;
}
public Order complete(Boolean complete) {
this.complete = complete;

View File

@@ -71,7 +71,6 @@ public class OuterComposite {
this.myNumber = myNumber;
}
public OuterComposite myString(String myString) {
this.myString = myString;
@@ -97,7 +96,6 @@ public class OuterComposite {
this.myString = myString;
}
public OuterComposite myBoolean(Boolean myBoolean) {
this.myBoolean = myBoolean;

View File

@@ -127,7 +127,6 @@ public class Pet {
this.id = id;
}
public Pet category(Category category) {
this.category = category;
@@ -153,7 +152,6 @@ public class Pet {
this.category = category;
}
public Pet name(String name) {
this.name = name;
@@ -179,7 +177,6 @@ public class Pet {
this.name = name;
}
public Pet photoUrls(Set<String> photoUrls) {
this.photoUrls = photoUrls;
@@ -214,7 +211,6 @@ public class Pet {
this.photoUrls = photoUrls;
}
public Pet tags(List<Tag> tags) {
this.tags = tags;
@@ -248,7 +244,6 @@ public class Pet {
this.tags = tags;
}
public Pet status(StatusEnum status) {
this.status = status;

View File

@@ -40,7 +40,9 @@ public class ReadOnlyFirst {
public ReadOnlyFirst() {
}
/**
* Constructor with only readonly parameters
*/
@JsonCreator
public ReadOnlyFirst(
@JsonProperty(JSON_PROPERTY_BAR) String bar
@@ -63,7 +65,6 @@ public class ReadOnlyFirst {
public ReadOnlyFirst baz(String baz) {
this.baz = baz;

View File

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

View File

@@ -82,7 +82,6 @@ public class TypeHolderDefault {
this.stringItem = stringItem;
}
public TypeHolderDefault numberItem(BigDecimal numberItem) {
this.numberItem = numberItem;
@@ -108,7 +107,6 @@ public class TypeHolderDefault {
this.numberItem = numberItem;
}
public TypeHolderDefault integerItem(Integer integerItem) {
this.integerItem = integerItem;
@@ -134,7 +132,6 @@ public class TypeHolderDefault {
this.integerItem = integerItem;
}
public TypeHolderDefault boolItem(Boolean boolItem) {
this.boolItem = boolItem;
@@ -160,7 +157,6 @@ public class TypeHolderDefault {
this.boolItem = boolItem;
}
public TypeHolderDefault arrayItem(List<Integer> arrayItem) {
this.arrayItem = arrayItem;

View File

@@ -86,7 +86,6 @@ public class TypeHolderExample {
this.stringItem = stringItem;
}
public TypeHolderExample numberItem(BigDecimal numberItem) {
this.numberItem = numberItem;
@@ -112,7 +111,6 @@ public class TypeHolderExample {
this.numberItem = numberItem;
}
public TypeHolderExample floatItem(Float floatItem) {
this.floatItem = floatItem;
@@ -138,7 +136,6 @@ public class TypeHolderExample {
this.floatItem = floatItem;
}
public TypeHolderExample integerItem(Integer integerItem) {
this.integerItem = integerItem;
@@ -164,7 +161,6 @@ public class TypeHolderExample {
this.integerItem = integerItem;
}
public TypeHolderExample boolItem(Boolean boolItem) {
this.boolItem = boolItem;
@@ -190,7 +186,6 @@ public class TypeHolderExample {
this.boolItem = boolItem;
}
public TypeHolderExample arrayItem(List<Integer> arrayItem) {
this.arrayItem = arrayItem;

View File

@@ -90,7 +90,6 @@ public class User {
this.id = id;
}
public User username(String username) {
this.username = username;
@@ -116,7 +115,6 @@ public class User {
this.username = username;
}
public User firstName(String firstName) {
this.firstName = firstName;
@@ -142,7 +140,6 @@ public class User {
this.firstName = firstName;
}
public User lastName(String lastName) {
this.lastName = lastName;
@@ -168,7 +165,6 @@ public class User {
this.lastName = lastName;
}
public User email(String email) {
this.email = email;
@@ -194,7 +190,6 @@ public class User {
this.email = email;
}
public User password(String password) {
this.password = password;
@@ -220,7 +215,6 @@ public class User {
this.password = password;
}
public User phone(String phone) {
this.phone = phone;
@@ -246,7 +240,6 @@ public class User {
this.phone = phone;
}
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;

View File

@@ -178,7 +178,6 @@ public class XmlItem {
this.attributeString = attributeString;
}
public XmlItem attributeNumber(BigDecimal attributeNumber) {
this.attributeNumber = attributeNumber;
@@ -204,7 +203,6 @@ public class XmlItem {
this.attributeNumber = attributeNumber;
}
public XmlItem attributeInteger(Integer attributeInteger) {
this.attributeInteger = attributeInteger;
@@ -230,7 +228,6 @@ public class XmlItem {
this.attributeInteger = attributeInteger;
}
public XmlItem attributeBoolean(Boolean attributeBoolean) {
this.attributeBoolean = attributeBoolean;
@@ -256,7 +253,6 @@ public class XmlItem {
this.attributeBoolean = attributeBoolean;
}
public XmlItem wrappedArray(List<Integer> wrappedArray) {
this.wrappedArray = wrappedArray;
@@ -290,7 +286,6 @@ public class XmlItem {
this.wrappedArray = wrappedArray;
}
public XmlItem nameString(String nameString) {
this.nameString = nameString;
@@ -316,7 +311,6 @@ public class XmlItem {
this.nameString = nameString;
}
public XmlItem nameNumber(BigDecimal nameNumber) {
this.nameNumber = nameNumber;
@@ -342,7 +336,6 @@ public class XmlItem {
this.nameNumber = nameNumber;
}
public XmlItem nameInteger(Integer nameInteger) {
this.nameInteger = nameInteger;
@@ -368,7 +361,6 @@ public class XmlItem {
this.nameInteger = nameInteger;
}
public XmlItem nameBoolean(Boolean nameBoolean) {
this.nameBoolean = nameBoolean;
@@ -394,7 +386,6 @@ public class XmlItem {
this.nameBoolean = nameBoolean;
}
public XmlItem nameArray(List<Integer> nameArray) {
this.nameArray = nameArray;
@@ -428,7 +419,6 @@ public class XmlItem {
this.nameArray = nameArray;
}
public XmlItem nameWrappedArray(List<Integer> nameWrappedArray) {
this.nameWrappedArray = nameWrappedArray;
@@ -462,7 +452,6 @@ public class XmlItem {
this.nameWrappedArray = nameWrappedArray;
}
public XmlItem prefixString(String prefixString) {
this.prefixString = prefixString;
@@ -488,7 +477,6 @@ public class XmlItem {
this.prefixString = prefixString;
}
public XmlItem prefixNumber(BigDecimal prefixNumber) {
this.prefixNumber = prefixNumber;
@@ -514,7 +502,6 @@ public class XmlItem {
this.prefixNumber = prefixNumber;
}
public XmlItem prefixInteger(Integer prefixInteger) {
this.prefixInteger = prefixInteger;
@@ -540,7 +527,6 @@ public class XmlItem {
this.prefixInteger = prefixInteger;
}
public XmlItem prefixBoolean(Boolean prefixBoolean) {
this.prefixBoolean = prefixBoolean;
@@ -566,7 +552,6 @@ public class XmlItem {
this.prefixBoolean = prefixBoolean;
}
public XmlItem prefixArray(List<Integer> prefixArray) {
this.prefixArray = prefixArray;
@@ -600,7 +585,6 @@ public class XmlItem {
this.prefixArray = prefixArray;
}
public XmlItem prefixWrappedArray(List<Integer> prefixWrappedArray) {
this.prefixWrappedArray = prefixWrappedArray;
@@ -634,7 +618,6 @@ public class XmlItem {
this.prefixWrappedArray = prefixWrappedArray;
}
public XmlItem namespaceString(String namespaceString) {
this.namespaceString = namespaceString;
@@ -660,7 +643,6 @@ public class XmlItem {
this.namespaceString = namespaceString;
}
public XmlItem namespaceNumber(BigDecimal namespaceNumber) {
this.namespaceNumber = namespaceNumber;
@@ -686,7 +668,6 @@ public class XmlItem {
this.namespaceNumber = namespaceNumber;
}
public XmlItem namespaceInteger(Integer namespaceInteger) {
this.namespaceInteger = namespaceInteger;
@@ -712,7 +693,6 @@ public class XmlItem {
this.namespaceInteger = namespaceInteger;
}
public XmlItem namespaceBoolean(Boolean namespaceBoolean) {
this.namespaceBoolean = namespaceBoolean;
@@ -738,7 +718,6 @@ public class XmlItem {
this.namespaceBoolean = namespaceBoolean;
}
public XmlItem namespaceArray(List<Integer> namespaceArray) {
this.namespaceArray = namespaceArray;
@@ -772,7 +751,6 @@ public class XmlItem {
this.namespaceArray = namespaceArray;
}
public XmlItem namespaceWrappedArray(List<Integer> namespaceWrappedArray) {
this.namespaceWrappedArray = namespaceWrappedArray;
@@ -806,7 +784,6 @@ public class XmlItem {
this.namespaceWrappedArray = namespaceWrappedArray;
}
public XmlItem prefixNsString(String prefixNsString) {
this.prefixNsString = prefixNsString;
@@ -832,7 +809,6 @@ public class XmlItem {
this.prefixNsString = prefixNsString;
}
public XmlItem prefixNsNumber(BigDecimal prefixNsNumber) {
this.prefixNsNumber = prefixNsNumber;
@@ -858,7 +834,6 @@ public class XmlItem {
this.prefixNsNumber = prefixNsNumber;
}
public XmlItem prefixNsInteger(Integer prefixNsInteger) {
this.prefixNsInteger = prefixNsInteger;
@@ -884,7 +859,6 @@ public class XmlItem {
this.prefixNsInteger = prefixNsInteger;
}
public XmlItem prefixNsBoolean(Boolean prefixNsBoolean) {
this.prefixNsBoolean = prefixNsBoolean;
@@ -910,7 +884,6 @@ public class XmlItem {
this.prefixNsBoolean = prefixNsBoolean;
}
public XmlItem prefixNsArray(List<Integer> prefixNsArray) {
this.prefixNsArray = prefixNsArray;
@@ -944,7 +917,6 @@ public class XmlItem {
this.prefixNsArray = prefixNsArray;
}
public XmlItem prefixNsWrappedArray(List<Integer> prefixNsWrappedArray) {
this.prefixNsWrappedArray = prefixNsWrappedArray;