当前位置:网站首页>第六章 修改规范(SPEC)类
第六章 修改规范(SPEC)类
2022-07-25 20:10:00 【yaoxin521123】
第六章 修改规范(SPEC)类
概述
下表列出了修改规范类的原因并简要总结了所需的更改:
| 原因 | 改变 |
|---|---|
| 更新或替换规范 | 手动修改 OpenAPI XData 块或通过重新生成规范类。 |
启用 REST 服务以支持 CORS | 手动修改 OpenAPI XData 块;还添加一个类参数并创建一个自定义调度超类。 |
启用 REST 服务以支持 Web 会话 | 添加类参数。 |
| 指定使用端点所需的权限 | 手动修改 OpenAPI XData 块。 |
| 覆盖默认内容类型、响应字符集或输入流处理 | 添加类参数。 |
| 为服务方法指定一个非默认名称 | 手动修改 OpenAPI XData 块。 |
无论何时编译规范类,编译器都会在同一个包中重新生成调度类并更新实现类。
覆盖内容类型、响应字符集或输入流处理
只需将类参数添加到规范类并重新编译,就可以覆盖 REST 服务的几个关键方面。
- 默认情况下,
REST服务需要application/json内容类型。要覆盖它,请将以下内容添加到规范类:
Parameter CONTENTTYPE = "some-content-type";
其中 some-content-type 是 MIME 内容类型。
- 默认情况下,
REST服务的响应消息采用UTF-8格式。要覆盖它,请将以下内容添加到规范类:
Parameter CHARSET = "some-character-set";
其中 some-content-type-here 是字符集的名称。
- 默认情况下,
REST服务将输入字符流转换为Unicode。要不这样做,请将以下内容添加到规范类:
Parameter CONVERTINPUTSTREAM = 0";
然后重新编译。然后将这些更改复制到调度类。
覆盖服务方法的名称
默认情况下,编译器使用操作的 operationId 来确定相应 REST 调用调用的方法的名称。可以指定不同的名称。为此,请将以下内容添加到规范类的 OpenAPI XData 块中的操作中:
"x-ISC_ServiceMethod":"alternatename"
示例
"/pets":{
"get":{
"description":"Returns all pets from the system that the user has access to",
"operationId":"findPets",
"x-ISC_ServiceMethod":"ReturnPets",
"produces":[
"application/json",
"application/xml",
"text/xml",
"text/html"
],
然后重新编译。然后编译器将这个新方法添加到调度和实现类中。一定要编辑实现类并为这个新方法提供一个实现。
边栏推荐
- What is idealism
- 当AI邂逅生命健康,华为云为他们搭建三座桥
- Apache MINA框架「建议收藏」
- Link list of sword finger offer question bank summary (III) (C language version)
- The query data returned by the print database is null or the default value. Does not match the value returned by the database
- QML combines qsqltablemodel to dynamically load data MVC "recommended collection"
- 项目中new Promise和async、await中的使用,以及promise.all在项目中的实际应用
- Binarysearch basic binary search
- 【云原生 | 从零开始学Kubernetes】八、命名空间资源配额以及标签
- PMP adopts the latest exam outline, here is [agile project management]
猜你喜欢

Prescan quick start to master Lesson 19: prescan actuator configuration, track synchronization and non configuration of multiple tracks

【高等数学】【4】不定积分
![[cloud native | learn kubernetes from scratch] VIII. Namespace resource quotas and labels](/img/7e/2bdead512ba5bf5ccd0830b0f9b0f2.png)
[cloud native | learn kubernetes from scratch] VIII. Namespace resource quotas and labels
EZDML reverse engineering import database analysis practical operation tutorial

Jmeter——接口测试

PMP每日一练 | 考试不迷路-7.25

How to ensure the quality of customized slip rings

How much memory does bitmap occupy in the development of IM instant messaging?
![PMP adopts the latest exam outline, here is [agile project management]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
PMP adopts the latest exam outline, here is [agile project management]

tiktok手机网络环境怎么设置?tiktok怎么破播放量?
随机推荐
wallys//IPQ5018/IPQ6010/PD-60 802.3AT Input Output 10/100/1000M
Univariate function integration_ Partial integral method
Bash does not add single quotes to your string
CarSim仿真快速入门(十五)—CarSim传感器仿真之ADAS Sensor Objects (1)
统信UOS下配置安装cocos2dx开发环境
Can you tell me whether mindspore supports torchvision Model directly uses the pre trained network, such as vgg16
What is cluster analysis? Categories of cluster analysis methods [easy to understand]
[advanced mathematics] [5] definite integral and its application
Vivo official website app full model UI adaptation scheme
Apache MINA框架「建议收藏」
CarSim simulation quick start (XIV) - CarSim Simulink joint simulation
随机梯度下降法、牛顿法、冲量法、AdaGrad、RMSprop以及Adam优化过程和理解
【高等数学】【5】定积分及应用
「分享」DevExpress ASP.NET v22.1最新版本系统环境配置要求
CarSim simulation quick start (16) - ADAS sensor objects of CarSim sensor simulation (2)
PreScan快速入门到精通第十九讲之PreScan执行器配置、轨迹同步及非配多个轨迹
Web crawler principle analysis "suggestions collection"
Formatdatetime explanation [easy to understand]
wallys//wifi6 wifi5 router IPQ6018 IPQ4019 IPQ4029 802.11ax 802.11ac
RF, gbdt, xgboost feature selection methods "recommended collection"