Swagger 生成的文件使用神秘的导入

问题描述

我刚刚使用 Swagger.io 和 OpenApi 3.0 规范生成代码。它生成代码无法编译。一旦类有了这个看似重要的导入:

import springfox.documentation.oas.annotations.EnableOpenApi;

但我收到此错误package springfox.documentation.oas.annotations does not exist

我不知道需要向 pom.xml 文件添加什么才能使导入工作。 https://mvnrepository.com/ 的 maven 存储库不允许我搜索特定的类,这毫无意义。

解决方法

我希望您错过了 swagger oas 依赖项,因此您收到了包不存在错误。 Swagger oas 在下面的 maven 存储库中可用。

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