mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-02 21:50:55 +00:00
Generate setters for readonly properties in server code (#1582)
* generate setters for readonly properties in server code * rollback DefaultGenerator change and remove isReadOnly tags from jaxrs server template * updating petstore * more petstore updates
This commit is contained in:
parent
18b500218a
commit
822234dd76
@ -30,7 +30,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
|
||||
|
||||
{{/vars}}
|
||||
{{#vars}}
|
||||
{{^isReadOnly}}
|
||||
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
|
||||
this.{{name}} = {{name}};
|
||||
return this;
|
||||
@ -60,7 +59,6 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
|
||||
}
|
||||
{{/isMapContainer}}
|
||||
|
||||
{{/isReadOnly}}
|
||||
/**
|
||||
{{#description}}
|
||||
* {{description}}
|
||||
@ -87,12 +85,10 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
|
||||
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
return {{name}};
|
||||
}
|
||||
{{^isReadOnly}}
|
||||
|
||||
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||
this.{{name}} = {{name}};
|
||||
}
|
||||
{{/isReadOnly}}
|
||||
|
||||
{{/vars}}
|
||||
|
||||
|
@ -33,6 +33,11 @@ public class HasOnlyReadOnly implements Serializable {
|
||||
@JsonProperty("foo")
|
||||
private String foo;
|
||||
|
||||
public HasOnlyReadOnly bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -44,6 +49,15 @@ public class HasOnlyReadOnly implements Serializable {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public HasOnlyReadOnly foo(String foo) {
|
||||
this.foo = foo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foo
|
||||
* @return foo
|
||||
@ -55,6 +69,10 @@ public class HasOnlyReadOnly implements Serializable {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(String foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -60,6 +60,11 @@ public class Name implements Serializable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Name snakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get snakeCase
|
||||
* @return snakeCase
|
||||
@ -71,6 +76,10 @@ public class Name implements Serializable {
|
||||
return snakeCase;
|
||||
}
|
||||
|
||||
public void setSnakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
}
|
||||
|
||||
public Name property(String property) {
|
||||
this.property = property;
|
||||
return this;
|
||||
@ -91,6 +100,11 @@ public class Name implements Serializable {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public Name _123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _123number
|
||||
* @return _123number
|
||||
@ -102,6 +116,10 @@ public class Name implements Serializable {
|
||||
return _123number;
|
||||
}
|
||||
|
||||
public void set123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -33,6 +33,11 @@ public class ReadOnlyFirst implements Serializable {
|
||||
@JsonProperty("baz")
|
||||
private String baz;
|
||||
|
||||
public ReadOnlyFirst bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -44,6 +49,10 @@ public class ReadOnlyFirst implements Serializable {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public ReadOnlyFirst baz(String baz) {
|
||||
this.baz = baz;
|
||||
return this;
|
||||
|
@ -32,6 +32,11 @@ public class HasOnlyReadOnly {
|
||||
@JsonProperty("foo")
|
||||
private String foo;
|
||||
|
||||
public HasOnlyReadOnly bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,15 @@ public class HasOnlyReadOnly {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public HasOnlyReadOnly foo(String foo) {
|
||||
this.foo = foo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foo
|
||||
* @return foo
|
||||
@ -54,6 +68,10 @@ public class HasOnlyReadOnly {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(String foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -59,6 +59,11 @@ public class Name {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Name snakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get snakeCase
|
||||
* @return snakeCase
|
||||
@ -70,6 +75,10 @@ public class Name {
|
||||
return snakeCase;
|
||||
}
|
||||
|
||||
public void setSnakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
}
|
||||
|
||||
public Name property(String property) {
|
||||
this.property = property;
|
||||
return this;
|
||||
@ -90,6 +99,11 @@ public class Name {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public Name _123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _123number
|
||||
* @return _123number
|
||||
@ -101,6 +115,10 @@ public class Name {
|
||||
return _123number;
|
||||
}
|
||||
|
||||
public void set123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -32,6 +32,11 @@ public class ReadOnlyFirst {
|
||||
@JsonProperty("baz")
|
||||
private String baz;
|
||||
|
||||
public ReadOnlyFirst bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,10 @@ public class ReadOnlyFirst {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public ReadOnlyFirst baz(String baz) {
|
||||
this.baz = baz;
|
||||
return this;
|
||||
|
@ -32,6 +32,11 @@ public class HasOnlyReadOnly {
|
||||
@JsonProperty("foo")
|
||||
private String foo;
|
||||
|
||||
public HasOnlyReadOnly bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,15 @@ public class HasOnlyReadOnly {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public HasOnlyReadOnly foo(String foo) {
|
||||
this.foo = foo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foo
|
||||
* @return foo
|
||||
@ -54,6 +68,10 @@ public class HasOnlyReadOnly {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(String foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -59,6 +59,11 @@ public class Name {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Name snakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get snakeCase
|
||||
* @return snakeCase
|
||||
@ -70,6 +75,10 @@ public class Name {
|
||||
return snakeCase;
|
||||
}
|
||||
|
||||
public void setSnakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
}
|
||||
|
||||
public Name property(String property) {
|
||||
this.property = property;
|
||||
return this;
|
||||
@ -90,6 +99,11 @@ public class Name {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public Name _123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _123number
|
||||
* @return _123number
|
||||
@ -101,6 +115,10 @@ public class Name {
|
||||
return _123number;
|
||||
}
|
||||
|
||||
public void set123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -32,6 +32,11 @@ public class ReadOnlyFirst {
|
||||
@JsonProperty("baz")
|
||||
private String baz;
|
||||
|
||||
public ReadOnlyFirst bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,10 @@ public class ReadOnlyFirst {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public ReadOnlyFirst baz(String baz) {
|
||||
this.baz = baz;
|
||||
return this;
|
||||
|
@ -32,6 +32,11 @@ public class HasOnlyReadOnly {
|
||||
@JsonProperty("foo")
|
||||
private String foo;
|
||||
|
||||
public HasOnlyReadOnly bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,15 @@ public class HasOnlyReadOnly {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public HasOnlyReadOnly foo(String foo) {
|
||||
this.foo = foo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foo
|
||||
* @return foo
|
||||
@ -54,6 +68,10 @@ public class HasOnlyReadOnly {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(String foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -59,6 +59,11 @@ public class Name {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Name snakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get snakeCase
|
||||
* @return snakeCase
|
||||
@ -70,6 +75,10 @@ public class Name {
|
||||
return snakeCase;
|
||||
}
|
||||
|
||||
public void setSnakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
}
|
||||
|
||||
public Name property(String property) {
|
||||
this.property = property;
|
||||
return this;
|
||||
@ -90,6 +99,11 @@ public class Name {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public Name _123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _123number
|
||||
* @return _123number
|
||||
@ -101,6 +115,10 @@ public class Name {
|
||||
return _123number;
|
||||
}
|
||||
|
||||
public void set123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -32,6 +32,11 @@ public class ReadOnlyFirst {
|
||||
@JsonProperty("baz")
|
||||
private String baz;
|
||||
|
||||
public ReadOnlyFirst bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,10 @@ public class ReadOnlyFirst {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public ReadOnlyFirst baz(String baz) {
|
||||
this.baz = baz;
|
||||
return this;
|
||||
|
@ -32,6 +32,11 @@ public class HasOnlyReadOnly {
|
||||
@JsonProperty("foo")
|
||||
private String foo;
|
||||
|
||||
public HasOnlyReadOnly bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,15 @@ public class HasOnlyReadOnly {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public HasOnlyReadOnly foo(String foo) {
|
||||
this.foo = foo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foo
|
||||
* @return foo
|
||||
@ -54,6 +68,10 @@ public class HasOnlyReadOnly {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(String foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -59,6 +59,11 @@ public class Name {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Name snakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get snakeCase
|
||||
* @return snakeCase
|
||||
@ -70,6 +75,10 @@ public class Name {
|
||||
return snakeCase;
|
||||
}
|
||||
|
||||
public void setSnakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
}
|
||||
|
||||
public Name property(String property) {
|
||||
this.property = property;
|
||||
return this;
|
||||
@ -90,6 +99,11 @@ public class Name {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public Name _123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _123number
|
||||
* @return _123number
|
||||
@ -101,6 +115,10 @@ public class Name {
|
||||
return _123number;
|
||||
}
|
||||
|
||||
public void set123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -32,6 +32,11 @@ public class ReadOnlyFirst {
|
||||
@JsonProperty("baz")
|
||||
private String baz;
|
||||
|
||||
public ReadOnlyFirst bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,10 @@ public class ReadOnlyFirst {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public ReadOnlyFirst baz(String baz) {
|
||||
this.baz = baz;
|
||||
return this;
|
||||
|
@ -32,6 +32,11 @@ public class HasOnlyReadOnly {
|
||||
@JsonProperty("foo")
|
||||
private String foo;
|
||||
|
||||
public HasOnlyReadOnly bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,15 @@ public class HasOnlyReadOnly {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public HasOnlyReadOnly foo(String foo) {
|
||||
this.foo = foo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get foo
|
||||
* @return foo
|
||||
@ -54,6 +68,10 @@ public class HasOnlyReadOnly {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(String foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -59,6 +59,11 @@ public class Name {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Name snakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get snakeCase
|
||||
* @return snakeCase
|
||||
@ -70,6 +75,10 @@ public class Name {
|
||||
return snakeCase;
|
||||
}
|
||||
|
||||
public void setSnakeCase(Integer snakeCase) {
|
||||
this.snakeCase = snakeCase;
|
||||
}
|
||||
|
||||
public Name property(String property) {
|
||||
this.property = property;
|
||||
return this;
|
||||
@ -90,6 +99,11 @@ public class Name {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public Name _123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _123number
|
||||
* @return _123number
|
||||
@ -101,6 +115,10 @@ public class Name {
|
||||
return _123number;
|
||||
}
|
||||
|
||||
public void set123number(Integer _123number) {
|
||||
this._123number = _123number;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
|
@ -32,6 +32,11 @@ public class ReadOnlyFirst {
|
||||
@JsonProperty("baz")
|
||||
private String baz;
|
||||
|
||||
public ReadOnlyFirst bar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bar
|
||||
* @return bar
|
||||
@ -43,6 +48,10 @@ public class ReadOnlyFirst {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public ReadOnlyFirst baz(String baz) {
|
||||
this.baz = baz;
|
||||
return this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user