当前位置:网站首页>第六章 修改规范(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"
],
然后重新编译。然后编译器将这个新方法添加到调度和实现类中。一定要编辑实现类并为这个新方法提供一个实现。
边栏推荐
- 接口请求合并的3种技巧,性能直接爆表!
- Arrow 之 Parquet
- Introduction and construction of consul Registration Center
- [Infographics Show] 248 Public Domain Name
- 03 isomorphism of tree 1
- 谷歌Pixel 6a屏下指纹扫描仪存在重大安全漏洞
- CarSim仿真快速入门(十五)—CarSim传感器仿真之ADAS Sensor Objects (1)
- CarSim simulation quick start (XIV) - CarSim Simulink joint simulation
- LP dual currency pledge liquidity mining DAPP system development logic analysis
- Web crawler principle analysis "suggestions collection"
猜你喜欢

参与开源社区还有证书拿?

Stochastic gradient descent method, Newton method, impulse method, adagrad, rmsprop and Adam optimization process and understanding

sentinel简单限流和降级demo问题记录
![[advanced mathematics] [5] definite integral and its application](/img/b2/62748b7533982f2b864148e0857490.png)
[advanced mathematics] [5] definite integral and its application

Security Basics 4 - regular expressions

Connecting to the database warning establishing SSL connection without server's identity verification is not recommended

YOLOv7论文部分解读【含自己的理解】

How does tiktok break zero?
![[today in history] July 3: ergonomic standards act; The birth of pioneers in the field of consumer electronics; Ubisoft releases uplay](/img/18/b06e2e5a2f76dc2da1c2374b8424b3.png)
[today in history] July 3: ergonomic standards act; The birth of pioneers in the field of consumer electronics; Ubisoft releases uplay
![[today in history] July 2: BitTorrent came out; The commercial system linspire was acquired; Sony deploys Playstation now](/img/7d/7a01c8c6923077d6c201bf1ae02c8c.png)
[today in history] July 2: BitTorrent came out; The commercial system linspire was acquired; Sony deploys Playstation now
随机推荐
JVM(二十三) -- JVM运行时参数
[today in history] June 29: SGI and MIPS merged; Microsoft acquires PowerPoint developer; News corporation sells MySpace
redis源码 -ziplist
How does tiktok break zero?
The use of new promise, async and await in the project, and the practical application of promise.all in the project
[advanced mathematics] [4] indefinite integral
securecrt乱码解决方法[通俗易懂]
wallys//IPQ5018/IPQ6010/PD-60 802.3AT Input Output 10/100/1000M
Apache Mina framework "suggestions collection"
JVM (XXIII) -- JVM runtime parameters
Shopping guide for high-end flagship projectors: dangbei X3 pro and dangbei F5 are more immersive!
EZDML reverse engineering import database analysis practical operation tutorial
Oracle database download, installation, use tutorial and problem summary
移动web布局方法
各厂商网络虚拟化的优势
Dataframe first performs grouping operation and then combines output
DIY personal server (DIY storage server)
Can you tell me whether mindspore supports torchvision Model directly uses the pre trained network, such as vgg16
分享 25 个有用的 JS 单行代码
"Share" devaxpress asp Net v22.1 latest version system environment configuration requirements