Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#116 2 comentários 4 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
42/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
openapi, python

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Python
Estrelas
409
Forks
73
Métricas de merge de PRs
Nenhum PR com merge em 30d

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de python-openapi/openapi-spec-validator

Todas as issues de python-openapi/openapi-spec-validator

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.