[Bug]: Schemas in query parameters don't work
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 42/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Python
- Étoiles
- 368
- Forks
- 140
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-openapi/openapi-core
-
kind/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
python-openapi/openapi-core#1188 · 2 commentaires ·
-
kind/bug
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
python-openapi/openapi-core#1225 · 2 commentaires ·
-
kind/bug
Difficulté 3/5 1-2 jours Accessibilité débutants 76/100
python-openapi/openapi-core#1212 ·
-
[Bug]: Query parameter validation fails to match empty string when listed as a valid enum value Ouvertekind/bug
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
python-openapi/openapi-core#1210 ·
-
kind/bug kind/bug/confirmed
Difficulté 3/5 1-2 jours Accessibilité débutants 58/100
python-openapi/openapi-core#1180 · 3 commentaires ·
Toutes les issues de python-openapi/openapi-core
Issues similaires
-
sponsored
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
opensubtitlescom: moviehash never sent when opensubtitles (.org) is not in the provider list Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
Diaoul/subliminal#1382 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
-
triage/confirmed
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
agentscope-ai/agentscope#2775 ·
-
worker.gpuVendors silently accepts unsupported/misspelled vendor names — no validation guard Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100