Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
NABGC
@NABGC
when started spring boot project ,the console print "Validator -ERROR [ModelSpecification.spec] At least one type of specification is required" , and I'm using latest version.how to fix it ?
Andrew Holland
@a1dutch
@dilipkrish any reason why the https://github.com/webjars/swagger-ui couldnt be used rather than packaging this up in the build? this would allow the ui to be updated with the latest changes without a new release of springfox!
Harikesh Pallantla
@harikesh409
hi all,
I am using sprinfox-boot-starter v3.0.0 and in swagger ui an endpoint /foo/{id} is missing but if I change the endpoint to /foo/{id}/ I am able to get it, can anyone tell me where I might go wrong.
1 reply
Dilip Krishnan
@dilipkrish
Can’t tell without a reproducible sample. @harikesh409
@a1dutch that’s because it has customizations that discover swagger endpoints so that you don’t have to type the endpoint in the ui.
Harikesh Pallantla
@harikesh409

Can’t tell without a reproducible sample. @harikesh409

If I remove spring-boot-starter-data-rest this dependency it is working properly, I will deploy somewhere and give a sample if possible. Can you say if any dependency that might cause a conflict?

Dilip Krishnan
@dilipkrish
It’s very possible that something is causing that endpoint to go away from the documentation. Would be great if you have a working sample that shows it’s missing. I could then try and fix it.
czephyr
@czephyr
can someone clarify for me how am I supposed to use Swagger with a Maven Project using only Servlets?
is it even possible?
Dilip Krishnan
@dilipkrish
Depends. SpringFox only supports spring based api discovery. If your application is completely hand written using servlets then you’re better off writing the open api docs by hand
czephyr
@czephyr

`
@WebServlet("/home")
public class HomeController extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
UserDAO uDao = new UserDAO();
ArrayList<Customer> customers = null;

    response.setContentType("application/json");
    response.setCharacterEncoding("UTF-8");

    try {
        customers=uDao.doRetrieveAll();

    } catch (SQLException throwables) {
        throwables.printStackTrace();
    } finally {
        out.print(new Gson().toJson(customers));
        out.flush();
    }
}

}
`

well I tried my best to fit it all in
this is an example of one of the many endpoints in my project
the webservlet tag is the only javaee tag I'm making use of
@dilipkrish would you say in this instance its not worth to use Swagger? If its not would you mind directing me towards any other cool way I can document my api? thank you
Dilip Krishnan
@dilipkrish
In this particular case I’d check to see if swagger-core would support it. Tho I think that project is also geared towards jax-rs. My recommendation would be to use spring-rest-docs if you have tests that excercise this endpoint.
czephyr
@czephyr

In this particular case I’d check to see if swagger-core would support it. Tho I think that project is also geared towards jax-rs. My recommendation would be to use spring-rest-docs if you have tests that excercise this endpoint.

would you mind clearing up for me what is JAX-RS? I seem to not be able to figure it out. I understand that JavaEE offers many way to write web apps easily, are Servlets part of JAX-RS?

Andrew Holland
@a1dutch
Hi, is it possible to configure v3 to use swagger2 via the ui via properties? the ui keeps looking for /v3/api-docs
3 replies
Can Emre Ayar
@justayar

Hi all,
I am using io.springfox 3.0.0 version in my project. I added the dependency to my build.gradle file as following:

implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'

The external libraries were created as expected:

io.springfox:springfox-boot-starter:3.0.0
io.springfox:springfox-core:3.0.0
io.springfox:springfox-data-rest:3.0.0
io.springfox:springfox-oas:3.0.0
io.springfox:springfox-schema:3.0.0
io.springfox:springfox-spi:3.0.0
io.springfox:springfox-spring-web:3.0.0
io.springfox:springfox-spring-web-flux:3.0.0
io.springfox:springfox-spring-web-mvc:3.0.0
io.swagger.core.v3:swagger-annotation:2.1.2
io.swagger.core.v3:swagger-models:2.1.2
I am using Spring Boot 2.4.2 and Java 11.

When I run my Spring boot application, I get the following error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'swagger2ControllerWebMvc' defined in URL [jar:file:/opt/rally/dynamicscreen-service/lib/springfox-swagger2.jar!/springfox/documentation/swagger2/web/Swagger2ControllerWebMvc.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jsonSerializer' defined in springfox.documentation.spring.web.SpringfoxWebConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.spring.web.json.JsonSerializer]: Factory method 'jsonSerializer' threw exception; nested exception is java.lang.NoClassDefFoundError: io/swagger/v3/oas/models/OpenAPI

Where could I be doing wrong?

kumarsen26
@kumarsen26
Hi,
I am using springdoc-openapi-webflux-ui (v1.5.6). I have a microservice with different endpoints.
I am not able to maintain the order of the endpoints (I dont want it to sort on alphabetically method or tags).
is there a way??
 @Operation(description = "first endpoint ", requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody())
bghazy
@ghazy17_twitter
Hello all ,
After updating io.springfox to version 3.0.0 in my spring boot project ... I remarked that the order of values of Enum used as parameter in a post method changed to asc alphabetic in api-docs
Do you know what could cause this ?
Thank you for your help :)
Vu Do
@VuDo98
Hi guys. Is there anyway to change the style of an array request param? It was generating the style as form but now it turns into pipe delimited even though I haven't changed any settings.
I use spring fox 3.0
Sharath Kolibailu Venkatesh
@sharathkolibyle
Hi
Hi Guys. I see examples under requestBody are not being rendered in springfox swagger ui 3.x. RequestBody examples were shown before when I was using swagger ui 2.9.2. Any workaround suggested to tackle this out ?
thanks for your help.
Vu Do
@VuDo98
Please use springdoc. springfox looks like it is no longer mantained
@sharathkolibyle
Andrew Winterman
@AWinterman
@VuDo98 for real?
Dilip Krishnan
@dilipkrish
Looking for maintainers. To be honest
There is work going on. Just a little slow
Chamith Chathuka
@chamithchathuka
Евгений Буйволов
@ereborDeveloper

Hello there! Does anyone knows why I can't see properties in my models in swagger ui?
pom.xml
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
conf
@Bean
public Docket docket() {
return new Docket(DocumentationType.OAS_30)
.apiInfo(new ApiInfoBuilder()
.version("0.0.1-SNAPSHOT")
.build())
.select().apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
.build();
}

EmployeeDTO.java
@ApiModel(value = "EmployeeDTO", reference = "EmployeeDTO")
public class EmployeeDTO {
@ApiModelProperty(value = "val",
name = "name",
dataType = "UUID",
example = "0066920b-8a90-4bc6-8364-aeefe12a1b36")
UUID uuid;
@ApiModelProperty(value = "val",
name = "name",
dataType = "String",
example = "Name")
String name;
}

As result I see only empty schemas, idk why.

Also I tried to use @ApiResponses and @ApiResponse inside it, but i got empty responses, even if I do everything following docs. I tried to use Schema from v3.oas (because as I understood it allows to describe list of entities as response), but no success.
Евгений Буйволов
@ereborDeveloper
Sorry to distract you guys, I migrated to springdoc. Wish you good luck!
caijingwen-vincent
@caijingwen-vincent
Hi folks, I got 503 Http Status from http://springfox.github.io/springfox/ , it was able to access in a few days ago
caijingwen-vincent
@caijingwen-vincent
I found the problem , DNS pollution,AUTO DIRECT TO 127.0.0.1 , It has been resloved。
Marcello de Sales
@marcellodesales
hi there... I'm writing a SpringBootTest that verifies if the service has a given set of Controller endpoints (Actuators, Platform, etc)
is there any event thrown from SpringFox when it finishes scanning all controllers of the app? Or any Bean holding the list of all APis?
List of all detected APIs
Angelo Capone
@angcap
Hi, i'm using springfox 3 in a spring-boot 2.4 webflux based application. Is there any way to generate v2 api-docs?
Lance Hannestad
@lhannest

How can I use @ApiModelProperty to create an example value of null? This does not compile:

@ApiModelProperty(example = null)
public Long nullableField;

Is there some special String I can pass in to indicate that I want the value to be null, like with Spring's EL "#{null}"?

Vladimir Goncharov
@golodne
Hello everyone! Please, tell me how to calculate the maximum value in the attributes to Swagger Schema? I tried the constant class with calc Float.MAX_VALUE, but I got the message: Attribute value must be constant
@Schema(
      minimum = "0",
      maximum = "Float.MAX_VALUE")
      Float param;
Davide
@jesty

Morning! My rest API looks like this:

 @GetMapping("{id}/xxx")
    @PreAuthorizeByApplicationId
    @ApiOperation("Fetch all XXX belonging to an XXX.")
    public List<String> getXXX(@ApiParam("ID of XXX")
                                  @PathVariable("id") String id,
                                  @ApiParam("XXX XXX.")
                                  @RequestParam(required = false) Set<String> xxx) {
....

The generated Swagger file is:

{
            "name": "xxx",
            "in": "query",
            "description": "XXX XXX.",
            "required": false,
            "type": "string"
          }

While I'm expecting a type "array" for parameter xxx. Do you know what I'm doing wrong? Thanks!

michaaelw
@michaaelw
I'm trying to do the following but haven't been successful. I want to take a swagger.yaml and use it to generate the ../api-docs output and well as well as use it in swagger-ui. Is this possible?
Ahmed Bakran
@abakran1
Hey all, I am trying to incorporate swagger/openapi to my springboot app
Getting this error when trying to get to the json file: Ambiguous handler methods mapped for '/v3/api-docs': {public org.springframework.http.ResponseEntity springfox.documentation.oas.web.OpenApiControllerWebMvc.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest), public java.lang.String org.springdoc.webmvc.api.OpenApiWebMvcResource.openapiJson(javax.servlet.http.HttpServletRequest,java.lang.String,java.util.Locale) throws com.fasterxml.jackson.core.JsonProcessingException} at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:413) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:367) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.getHandlerInternal(RequestMappingInfoHandlerMapping.java:110) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.getHandlerInternal(RequestMappingInfoHandlerMapping.java:59) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:395) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1234) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1016) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.6.RELEASE.jar:5.2.6.RELEASE]
Jin Kwon
@onacit
Does springfox-boot-starter actually supports DocumentationType.OAS_30?
Seems not.
Which one should I use @ApiOperaion or @Operation?
road1987
@road1987
Hello , everyone , I have a OpenAPI object with extensions (key: "x-custom" , value: "123") , how can i write it to json like this { "x-custom":123} , not like this {"extentions":{"x-custom":123}}
are there any function to do the serialized openAPI with extensions ?
ObaidShahid
@ObaidShahid

Hi guys,
I am using swagger v3.0 annotations with springboot application to auto-generate swagger documentation.

All APIs are showing on swagger-UI (<machine-ip>/swagger-ui/index.html) as expected, but file upload API had some issues, I have resolved them using @requestPart annotation, it is now showing up. but file attribute is mandatory so required(*) symbol is not showing up on swaggerUI.

@RequestPart(value = "file", required=true) final Multipart file
Despite of adding required property on file attribute still it is not showing required symbol.

Any help will be appreciated.