swagger - 将“条目”字段添加到组件的属性会破坏编译器
问题描述
我在招摇中遇到了一个非常奇怪的错误。
当尝试使用名为“条目”的属性渲染组件时,编译器会因错误而中断:
The provided definition does not specify a valid version field.
Please indicate a valid Swagger or OpenAPI version field.
Supported version fields are swagger: "2.0" and those that
match openapi: 3.0.n (for example, openapi: 3.0.0).
将返回此错误的示例:
openapi: 3.0.2
info:
title: API Documentation
version: '1'
paths:
/v1/detail/:
get:
tags:
- clips
summary: Get details
operationId: Create Detail
description: Retrieve details
parameters: []
responses:
'200':
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/Clip'
description: ''
components:
schemas:
Clip:
type: object
properties:
entries:
type: string
example: 'abc'
但是通过将条目重命名为其他名称,例如“x_entries”,编译器就可以了。
我在 openapi 文档中找不到任何对“条目”的引用,尽管我在这里可能是错的。有谁知道为什么“条目”作为组件中的属性会导致问题?
解决方案
这是Swagger UI v. 3.25.3 和 Swagger Editor v. 3.8.3 中的一个错误。
在 UI v. 3.25.4 和 Editor v. 3.9.0 中修复。
推荐阅读
- c++ - 使用 GCC 对 C 文件进行部分预处理(不删除“定义”指令)
- javascript - 查找两个字符串的最小连接数
- python - 从不同的目录运行 python 文件,包括 sqlite 数据库
- java - 矩形程序不准确
- css - 旧式数字(“onum”)在 Chrome 中不起作用
- wordpress - Nginx + Pretty 固定链接问题
- labview - LabVIEW中的房屋符号?
- flutter - 在颤动中存储 JWT 令牌的最佳方式是什么?
- unity3d - 播放器控制器在没有输入时不断旋转播放器?
- python - 如何为给定范围 n 对列表中的每个元素进行编号?