Support for scientific notation
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
Start with the supplied OpenAPI 3.0.3 schema and its maximum: 1e2 value, comparing it with the equivalent maximum: 100 case. Trace how the validator handles the scientific-notation value, then verify that the reported schema validates without weakening the numeric constraint checks.
由索引模型根据 Issue 内容生成。
描述
This schema with scientific notation maximum: 1e2
openapi: 3.0.3
info:
title: scientific notation
description: ...
version: 1.0.0
paths:
/pet:
put:
tags:
- pet
summary: ...
description: ...
operationId: updatePet
requestBody:
description: ...
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
responses:
'200':
description: Successful operation
components:
schemas:
Pet:
type: object
properties:
id:
type: integer
format: int64
maximum: 1e2
example: 10
results in this unexpected failure
# Validation Error
{'description': '...', 'content': {'application/json': {'schema': {'type': 'object', 'properties': {'id': {'type': 'integer', 'format': 'int64', 'maximum': '1e2', 'example': 10}}}}}} 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']['requestBody']:
{'oneOf': [{'$ref': '#/definitions/RequestBody'},
{'$ref': '#/definitions/Reference'}]}
On instance['paths']['/pet']['put']['requestBody']:
{'content': {'application/json': {'schema': {'properties': {'id': {'example': 10,
'format': 'int64',
'maximum': '1e2',
'type': 'integer'}},
'type': 'object'}}},
'description': '...'}
# Due to one of those errors
## {'type': 'object', 'properties': {'id': {'type': 'integer', 'format': 'int64', 'maximum': '1e2', 'example': 10}}} is not valid under any of the given schemas
Failed validating 'oneOf' in schema[0]['properties']['content']['additionalProperties']['properties']['schema']:
{'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]}
On instance['content']['application/json']['schema']:
{'properties': {'id': {'example': 10,
'format': 'int64',
'maximum': '1e2',
'type': 'integer'}},
'type': 'object'}
## '$ref' is a required property
Failed validating 'required' in schema[1]:
{'patternProperties': {'^\\$ref$': {'format': 'uri-reference',
'type': 'string'}},
'required': ['$ref'],
'type': 'object'}
On instance:
{'content': {'application/json': {'schema': {'properties': {'id': {'example': 10,
'format': 'int64',
'maximum': '1e2',
'type': 'integer'}},
'type': 'object'}}},
'description': '...'}
...
If I change maximum: 1e2 to maximum: 100, it validates without error.
- 主要语言
- Python
- 星标
- 126
- 派生
- 36
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 ·