swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Defining grouping in swagger

Open S66D opened this issue 2 years ago • 12 comments

Defining grouping in swagger endpoints to reduce the challenges brought in creating a per class request models in huge system for better maintainability and for less class redundancy.

S66D avatar Sep 05 '22 18:09 S66D

This change will support many open and unanswered issues

https://github.com/springdoc/springdoc-openapi/issues/510 https://github.com/springdoc/springdoc-openapi/issues/1374 https://github.com/springdoc/springdoc-openapi/issues/1568 https://stackoverflow.com/questions/71921999/java-annotation-based-validation-io-swagger-v3-oas-annotations-media-schema https://stackoverflow.com/questions/44506965/jax-rs-group-validation-not-recognized-by-swagger-jax-rs-version-1-5-12 https://stackoverflow.com/questions/61461679/how-to-apply-constraints-with-javax-validation-constraints-groups-from-swagger-w https://stackoverflow.com/questions/59477719/swagger-spring-boot-how-to-set-the-example-value-to-be-passed-in-the-api-base https://community.smartbear.com/t5/Swagger-Open-Source-Tools/Support-validation-groups-when-reading-Java-annotations/td-p/199556 https://community.smartbear.com/t5/Swagger-Open-Source-Tools/Grouping-Schemas/m-p/201738 https://community.smartbear.com/t5/Swagger-Open-Source-Tools/How-to-generate-docs-for-api-under-particular-group/m-p/197721

S66D avatar Sep 05 '22 19:09 S66D

That Pull-Request would be SO helpful as it fixes a major bug (and thus lot of issues). I was so happy when I saw it, and I am watching it for 4months now, but sadly it never gets approved :( How could we fasten the approval of the PR :) ?

didjoman avatar Jan 26 '23 10:01 didjoman

I'm waiting on this too - it's maddening. I have a model class like this:

  @Schema(description = "Unique ksuid for this Event - returned on submission.", required = false)
  @NotEmpty(groups = {EventConsumerValidations.class})
  @Builder.Default
  private Optional<String> id = Optional.empty();

The idea is we want the validation after the object has been created with an id and not to have a client pass one in. I've tried required = false, I've tried a distinct @Schema annotation on the controller method that specifically omits that id field from the requiredProperties attribute. It's a huge omission. What is the hold-up with this PR?

mdaumen avatar Jan 26 '23 22:01 mdaumen

I'm also looking forward to this.

virgilsb avatar Feb 21 '23 15:02 virgilsb

Any updates on this PR? Is there something I can assist with to get this merged?

b-smets avatar May 08 '23 12:05 b-smets

Any updates?

kangaroo1122 avatar Jun 26 '23 09:06 kangaroo1122

Do you have any updates on this? Can I help with something in order to merge this? We really need this functionality.

Thank you in advance

CatarinaRibas avatar Jul 28 '23 10:07 CatarinaRibas

Any updates?

This is a crucial functionality that would help many of us. If there is anything that needs to be done before merging this PR, I propose for Maintainers to write the additional requirements.

Mitic96 avatar Feb 01 '24 10:02 Mitic96

I also find this very useful as it reduces unnecessary explanations. This is an example I created based on version 1.7.0 and using another project that beautifies the page. I hope the native project will support this feature soon. knife4j-group, knife4j

lisi9988 avatar Jul 01 '24 03:07 lisi9988