[Bug]: Schemas in query parameters don't work
まだ誰も着手していません。
評価
調査の方向性
Start with the reproduced OpenAPI.from_file_path and unmarshal_request flow using RequestsOpenAPIRequest, then trace how query parameters with object schemas and patternProperties are handled. Confirm the existing reproduction with tag.foo and baz; done means the unmarshalled query results include the schema-matched tag.foo value while retaining baz.
索引モデルが issue の本文から書いたものです。
説明
Actual Behavior
Query parameters with schemas are ignored when Unmarshalling
Expected Behavior
Query parameters matching a query parameter with a schema should be included in Unmarshall results.
Steps to Reproduce
Schema:
openapi: 3.1.0
info:
title: Example
version: "0.0"
servers:
- url: 'http://example.com'
paths:
/:
get:
parameters:
- name: tag.{name}
in: query
schema:
type: object
patternProperties:
'^tag\.[A-Za-z0-9]+$':
type: string
pattern: '^[A-Za-z0-9]+$'
additionalProperties: false
- name: baz
in: query
schema:
type: string
Python script:
from openapi_core import OpenAPI
from openapi_core.contrib.requests import RequestsOpenAPIRequest
from requests import Request
import re
oas = OpenAPI.from_file_path('./exampleOas.yaml')
req = oas.unmarshal_request(RequestsOpenAPIRequest(Request(
"GET",
"http://example.com/",
params={"tag.foo": "bar", "baz": "bat"})))
print(req)
# Returns
# RequestUnmarshalResult(errors=[], body=None, parameters=Parameters(query={'baz': 'bat'}, header={}, cookie={}, path={}), security={})
# Prove the regex works
print(re.search(r"^tag\.[A-Za-z0-9]+$", "tag.foo"))
# Returns
# <re.Match object; span=(0, 7), match='tag.foo'>
OpenAPI Core Version
0.19.5
OpenAPI Core Integration
requests
Affected Area(s)
unmarshalling
References
Such a pattern is described here and I've had confirmation on the OpenAPI slack here that this is the current best approach to describing pattern-based query parameter names.
This may be related to https://github.com/python-openapi/openapi-core/issues/250 but isn't completely related as it should work with the query default style of form.
Example of the use case I have for this.
Anything else we need to know?
No response
Would you like to implement a fix?
None
- 主要言語
- Python
- スター
- 368
- フォーク
- 140
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python-openapi/openapi-core のほかの issue
-
kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
python-openapi/openapi-core#1188 · コメント 2 件 ·
-
kind/bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
python-openapi/openapi-core#1225 · コメント 2 件 ·
-
kind/bug
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
python-openapi/openapi-core#1212 ·
-
[Bug]: Query parameter validation fails to match empty string when listed as a valid enum value オープンkind/bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
python-openapi/openapi-core#1210 ·
-
kind/bug kind/bug/confirmed
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
python-openapi/openapi-core#1180 · コメント 3 件 ·
python-openapi/openapi-core の issue をすべて見る
似ている issue
-
Add: hunch オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DiamondLightSource/dodal#2211 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
openml/openml-python#1749 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
sipyourdrink-ltd/bernstein#6191 ·