Conversion from v2 to v3 incorrectly changes additionalProperties: {} into additionalProperties: type: object
还没有人认领这个 Issue。
评估
调研方向
使用链接的 OpenAPI v2 YAML 运行提供的 swagger-codegen-cli 命令,并检查转换路径中空 additionalProperties 值的处理。完成标准是生成的 OpenAPI v3 YAML 将其保留为 additionalProperties: {} 或 additionalProperties: true,而不是分配 type: object。
由索引模型根据 Issue 内容生成。
描述
Description
I have an OpenAPI v2 yaml that is being converted to v3 by swagger-codegen-cli, and it ends up changing the behavior of my models from allowing any freeform additional properties of any type, to only allowing properties of type object.
Swagger-codegen version
3.0.61
Swagger declaration file content or url
My openapi v2 yaml includes:
protobufAny:
type: object
properties:
'@type':
type: string
additionalProperties: {}
This is converted by swagger-codegen-api into this yaml:
protobufAny:
type: object
properties:
'@type':
type: string
additionalProperties:
type: object
Command line used for generation
swagger-codegen-cli generate -i ./openapiv2/gen/awesome.swagger.yaml -l openapi-yaml -o ./openapiv3/gen/
Steps to reproduce
See above
Related issues/PRs
N/A
Suggest a fix/enhancement
This v2 yaml should convert to additionalProperties: {} or additionalProperties: true
- 主要语言
- Mustache
- 星标
- 17.8k
- 派生
- 6k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
swagger-api/swagger-codegen 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
swagger-api/swagger-codegen#12755 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
swagger-api/swagger-codegen#12445 ·
-
security vulnerability
难度 1/5 1 小时以内 新手友好度 62/100
swagger-api/swagger-codegen#11942 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
swagger-api/swagger-codegen#11812 · 1 个 reaction ·
-
security vulnerability
难度 2/5 1-3 小时 新手友好度 65/100
swagger-api/swagger-codegen#11594 ·
查看 swagger-api/swagger-codegen 的全部 Issue
相似的 Issue
-
priority: low 🌱 type: enhancement 💅🏼
难度 2/5 半天 新手友好度 84/100
nebari-dev/llm-serving-pack#199 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
linebender/parley#849 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
rohitg00/agentmemory#1428 ·
维护者通常 1 天内回复