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] Fix #14398 springboot 3 schema required #14402

Merged
merged 3 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{/springDocDocumentationProvider}}
{{^springDocDocumentationProvider}}
{{#swagger2AnnotationLibrary}}
<swagger-annotations.version>}2.2.0</swagger-annotations.version>
<swagger-annotations.version>}2.2.7</swagger-annotations.version>
{{/swagger2AnnotationLibrary}}
{{/springDocDocumentationProvider}}
{{#useSwaggerUI}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<swagger-annotations.version>1.6.6</swagger-annotations.version>
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
<swagger-annotations.version>}2.1.13</swagger-annotations.version>
<swagger-annotations.version>}2.2.7</swagger-annotations.version>
{{/swagger2AnnotationLibrary}}
{{/springDocDocumentationProvider}}
{{/springFoxDocumentationProvider}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{/springDocDocumentationProvider}}
{{^springDocDocumentationProvider}}
{{#swagger2AnnotationLibrary}}
<swagger-annotations.version>}2.2.0</swagger-annotations.version>
<swagger-annotations.version>}2.2.7</swagger-annotations.version>
{{/swagger2AnnotationLibrary}}
{{/springDocDocumentationProvider}}
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<swagger-annotations.version>1.6.6</swagger-annotations.version>
{{/swagger1AnnotationLibrary}}
{{#swagger2AnnotationLibrary}}
<swagger-annotations.version>}2.1.13</swagger-annotations.version>
<swagger-annotations.version>}2.2.7</swagger-annotations.version>
{{/swagger2AnnotationLibrary}}
{{/springDocDocumentationProvider}}
{{/springFoxDocumentationProvider}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{#required}}@NotNull{{/required}}
{{/useBeanValidation}}
{{#swagger2AnnotationLibrary}}
@Schema(name = "{{{baseName}}}", {{#isReadOnly}}accessMode = Schema.AccessMode.READ_ONLY, {{/isReadOnly}}{{#example}}example = "{{{.}}}", {{/example}}{{#description}}description = "{{{.}}}", {{/description}}required = {{{required}}})
@Schema(name = "{{{baseName}}}"{{#isReadOnly}}, accessMode = Schema.AccessMode.READ_ONLY{{/isReadOnly}}{{#example}}, example = "{{{.}}}"{{/example}}{{#description}}, description = "{{{.}}}"{{/description}}, requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}})
{{/swagger2AnnotationLibrary}}
{{#swagger1AnnotationLibrary}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Do not edit the class manually.
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.11</version>
<version>2.2.7</version>
</dependency>
{{/oas3}}
{{#jackson}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<swagger-annotations-version>1.6.5</swagger-annotations-version>
{{/generateSwagger1Annotations}}
{{#generateSwagger2Annotations}}
<swagger-annotations-version>2.2.0</swagger-annotations-version>
<swagger-annotations-version>2.2.7</swagger-annotations-version>
{{/generateSwagger2Annotations}}
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Declare the class with extends and implements
@ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
{{/generateSwagger1Annotations}}
{{#generateSwagger2Annotations}}
@Schema(name = "{{{baseName}}}", {{#isReadOnly}}accessMode = Schema.AccessMode.READ_ONLY, {{/isReadOnly}}{{#example}}example = "{{{.}}}", {{/example}}{{#description}}description = "{{{.}}}", {{/description}}required = {{{required}}})
@Schema(name = "{{{baseName}}}"{{#isReadOnly}}, accessMode = Schema.AccessMode.READ_ONLY{{/isReadOnly}}{{#example}}, example = "{{{.}}}"{{/example}}{{#description}}, description = "{{{.}}}"{{/description}}, requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}})
{{/generateSwagger2Annotations}}
{{#vendorExtensions.x-extra-annotation}}
{{{vendorExtensions.x-extra-annotation}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#swagger2AnnotationLibrary}}
@Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}
@Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}
{{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? {{^discriminator}}= {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/discriminator}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#swagger2AnnotationLibrary}}
@Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}
@Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}requiredMode = Schema.RequiredMode.REQUIRED, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}description = "{{{description}}}"){{/swagger2AnnotationLibrary}}{{#swagger1AnnotationLibrary}}
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swagger1AnnotationLibrary}}
{{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Category id(Long id) {
* @return id
*/

@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
Expand All @@ -57,7 +57,7 @@ public Category name(String name) {
* @return name
*/
@Pattern(regexp = "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$")
@Schema(name = "name", required = false)
@Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ModelApiResponse code(Integer code) {
* @return code
*/

@Schema(name = "code", required = false)
@Schema(name = "code", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Integer getCode() {
return code;
}
Expand All @@ -62,7 +62,7 @@ public ModelApiResponse type(String type) {
* @return type
*/

@Schema(name = "type", required = false)
@Schema(name = "type", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getType() {
return type;
}
Expand All @@ -81,7 +81,7 @@ public ModelApiResponse message(String message) {
* @return message
*/

@Schema(name = "message", required = false)
@Schema(name = "message", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getMessage() {
return message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Order id(Long id) {
* @return id
*/

@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
Expand All @@ -110,7 +110,7 @@ public Order petId(Long petId) {
* @return petId
*/

@Schema(name = "petId", required = false)
@Schema(name = "petId", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getPetId() {
return petId;
}
Expand All @@ -129,7 +129,7 @@ public Order quantity(Integer quantity) {
* @return quantity
*/

@Schema(name = "quantity", required = false)
@Schema(name = "quantity", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Integer getQuantity() {
return quantity;
}
Expand All @@ -148,7 +148,7 @@ public Order shipDate(OffsetDateTime shipDate) {
* @return shipDate
*/
@Valid
@Schema(name = "shipDate", required = false)
@Schema(name = "shipDate", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public OffsetDateTime getShipDate() {
return shipDate;
}
Expand All @@ -167,7 +167,7 @@ public Order status(StatusEnum status) {
* @return status
*/

@Schema(name = "status", description = "Order Status", required = false)
@Schema(name = "status", description = "Order Status", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public StatusEnum getStatus() {
return status;
}
Expand All @@ -186,7 +186,7 @@ public Order complete(Boolean complete) {
* @return complete
*/

@Schema(name = "complete", required = false)
@Schema(name = "complete", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Boolean getComplete() {
return complete;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public Pet id(Long id) {
* @return id
*/

@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
Expand All @@ -113,7 +113,7 @@ public Pet category(Category category) {
* @return category
*/
@Valid
@Schema(name = "category", required = false)
@Schema(name = "category", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Category getCategory() {
return category;
}
Expand All @@ -132,7 +132,7 @@ public Pet name(String name) {
* @return name
*/
@NotNull
@Schema(name = "name", example = "doggie", required = true)
@Schema(name = "name", example = "doggie", requiredMode = Schema.RequiredMode.REQUIRED)
public String getName() {
return name;
}
Expand All @@ -156,7 +156,7 @@ public Pet addPhotoUrlsItem(String photoUrlsItem) {
* @return photoUrls
*/
@NotNull
@Schema(name = "photoUrls", required = true)
@Schema(name = "photoUrls", requiredMode = Schema.RequiredMode.REQUIRED)
public List<String> getPhotoUrls() {
return photoUrls;
}
Expand All @@ -183,7 +183,7 @@ public Pet addTagsItem(Tag tagsItem) {
* @return tags
*/
@Valid
@Schema(name = "tags", required = false)
@Schema(name = "tags", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public List<Tag> getTags() {
return tags;
}
Expand All @@ -202,7 +202,7 @@ public Pet status(StatusEnum status) {
* @return status
*/

@Schema(name = "status", description = "pet status in the store", required = false)
@Schema(name = "status", description = "pet status in the store", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public StatusEnum getStatus() {
return status;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Tag id(Long id) {
* @return id
*/

@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
Expand All @@ -57,7 +57,7 @@ public Tag name(String name) {
* @return name
*/

@Schema(name = "name", required = false)
@Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public User id(Long id) {
* @return id
*/

@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
Expand All @@ -75,7 +75,7 @@ public User username(String username) {
* @return username
*/

@Schema(name = "username", required = false)
@Schema(name = "username", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getUsername() {
return username;
}
Expand All @@ -94,7 +94,7 @@ public User firstName(String firstName) {
* @return firstName
*/

@Schema(name = "firstName", required = false)
@Schema(name = "firstName", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getFirstName() {
return firstName;
}
Expand All @@ -113,7 +113,7 @@ public User lastName(String lastName) {
* @return lastName
*/

@Schema(name = "lastName", required = false)
@Schema(name = "lastName", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getLastName() {
return lastName;
}
Expand All @@ -132,7 +132,7 @@ public User email(String email) {
* @return email
*/

@Schema(name = "email", required = false)
@Schema(name = "email", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getEmail() {
return email;
}
Expand All @@ -151,7 +151,7 @@ public User password(String password) {
* @return password
*/

@Schema(name = "password", required = false)
@Schema(name = "password", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getPassword() {
return password;
}
Expand All @@ -170,7 +170,7 @@ public User phone(String phone) {
* @return phone
*/

@Schema(name = "phone", required = false)
@Schema(name = "phone", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getPhone() {
return phone;
}
Expand All @@ -189,7 +189,7 @@ public User userStatus(Integer userStatus) {
* @return userStatus
*/

@Schema(name = "userStatus", description = "User Status", required = false)
@Schema(name = "userStatus", description = "User Status", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Integer getUserStatus() {
return userStatus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Category id(Long id) {
* @return id
*/

@Schema(name = "id", required = false)
@Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long getId() {
return id;
}
Expand All @@ -57,7 +57,7 @@ public Category name(String name) {
* @return name
*/

@Schema(name = "name", required = false)
@Schema(name = "name", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ModelApiResponse code(Integer code) {
* @return code
*/

@Schema(name = "code", required = false)
@Schema(name = "code", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Integer getCode() {
return code;
}
Expand All @@ -62,7 +62,7 @@ public ModelApiResponse type(String type) {
* @return type
*/

@Schema(name = "type", required = false)
@Schema(name = "type", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getType() {
return type;
}
Expand All @@ -81,7 +81,7 @@ public ModelApiResponse message(String message) {
* @return message
*/

@Schema(name = "message", required = false)
@Schema(name = "message", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public String getMessage() {
return message;
}
Expand Down
Loading