[Question] [Bug]: Inconsistent Relative Reference Resolution in Nested Schema Contexts
还没有人认领这个 Issue。
评估
调研方向
从 OpenAPITools/openapi-generator#21492 中的复现上下文开始,检查通过嵌套的 additionalProperties schema 解析相对 $ref 值时如何处理 parentDirectory。根据 OpenAPI 3.0 的文件相对规则验证行为,包括 path-file 和 schema-file 引用;当嵌套引用能够一致地解析且不会导致构建失败时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Question
There seems to be a bug when resolving nested schemas.
OpenAPI Generator incorrectly resolves relative $ref paths in schema files when they are referenced through nested contexts (like additionalProperties). The reference resolution context switches from file-relative to root-relative depending on the nesting level, causing build failures when using standard file-relative references.
This creates inconsistent behavior where:
References from path files work correctly using file-relative paths (../components/schemas/...)
References from schema files fail when using file-relative paths (NestedData.yaml)
This violates the OpenAPI 3.0 specification where all relative references should be resolved from the containing file's location.
Any ideas? parentDirectory seems to be resolved wrongly in this case?
Affected Version
Latest
Context
This issue first reported here: https://github.com/OpenAPITools/openapi-generator/issues/21492 (the project uses this library)
# Example OpenAPI or Swagger definition (optional)
Additional Details
Checklist
- I have searched the existing issues and documentation before asking.
- I have provided enough information for others to understand my question.
- 主要语言
- Java
- 星标
- 868
- 派生
- 560
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
swagger-api/swagger-parser 的其他 Issue
-
InlineModelResolver.uniqueName throws StringIndexOutOfBoundsException for titles starting with a separator (camelCaseFlattenNaming)可能已有人在做 @arimu1 于 38 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
swagger-api/swagger-parser#2386 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
swagger-api/swagger-parser#2168 ·
-
ResolveFully fails on internal references when the initial spec is read from a file URL可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
swagger-api/swagger-parser#1922 · 2 条评论 · 1 个 reaction ·
-
[Bug]: `ResolverFully` does not process OAS 3.1 combinators and skips nested OAS 3.1 schema-valued keywords可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Bug
难度 4/5 3-5 天 新手友好度 25/100
swagger-api/swagger-parser#2403 ·
-
[Bug]: Regression: resolveFully fails when components key does not match external file basename可能已有人在做 @goutamadwant 于 32 天前认领。 未关闭Bug
难度 4/5 3-5 天 新手友好度 58/100
swagger-api/swagger-parser#2399 · 3 条评论 ·
查看 swagger-api/swagger-parser 的全部 Issue
相似的 Issue
-
[destination-snowflake] Custom domains rejected unlike source connections可能已有人在做 @kuza55 今天认领。 未关闭autoteam community connectors/destination/snowflake team/use
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
area-dashboard
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
component/operate kind/feature-request
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
Forge coverage prompts carry text the agent cannot act on可能已有人在做 @graalvmbot 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
oracle/graalvm-reachability-metadata#10572 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
IBM/sample-app-mod#55 ·