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

`openapi spec lint --fix` drops node-level fixes and can duplicate paths

オープン
#280 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

2026年10月24日 から。

  • #281 @RaphaelFakhri による — オープン

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
go, yaml
領域
backend, cli

調査の方向性

Start with fix.Engine and the CLI path that writes openapi spec lint --fix output through marshaller.Marshal; compare that sync step with the direct yaml.Marshal used in openapi/linter/rules integration tests. Trace how ApplyNode changes are reconciled with the model, especially renamed path keys. Done means the reproduced fixes survive writing without duplicate paths; linked pull request #281 is already open.

索引モデルが issue の本文から書いたものです。

説明

openapi spec lint --fix reports fixes as applied, but fixes that edit the YAML node tree directly (the validation.NodeFix implementations) are lost when the document is written. Fixes affected include owasp-security-hosts-https-oas3, style-oas3-host-trailing-slash, style-path-trailing-slash, and semantic-duplicated-enum.

For style-path-trailing-slash, the output contains both the fixed path and the original path, so the written document has a duplicated operation.

Steps to reproduce

  1. Save this document as spec.yaml:

    openapi: 3.1.0
    info:
      title: Test
      version: 1.0.0
    servers:
      - url: http://api.example.com/
    paths:
      /pets/:
        get:
          responses:
            "200":
              description: ok
    components:
      schemas:
        E:
          type: string
          enum: [a, b, a]
    
  2. Run openapi spec lint --fix spec.yaml.

Expected result

The written file has url: https://api.example.com, a single /pets path, and enum: [a, b].

Actual result

The command prints Applied 8 fix(es), including the HTTPS upgrade, both trailing-slash fixes, and the duplicate enum fix. The written file still has url: http://api.example.com/ and enum: [a, b, a], and contains both /pets and /pets/. Fixes that edit the model, such as the added error responses, are kept and appear under both paths.

Cause

fix.Engine calls ApplyNode on the document root node. The CLI then writes the document with marshaller.Marshal, which syncs the high-level model back over the nodes. The model still holds the original values, so value edits are reverted, and the original path key is added back next to the renamed key node.

The fix integration tests in openapi/linter/rules encode the root node with yaml.Marshal directly, so they do not run the sync step that the CLI uses.

主要言語
Go
スター
276
フォーク
21
平均マージ
1日 5時間
マージ済み PR(30日)
20

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

speakeasy-api/openapi のほかの issue

speakeasy-api/openapi の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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