ℛɑƒ*_*ƒæĿ 7 spring yaml contract-first swagger swagger-codegen
我正在尝试使用Swagger Codegen » 2.2.1生成一些 Web 服务定义
所有配置都在工作,并且我的.yaml定义正确生成了类。
为什么该属性
basePath被忽略?
我@RestController只使用paths定义生成:
https://springboot-base-save-return.appdes.xnet/saveBackendReturn
Run Code Online (Sandbox Code Playgroud)
预期(使用basePath和paths定义):
https://springboot-base-save-return.appdes.xnet/v1/saveBackendReturn
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?我忘记了什么吗?
我的.yaml合同:
swagger: '2.0'
info:
description: My Project
version: 1.0.0
title: Save Backend Return
host: springboot-base-save-return.appdes.xnet
basePath: /v1
tags:
- name: saveBackendReturn
description: Save Backend Return
schemes:
- https
paths:
/saveBackendReturn:
post:
tags:
- saveBackendReturn
summary: Save Backend Return
description: My Project
operationId: saveBackendReturn
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: My Project
required: true
schema:
$ref: '#/definitions/saveBackendReturnRequest'
responses:
'200':
description: Ok
schema:
$ref: '#/definitions/saveBackendReturnResponse'
'400':
description: Bad Request
'401':
description: Unauthorized
'500':
description: Internal Server Error
schema:
$ref: '#/definitions/Error'
security:
- basicAuth: []
Run Code Online (Sandbox Code Playgroud)
ℛɑƒ*_*ƒæĿ 10
搜索更多关于此的信息,我发现了问题。
这是HugoMario修复的错误(提交参考于 2019 年 12 月 2 日)
摘要: » 这是一个过时版本的错误 »现在可以正常工作了!
Maven 依赖swagger-codegen-maven-plugin:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.12</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
Maven 中央存储库(检查新版本):
更新 Maven 项目(Eclipse 快捷方式F5)并进行干净的构建:
mvn clean verify
mvn install
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2831 次 |
| 最近记录: |