`Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^\\/']['patternProperties']['^(get|put|post|delete|options|head|patch|trace)$']['properties']['parameters']['items']:`

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

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

評価

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

調査の方向性

Reproduce the minimal OpenAPI 3.0 document with openapi-spec-validator 0.3.0 and 0.2.10, focusing on the referenced query parameter under paths / get. Check the OpenAPI parameter rules and validator behavior when example and examples are both present. Done means establishing whether the validator behavior matches the specification and documenting or correcting the discrepancy.

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

説明

kind/question

I get:

{'in': 'query', 'name': 'bar', 'example': '1', 'examples': {'1': {'summary': '1', 'value': '1'}, '2': {'summary': '2', 'value': '2'}}, 'schema': {'type': 'string'}} is not valid under any of the given schemas

Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^\\/']['patternProperties']['^(get|put|post|delete|options|head|patch|trace)$']['properties']['parameters']['items']:
    {'oneOf': [{'$ref': '#/definitions/Parameter'},
               {'$ref': '#/definitions/Reference'}]}

On instance['paths']['/']['get']['parameters'][0]:
    {'$ref': '#/components/parameters/foo',
     'x-scope': ['file:///usr/share/ucs-test/73_udm-rest/openapi2.json']}

for

{
    "components": {
        "parameters": {
            "foo": {
                "in": "query",
                "name": "bar",
                "example": "1",
                "examples": {
                    "1": {
                        "summary": "1",
                        "value": "1"
                    },
                    "2": {
                        "summary": "2",
                        "value": "2"
                    }
                },
                "schema": {
                    "type": "string"
                }
            }
        }
    },
    "info": {
        "description": "",
        "title": "",
        "version": "1.0.0"
    },
    "openapi": "3.0.0",
    "paths": {
       "/": {
            "get": {
                "parameters": [
                    {
                        "$ref": "#/components/parameters/foo"
                    }
                ],
                "responses": { "200": {"description": "", "content": {"text/plain": {"schema": {"type": "string"}}}} }
            }
        }
    }
}

since openapi-spec-validator==0.3.0. It succeeded to validate with openapi-spec-validator==0.2.10.
If I remove one of example or examples from #/components/parameters/foo the validation succeeds.

Does openapi define them as mutually exclusive?
https://swagger.io/docs/specification/adding-examples/ doesn't seem to contain a mix. The swagger UI just sucks in displaying examples.

主要言語
Python
スター
409
フォーク
73
PR マージ指標
30日以内にマージされた PR はありません

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

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

はじめの一歩

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

python-openapi/openapi-spec-validator のほかの issue

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

似ている issue

Python の issue をもっと見る

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

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