convertTo 3.1 drops nullable on allOf schemas (follow-up to #172)
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
- 領域
- api
調査の方向性
Start at the openapiConvertVersion entry point and reproduce the issue with the provided 3.0.3 document, comparing the allOf and oneOf conversions. Done means nullable allOf schemas preserve null acceptance through an anyOf-style representation while the existing oneOf behavior remains correct.
索引モデルが issue の本文から書いたものです。
説明
Converting 3.0 → 3.1 with convertTo: '3.1' drops nullable: true when the schema has allOf and no type. The converted schema then rejects null, which the original allowed. #172 fixed this for anyOf and oneOf, but allOf is still affected.
The pattern is common in GitHub's REST API description. For example, label.archived_by is { nullable: true, allOf: [{ $ref: '#/components/schemas/simple-user' }] }.
Reproduction (openapi-format 1.33.7, Node 24):
import { openapiConvertVersion } from 'openapi-format';
const doc = {
openapi: '3.0.3',
info: { title: 't', version: '1' },
paths: {},
components: {
schemas: {
User: { type: 'object', properties: { login: { type: 'string' } } },
Label: {
type: 'object',
properties: {
archived_by: { nullable: true, allOf: [{ $ref: '#/components/schemas/User' }] },
milestone: { nullable: true, oneOf: [{ type: 'string' }, { type: 'integer' }] },
},
},
},
},
};
const { data } = await openapiConvertVersion(doc, { convertTo: '3.1' });
console.log(JSON.stringify(data.components.schemas.Label.properties, null, 2));
Actual:
{
"archived_by": { "allOf": [{ "$ref": "#/components/schemas/User" }] },
"milestone": { "oneOf": [{ "type": "string" }, { "type": "integer" }, { "type": "null" }] }
}
milestone (oneOf) is converted correctly. archived_by (allOf) loses nullable entirely.
Expected, for example:
"archived_by": {
"anyOf": [
{ "allOf": [{ "$ref": "#/components/schemas/User" }] },
{ "type": "null" }
]
}
Adding { "type": "null" } to the allOf list itself wouldn't work, since a value can't match both a User and null. The null has to sit alongside the allOf, for example in an anyOf.
- 主要言語
- JavaScript
- スター
- 176
- フォーク
- 29
- 平均マージ
- 3日 5時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
thim81/openapi-format のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
thim81/openapi-format#232 · コメント 3 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
thim81/openapi-format#196 · コメント 3 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
thim81/openapi-format#169 · コメント 2 件 ·
-
AI Investigate
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
thim81/openapi-format#131 ·
-
Sorting by tags?再び着手できるかも @thim81 が 816 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンnew feature
thim81/openapi-format#119 · コメント 15 件 · 担当者 1 名 ·
thim81/openapi-format の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
maproulette/maproulette-frontend#2944 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
NanmiCoder/dsh-agent-teams#255 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
jaegertracing/jaeger-ui#4618 ·
メンテナーはふだん 1 日以内に返信
-
area:plugins enhancement platform:vscode
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
anthropics/claude-code#103166 ·
メンテナーはふだん 1 日以内に返信