Validator doesn't work with custom server url
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Python
- 星标
- 409
- 派生
- 73
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-openapi/openapi-spec-validator 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 55/100
-
难度 3/5 1-2 天 新手友好度 55/100
-
难度 3/5 1-2 天 新手友好度 30/100
-
难度 4/5 3-5 天 新手友好度 42/100
python-openapi/openapi-spec-validator#400 · 1 条评论 ·
-
kind/bug/confirmed
难度 5/5 一周以上 新手友好度 25/100
python-openapi/openapi-spec-validator#373 · 1 条评论 ·
查看 python-openapi/openapi-spec-validator 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 90/100
learningequality/ricecooker#747 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 76/100
run-llama/llama_index#23199 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
KhronosGroup/glTF-Blender-IO#2769 ·