swagger-ui 相关问题

Swagger UI是HTML,CSS和JavaScript对象的集合,可以从符合Swagger的API动态生成文档

同一个应用程序的多个版本,swagger UI 没有给两个端点相同的端点和操作 ID

我试图为一个应用程序生成两个不同的模型,它们具有不同的版本,具有相同的端点名称和操作 ID,如下所示。 经过搜索,得知添加 x-version: "v2&...

回答 0 投票 0

如何使用 FastAPI 设置 Swagger UI 以在查询参数中使用列表字段?

在制作一个使用列表字段依赖注入的应用程序时,参数会自动转到 SwaggerUI 中的请求主体: 从 fastapi 导入 FastAPI,查询,取决于 进口独角兽 来自

回答 1 投票 0

升级到 spring 3 时出现 Swagger 问题

我正在将我的项目从 spring/java 8 升级到 spring 3/java 17。应用程序已启动并正在运行,但是当我检查 swagger 页面时,它没有显示 API。相反,它只是说“没有操作......

回答 0 投票 0

带端点的 Angular swagger-ui 无法下载文件

我的应用程序中有一个 angular swagger ui 页面,它的工作方式类似于 API 的 swagger 文档。我在此链接中使用了 angular swagger ui 包 -> https://github.com/ostranme/angu ...

回答 0 投票 0

openapi 3.0 swagger ui的默认路径是什么

我正在使用以下依赖项并运行示例项目,但看不到 swagger ui。 org.springdoc springdoc-openapi-ui 我正在使用以下依赖项并运行示例项目,但看不到 swagger ui。 <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>1.2.32</version> </dependency> 我尝试了所有可能的网址,但 swagger UI 打不开 localhost:8080/v3/apidocs localhost:8080/swagger-ui.html localhost:8080/swagger-ui/

回答 0 投票 0

加载样式出错,webpack + swagger-ui

尝试运行使用 swagger-ui-react 组件的非常简单的应用程序时出现错误。当加载程序尝试从 swagger-ui-react/swagger-ui.css 加载样式时出现问题。 这是我的设置...

回答 1 投票 0

无法在基本身份验证(SpringBoot/Kotlin)后面获取 Swagger

我正试图让 Swagger 支持我们的基本身份验证。它应该提示输入用户名/密码才能查看。目前我已经像这样编写了 filterChain 方法: @配置 @EnableWebSecur ...

回答 0 投票 0

为什么我的控制器端点大摇大摆地得到一些额外的端点,以及如何解决这个问题?

我正在使用依赖项...... 我只是将我的控制器的基础包设置为在 openapi swagger 上显示。 我想从我的 openapi swagger 中删除那些不需要的自动生成的端点

回答 0 投票 0

Swagger UI - “试一试!”按钮调用失败

我已经在本地机器上安装了 Swagger UI。当我提取一些 Swagger 定义时,这些定义工作正常,但是,当我单击“试试看!”时按钮,调用失败...

回答 2 投票 0

Swagger 不应同时具有 `example` 和 `examples`,因为它们是互斥的

我在使用 spring boot 应用程序创建的 swagger 定义时遇到了问题。该错误导致 kubernetes 部署出现问题,并且与尝试显示示例有关

回答 0 投票 0

如何使用 Flask-RESTX 在 PyCharm 的 Swagger UI 中添加方法描述

我正在使用 Swagger 作为我的 API 工具框架,我刚刚找到这个页面:https://petstore.swagger.io/ 并看到了每个方法的描述。 例如: POST: pet/ 被描述为 add a new ...

回答 2 投票 0

Swagger UI 在本地运行良好,但在 Heroku 上“找不到页面”

我有一个带有 swagger 的 java spring boot 应用程序,如果我在本地运行它并打开链接 http://localhost:8080/swagger-ui/index.html,那么一切正常。 我已经将我的应用程序部署到...

回答 1 投票 0

POST:@ModelAttribute 不转换包装器 DTO 的 Map 对象

我需要你的帮助来解决 java Map 对象的 @ModelAttribute 问题。 语境 以下 REST 控制器公开了一个接受包装器 dto 的 POST api。 @验证 @RestController @Slf4j @

回答 1 投票 0

为什么我只能使用 Swagger 访问 ApiGateway 中的最后一个 API 文档?

我需要获取我在ApiGateway中所有API的文档,但我只能看到最后一个API的文档。这是我的课: 从“@aws-amplify/auth”导入 Auth; 进口{

回答 0 投票 0

Swagger UI 中的“1.0”和“OAS3”标签是什么意思?

Swagger UI 在 API 标题旁边显示“1.0”和“OAS3”标签。这是什么意思?

回答 0 投票 0

CORS 无法与 Fastify 一起正常工作:“无法获取。CORS 网络故障 URL”

我有一个使用 fastify 构建的应用程序,但在使用 CORS 时失败了。 我已经安装了插件 fastify-cors 并配置如下: 代码 从 'fastify' 导入 fastify 从'@fastify ...导入cors

回答 0 投票 0

Spring Boot + Swagger 2 不工作 (404)

伙计们。 我只是想向我的 Web 项目 (swagger-ui) 添加一些 API 文档。但是它给了我 404 http://localhost:8080/swagger-ui/index.html 和 http://localhost:8080/swagger-ui.html ...

回答 0 投票 0

Spring Boot 3 springdoc-openapi-ui 不工作

我正在尝试将 swagger-ui (OpenAPI 3.0) 添加到 Spring Boot v3 应用程序中。 我已经添加了 openapi-ui maven 依赖项,它应该按照文档工作。 我正在尝试将 swagger-ui (OpenAPI 3.0) 添加到 Spring Boot v3 应用程序中。 我已经添加了 openapi-ui maven 依赖项,它应该按照文档工作。 <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>1.6.11</version> </dependency> 但显然,它仍然不起作用并且 localhost:8080/swagger-ui.html 返回 404 错误。 我错过了什么? 根据文档: 对于 spring-boot 3 支持,请确保使用 springdoc-openapi v2 https://springdoc.org/v2/ 对于spring-boot和swagger-ui的集成,添加 库添加到项目依赖项列表中(无需额外 需要配置) <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.0.0</version> </dependency> 这将自动部署 swagger-ui 到 spring-boot 应用: 文档将以 HTML 格式提供,使用官方 swagger-ui 罐子 Swagger UI 页面随后将在 http://server:port/context-path/swagger-ui.html 和 OpenAPI json 格式的描述将在以下 url 中提供: http://server:port/context-path/v3/api-docs server: The server name or IP port: The server port context-path: The context path of the application Documentation can be available in yaml format as well, on the following path : /v3/api-docs.yaml 请注意模块已重命名: https://springdoc.org/v2/#migrating-from-springdoc-v1 我完全同意@JCompetence。请注意 springdoc-openapi-ui现在更改为springdoc-openapi-starter-webmvc-ui 来自 spring boot 3. <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.0.2</version> </dependency> 请试试这个。如果您想查找更多信息,请查看官方链接: https://springdoc.org/v2/#features 对我有帮助,只是改变了依赖性 implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.11' 到 implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.0.0' 或 <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.0.0</version> </dependency> springdoc-openapi-starter-webmvc-ui不适用于spring-boot-starter-webflux 直到你包括spring-boot-starter-web。 如果你包括弹簧安全那么它就死了。 你需要使用springdoc-openapi v2 <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.0.4</version> </dependency> 对于kotlin你必须多加一个依赖 <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-kotlin</artifactId> </dependency> 然后在您的主类上添加`@OpenAPIDefinition @SpringBootApplication @OpenAPIDefinition class MyApplication { } 从 OpenApi 规范(.yml 文件)生成(Java)代码的 Maven 插件 生成器“spring”支持 Jakarta 命名空间 <plugin> <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <configuration> <configOptions> ... **<useSpringBoot3>true</useSpringBoot3>** </configOptions> </configuration> </plugin> 生成器“java”(生成客户端)还不支持 Jakarta 命名空间。 所以使用 Eclipse Transformer 插件(需要提供 Javax 依赖范围!) <plugin> <groupId>org.eclipse.transformer</groupId> <artifactId>transformer-maven-plugin</artifactId> <extensions>true</extensions> <configuration> <rules> <jakartaDefaults>true</jakartaDefaults> </rules> </configuration> <executions> <execution> <id>jakarta-ee</id> <goals><goal>jar</goal></goals> <phase>package</phase> <configuration> <artifact> <groupId>${project.groupId}</groupId> <artifactId>${project.artifactId}</artifactId> </artifact> </configuration> </execution> </executions> </plugin> 如果您的应用程序启用了 spring 安全性,则只是一个附加组件! 然后您需要将 swagger-endpoint 列入白名单以不使用身份验证 @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { httpSecurity.csrf().disable().authorizeHttpRequests(auth -> { auth.requestMatchers("/v3/**", "/swagger-ui/**").permitAll(); auth.anyRequest().authenticated(); }); return httpSecurity.build(); 您还需要将此注释添加到您的 SpringBootApp 主类: @OpenAPIDefinition @SpringBootApplication @OpenAPIDefinition class MyApplication 对于 Spring Security 支持,请使用 Below 依赖项 implementation("org.springdoc:springdoc-openapi-starter-common:2.1.0") implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0") 来自https://springdoc.org/v2/#migrating-from-springfox

回答 9 投票 0

如何通过swagger获取keycloak令牌

我正在使用 Swagger(在 nodejs 中)使用 bearerAuth securitySchemes 使用(keycloak)令牌制作 REST API。我必须在调用请求之前设置令牌,并且它有效。 我想用

回答 0 投票 0

Spring Boot Swagger OpenAPI 3.0.1 无法呈现此定义错误

我有以下堆栈: 春季启动:2.7.3 启用 Spring Security springdoc-openapi-ui:1.6.15 应用程序.properties # Swagger 属性 springdoc.api-docs.path=/ics/api/docs springdoc.s...

回答 0 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.