#No Swagger Generated

5 messages · Page 1 of 1 (latest)

tired bramble
#

Hello Guys!

I am trying to initialize a springboot app and configure it so we can start the development and test our API manually using swagger-ui.
Following the BCE-Pattern, not to get confused 🙂

Code in the comments due to limitations.

I do remember we needed to configure path using spring 2.7 but the guide (https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) does not state any properties anymore.

Would love to get help on this!

Cheers!

Baeldung

Learn how to document a Spring REST API using Swagger 2.

rocky pagodaBOT
#

This post has been reserved for your question.

Hey @tired bramble! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

tired bramble
#

I added the following to the Code:

@Configuration
public class SwaggerConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }
}

@RestController("/ping")
public interface PingBoundary {

    @GetMapping("/{requestString}")
    ResponseEntity<PingResponse> ping(@PathVariable("requestString") String requestString);
}

public class PingController implements PingApi{
    @Override
    public ResponseEntity<PingResponse> ping(String requestString) {
        PingResponse response = new PingResponse();
        response.setMsg(requestString);

        return ResponseEntity.ok(response);
    }
}

and following dependencies:

<!-- swagger -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>3.1.4</version>
            <type>pom</type>
        </dependency>

        <!--Swagger UI -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>3.0.0</version>
        </dependency>