Incorrect validation occuring due to property using "enum" as a property name

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
api, tooling

調査の方向性

まず、参照されている openapi.yaml と PropertyPrototype の例を使って警告を再現し、プロパティ名が "enum" になっているパスに焦点を当てます。validator がそのパスをどのように解釈するかを追跡し、例をカバーする回帰ケースを追加します。完了の条件は、そのドキュメントで誤った enum 警告が発生しなくなり、正しい enum の検証は引き続き機能することです。

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

説明

bug spectral

Version: [email protected]

The validator comes back with a warning for the content of some of our example responses:

 Message :   Enum value "option1" must be "single_select".                                                                                                
 Path    :   paths./tekton_pipelines/{pipeline_id}/properties.post.requestBody.content.application/json.examples.single_select_env_properties.value.enum.0
 Line    :   1119                                                                                                                                         

This is arising in 9 places in our API yaml. The full yaml file can be seen here

This is one example:

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PropertyPrototype'
            examples:
              single_select_env_properties:
                value:
                  name: "enums"
                  type: "single_select"
                  enum: ["option1","option2","option3"]
                  value: "option1"

Schema for the enum:

enum:
          description: Options for `single_select` property type
          type: array
          minItems: 0
          maxItems: 1024
          items:
            $ref: '#/components/schemas/GeneralString'

It seems like the fact we are using the term enum for one of the properties in our API schema is confusing the validator

主要言語
JavaScript
スター
635
フォーク
98
平均マージ
1日 5時間
マージ済み PR(30日)
8

環境構築

はじめの一歩

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

IBM/openapi-validator のほかの issue

IBM/openapi-validator の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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