Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Validator doesn't work with custom server url

Aperta
#95 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python, yaml
Ambito
api

Direzione di ricerca

Start in handlers.py at the referenced line and reproduce the failure with the provided OpenAPI YAML, using the custom production server and /test endpoint. Trace how the validator resolves server URLs and verify that an appropriate default is used when the provided URL cannot be resolved; done means the endpoint validates without requiring a visible validation server entry.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

We are running a pyramid app with the following open api yaml definition :

openapi: 3.0.1
info:
  title: Sample API
  contact:
    name: API Support
    email: some.private@email.com
  version: 1.0.0
  x-audience: external-public
  description: |
    # Minimum 

servers:
  - url: https://client.public.api.com/
    description: Production Server
paths:
  /test:
    get:
      summary: "test path"
      operationId: my.app.function
      responses:
        200:
          description: will always return ok

Requests to the endpoint /test will fail with Server not found for http://0.0.0.0:8080/test unless the default server is added to the servers object:

servers:
  - url: https://some.private.api.com/
    description: Production Server
  - url: /
    description: Validation URL

it seems the url validator try to resolve the url in the servers field.

https://github.com/p1c2u/openapi-spec-validator/blob/master/openapi_spec_validator/handlers.py#L25

The validator should use the default server url as a fallback if the provided url can't be resolved.
I would like to avoid displaying the Validation URL to the api user.

note : first version incorrectly assumed a query was made on the url.

Lingua principale
Python
Stelle
409
Fork
73
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python-openapi/openapi-spec-validator

Tutte le issue di python-openapi/openapi-spec-validator

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.