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

[Schema Inaccuracy] Duplicate title properties and inline schemas

オープン
#4,622 コメント 3 件 リアクション 0 件 担当者 1 名 GitHub で見る

@bearcherian がすでに取り組んでいます。

2025年3月27日 から。

評価

この issue はまだ評価されていません。

説明

documentation inaccuracy

Schema Inaccuracy

The schema contains many inline schemas (that should be using re-usable components) and many inline schemas and components that have duplicate title properties

This causes problems when using tools like json-schema-to-typescript where you end up with many TypeScript interfaces named User_3, Repository_1, etc.

Expected

No inline schemas for re-used definitions, or schemas that have the same title

Reproduction Steps

This script logs all duplicate title properties found

import schema from "./packages/openapi-webhooks/generated/api.github.com.json" with { type: "json" };
import { writeFileSync } from "node:fs";

function findDuplicateTitles(schema) {
  const seen = new Set();
  const duplicates = [];

  function traverse(obj, path = []) {
    if (typeof obj !== "object" || obj === null) return;

    if (obj.title) {
      const titlePath = path.join("/");
      if (seen.has(obj.title)) {
        duplicates.push({ title: obj.title, path: titlePath });
      } else {
        seen.add(obj.title);
      }
    }

    // Traverse properties like oneOf, anyOf, etc.
    for (const [key, value] of Object.entries(obj)) {
      if (Array.isArray(value)) {
        value.forEach((item, index) => traverse(item, [...path, key, index]));
      } else if (typeof value === "object") {
        traverse(value, [...path, key]);
      }
    }
  }

  traverse(schema);
  return duplicates;
}

async function main() {
  const duplicates = findDuplicateTitles(schema)
    .sort((a, b) => {
      if (a.title < b.title) return -1;
      if (a.title > b.title) return 1;
      return 0;
    })
    .map(({ title, path }) => `- [ ] Title: ${title}, Path: \`#/${path}\``);

  writeFileSync("duplicates.txt", duplicates.join("\n"));
}

main().catch(console.error);

Here is the list of duplicates I have found, which is too long to post directly into the issue body:
duplicates.txt

主要言語
言語のデータがありません
スター
1.6k
フォーク
342
平均マージ
2時間 23分
マージ済み PR(30日)
57

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

github/rest-api-description のほかの issue

github/rest-api-description の issue をすべて見る

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

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