Swagger generated file uses mysterious import

Viewed 1054

I just generated code using Swagger.io with the OpenApi 3.0 spec. The code it produces doesn't compile. Once class has this seemingly crucial import:

import springfox.documentation.oas.annotations.EnableOpenApi;

But I get this error: package springfox.documentation.oas.annotations does not exist

I can't figure out what I need to add to my pom.xml file to make the import work. The maven repo at https://mvnrepository.com/ doesn't let me search for a specific class, which makes no sense.

1 Answers

I hope you have missed swagger oas dependency so you are getting package not exist error. Swagger oas available in the below maven repository.

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-oas</artifactId>
    <version>3.0.0</version>
</dependency>
Related