Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

convertTo 3.1 drops nullable on allOf schemas (follow-up to #172)

クローズ
#239 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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 ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

thim81/openapi-format のほかの issue

thim81/openapi-format の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。