Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java/Spring] all-of and one-of Improvements and Fixes #12075

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
da4712c
Add config to reproduce the issue
cachescrubber Apr 5, 2022
af9d7b3
Add test case to reproduce issue.
cachescrubber Apr 5, 2022
628de7d
Debug Session: identify critical codep path
cachescrubber Apr 6, 2022
3a26775
Works exactly as needed for oneOf/allOf in Java/Spring
cachescrubber Apr 6, 2022
ca6ee6e
Add allVars to omit list in OneOfImplementorAdditionalData
cachescrubber Apr 7, 2022
a4d79b3
SpringCodegen: Support parentVars in order to support fluent setter w…
cachescrubber Apr 7, 2022
34fe8af
Generate Samples
cachescrubber Apr 7, 2022
751455f
Add imports for inherited Properties
cachescrubber Apr 7, 2022
3fd8712
Add JavaDoc
cachescrubber Apr 7, 2022
3bb412a
Polishing
cachescrubber Apr 7, 2022
e224d61
add a link to zozo tech blog post
wing328 Apr 5, 2022
e7075d2
[java] Add jersey3 support to the Java client (#12046)
wing328 Apr 5, 2022
10e1a60
more checks in validateJsonObject (#12041)
wing328 Apr 5, 2022
4827d74
add response headers to api exception (#12042)
wing328 Apr 5, 2022
91bfb2f
[Ruby] Fix incorrectly capitalized identifier in apis template (#12045)
harmony7 Apr 5, 2022
726dcc0
update jackson databind to newer version (#12053)
wing328 Apr 5, 2022
7ebd09e
[PowerShell] add more tests to powershell client (#12057)
wing328 Apr 6, 2022
0924cab
comment out error message debug (#12056)
wing328 Apr 6, 2022
3f197e4
Reduce casting for operations processing (#12002)
borsch Apr 6, 2022
4e2995d
[typescript] Support esbuild, second attempt (#11465)
bodograumann Apr 6, 2022
13dbbc7
Fix the null pointer exception when generating examples for schemas i…
spacether Apr 7, 2022
6f3bf90
surefire plugin 3.0.0-M6 (#12076)
sullis Apr 7, 2022
852f8c3
[python-experimental] adds missing init files in endpoint modules (#1…
spacether Apr 7, 2022
1ed0ba7
testng 7.5 (#11380)
sullis Apr 7, 2022
1cee11e
Eliminates handlebars helper warnings (#12078)
spacether Apr 7, 2022
324d000
Adds postProcess method to python-experimental (#12079)
spacether Apr 7, 2022
231364f
[PowerShell] better enum model support (#12082)
wing328 Apr 8, 2022
9cf3029
docs: updated supported angular version (#12072)
takkiraz Apr 8, 2022
a5b7900
Fixed typo in readme which caused the project link to be broken (#12083)
lukacsaronzs Apr 8, 2022
1643c55
Bump actions/setup-java from 2 to 3 (#12087)
dependabot[bot] Apr 9, 2022
a1c4e37
Configure apiNameSuffix via plugins (#12062)
borsch Apr 9, 2022
940d240
[dart-dio] Adds support for enumUnknownDefaultCase to dart builtvalue…
josh-burton Apr 9, 2022
23995be
[php-slim4] Add Mock Server (#12044)
ybelenko Apr 9, 2022
5f4eccd
Adds 'params_encoder' config option for Ruby clients using Faraday (#…
dkliban Apr 9, 2022
eb4c696
Remove restrictions for additional property types (#11802)
impl Apr 9, 2022
bd9f1b6
Specify source encoding in java/kotlin sample poms templates (#12088)
wing328 Apr 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ public void setKind(KindEnum kind) {
this.kind = kind;
}

public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}

public BigCat className(String className) {
super.setClassName(className);
return this;
}

public BigCat color(String color) {
super.setColor(color);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ public void setDeclawed(Boolean declawed) {
this.declawed = declawed;
}

public Cat className(String className) {
super.setClassName(className);
return this;
}

public Cat color(String color) {
super.setColor(color);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ public void setBreed(String breed) {
this.breed = breed;
}

public Dog className(String className) {
super.setClassName(className);
return this;
}

public Dog color(String color) {
super.setColor(color);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ src/main/java/org/openapitools/model/FooRef.java
src/main/java/org/openapitools/model/FooRefOrValue.java
src/main/java/org/openapitools/model/Pasta.java
src/main/java/org/openapitools/model/Pizza.java
src/main/java/org/openapitools/model/PizzaSpeziale.java
src/main/resources/application.properties
src/main/resources/openapi.yaml
src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ public void setFoo(FooRefOrValue foo) {
this.foo = foo;
}

public Bar href(String href) {
super.setHref(href);
return this;
}

public Bar atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}

public Bar atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}

public Bar atType(String atType) {
super.setAtType(atType);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@ public void setFoo(FooRefOrValue foo) {
this.foo = foo;
}

public BarCreate href(String href) {
super.setHref(href);
return this;
}

public BarCreate id(String id) {
super.setId(id);
return this;
}

public BarCreate atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}

public BarCreate atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}

public BarCreate atType(String atType) {
super.setAtType(atType);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,41 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class BarRef extends EntityRef implements BarRefOrValue {

public BarRef name(String name) {
super.setName(name);
return this;
}

public BarRef atReferredType(String atReferredType) {
super.setAtReferredType(atReferredType);
return this;
}

public BarRef href(String href) {
super.setHref(href);
return this;
}

public BarRef id(String id) {
super.setId(id);
return this;
}

public BarRef atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}

public BarRef atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
Comment on lines +29 to +55
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to not break the fluent setter chain, the inherited properties are exposed as a method in the child class.

return this;
}

public BarRef atType(String atType) {
super.setAtType(atType);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.openapitools.model.Foo;
import org.openapitools.model.Pasta;
import org.openapitools.model.Pizza;
import org.openapitools.model.PizzaSpeziale;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
Expand All @@ -38,7 +39,8 @@
@JsonSubTypes.Type(value = BarCreate.class, name = "Bar_Create"),
@JsonSubTypes.Type(value = Foo.class, name = "Foo"),
@JsonSubTypes.Type(value = Pasta.class, name = "Pasta"),
@JsonSubTypes.Type(value = Pizza.class, name = "Pizza")
@JsonSubTypes.Type(value = Pizza.class, name = "Pizza"),
@JsonSubTypes.Type(value = PizzaSpeziale.class, name = "PizzaSpeziale")
})

@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,31 @@ public void setFooPropB(String fooPropB) {
this.fooPropB = fooPropB;
}

public Foo href(String href) {
super.setHref(href);
return this;
}

public Foo id(String id) {
super.setId(id);
return this;
}

public Foo atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}

public Foo atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}

public Foo atType(String atType) {
super.setAtType(atType);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,41 @@ public void setFoorefPropA(String foorefPropA) {
this.foorefPropA = foorefPropA;
}

public FooRef name(String name) {
super.setName(name);
return this;
}

public FooRef atReferredType(String atReferredType) {
super.setAtReferredType(atReferredType);
return this;
}

public FooRef href(String href) {
super.setHref(href);
return this;
}

public FooRef id(String id) {
super.setId(id);
return this;
}

public FooRef atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}

public FooRef atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}

public FooRef atType(String atType) {
super.setAtType(atType);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,31 @@ public void setVendor(String vendor) {
this.vendor = vendor;
}

public Pasta href(String href) {
super.setHref(href);
return this;
}

public Pasta id(String id) {
super.setId(id);
return this;
}

public Pasta atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}

public Pasta atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}

public Pasta atType(String atType) {
super.setAtType(atType);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.math.BigDecimal;
import org.openapitools.model.Entity;
import org.openapitools.model.PizzaSpeziale;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
Expand All @@ -22,10 +24,65 @@
* Pizza
*/

@JsonIgnoreProperties(
value = "@type", // ignore manually set @type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the @type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = PizzaSpeziale.class, name = "PizzaSpeziale")
})

@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Pizza extends Entity {

@JsonProperty("pizzaSize")
private BigDecimal pizzaSize;

public Pizza pizzaSize(BigDecimal pizzaSize) {
this.pizzaSize = pizzaSize;
return this;
}

/**
* Get pizzaSize
* @return pizzaSize
*/
@Valid
@Schema(name = "pizzaSize", required = false)
public BigDecimal getPizzaSize() {
return pizzaSize;
}

public void setPizzaSize(BigDecimal pizzaSize) {
this.pizzaSize = pizzaSize;
}

public Pizza href(String href) {
super.setHref(href);
return this;
}

public Pizza id(String id) {
super.setId(id);
return this;
}

public Pizza atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}

public Pizza atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}

public Pizza atType(String atType) {
super.setAtType(atType);
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -34,19 +91,22 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
Pizza pizza = (Pizza) o;
return Objects.equals(this.pizzaSize, pizza.pizzaSize) &&
super.equals(o);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode());
return Objects.hash(pizzaSize, super.hashCode());
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Pizza {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" pizzaSize: ").append(toIndentedString(pizzaSize)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Loading