[Bug]: `ResolverFully` does not process OAS 3.1 combinators and skips nested OAS 3.1 schema-valued keywords
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- java, openapi
調査の方向性
Start at ResolverFully.resolveSchemaImpl and compare its OAS 3.0 subclass checks with the base Schema getters used by OAS 3.1 JsonSchema instances. Run ResolveCombinatorsOas31Test and add coverage for combinators and nested schema-valued keywords; done means OAS 3.1 resolution matches the equivalent OAS 3.0 behavior without parse messages.
索引モデルが issue の本文から書いたものです。
説明
Description
When resolveFully and resolveCombinators are enabled, ResolverFully merges allOf/oneOf/anyOf for OpenAPI 3.0 documents, but does not process them for OpenAPI 3.1 documents.
The same schema is deserialized differently between the two versions: OAS 3.0 uses specific classes such as ComposedSchema, while OAS 3.1 uses JsonSchema. The current resolver checks for these OAS 3.0 subclasses, so OAS 3.1 combinators are silently skipped.
The same issue affects recursive resolution of schema-valued OAS 3.1 keywords such as items, additionalProperties, prefixItems, contains, propertyNames, if/then/else, and dependentSchemas.
PR: https://github.com/swagger-api/swagger-parser/pull/2404.
Affected Version
Confirmed in: 2.1.48 (latest version)
Earliest version the bug appears in (if known): present since OpenAPI 3.1 full resolution was introduced.
Steps to Reproduce
- Create an OpenAPI 3.1 document containing an
allOfschema:
openapi: 3.1.0
info:
title: ResolverFully reproduction
version: 1.0.0
paths:
/example:
post:
requestBody:
content:
application/json:
schema:
type: object
allOf:
- type: object
properties:
first:
type: string
- type: object
properties:
second:
type: string
responses:
'200':
description: OK
- Parse it with the following options:
ParseOptions options = new ParseOptions();
options.setResolve(true);
options.setResolveFully(true);
options.setResolveCombinators(true);
OpenAPI openAPI = new OpenAPIV3Parser()
.readContents(yaml, null, options)
.getOpenAPI();
- Inspect the request-body schema:
Schema schema = openAPI.getPaths().get("/example").getPost()
.getRequestBody().getContent().get("application/json").getSchema();
Regression coverage for this behavior is available in ResolveCombinatorsOas31Test.
Expected Behavior
For OpenAPI 3.1, the schema should be handled consistently with the equivalent OpenAPI 3.0 document when resolveCombinators is enabled.
Schema-valued keywords nested inside an OAS 3.1 JsonSchema should also be recursively resolved.
Actual Behavior
For OpenAPI 3.1, the returned schema retains its allOf array and does not expose the merged properties.
No warning or error is produced, the parse result messages remain empty. The equivalent OpenAPI 3.0 document is merged as expected.
Logs / Stack Traces
No exception is thrown and no stack trace is produced. SwaggerParseResult.getMessages() is empty.
Environment
All environments. The issue is in the code itself.
Additional Context
The root cause is the instanceof ComposedSchema, ArraySchema, and MapSchema checks in ResolverFully.resolveSchemaImpl. These checks match OAS 3.0 deserialization but do not match OAS 3.1 JsonSchema instances. The relevant combinator getters and schema-valued keyword getters are available on the base Schema class.
A minimal fix would process combinators through the base Schema getters and add an OAS 3.1 traversal path for schema-valued keywords without returning early, because one OAS 3.1 schema may contain multiple keyword groups at the same time.
There is a known limitation in the existing combinator aggregation behavior: flattening arbitrary combinators into a new schema is not fully lossless and may drop sibling constraints or alter oneOf/anyOf semantics. A complete solution may require preserving the combinator structure or performing schema intersection. This should be tracked separately from the traversal fix.
The current deserializer also stores parsed additionalItems as an extension instead of populating Schema.additionalItems; that is a separate deserialization issue.
Checklist
- I have searched the existing issues and this is not a duplicate.
- I have provided sufficient information for maintainers to reproduce the issue.
- 主要言語
- Java
- スター
- 870
- フォーク
- 565
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
swagger-api/swagger-parser のほかの issue
-
InlineModelResolver.uniqueName throws StringIndexOutOfBoundsException for titles starting with a separator (camelCaseFlattenNaming)対応中かも @arimu1 が 55 日前に担当しました。 オープン
難易度 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対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
swagger-api/swagger-parser#1922 · コメント 2 件 · リアクション 1 件 ·
-
Bug
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
swagger-api/swagger-parser#2408 ·
-
[Bug]: Discriminator mapping of a oneOf nested in array items gets a null key and is no longer updated after external ref resolution (regression since 2.1.36)対応中かも @wyhasany が 9 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
swagger-api/swagger-parser#2406 · コメント 1 件 ·
swagger-api/swagger-parser の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
2026 Error Report
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
triplea-game/triplea#15096 ·
メンテナーはふだん 1 日以内に返信
-
[Bug][API] Switching workflow versions leaves schedules online対応中かも @zhuangchong が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/dolphinscheduler#18731 ·
メンテナーはふだん 1 日以内に返信
-
Implement JDBC Domain Enums (`SqlCategory`, `SqlExecutionStatus`, `SqlExecutionType`) in Core Moduleオープンcore-module enhancement good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 87/100
sdlc-pro/spring-lens#531 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/rocketmq-dashboard#7340 ·
メンテナーはふだん 3 日以内に返信