NullReferenceException when generating code for a parameter with no schema
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #502 来自 @github-actions —— 已合并
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- fsharp
- 领域
- api
调研方向
Start with OperationCompiler.fs around line 206 to trace how a parameter with Content is represented, then follow the call into DefinitionCompiler.fs around line 440 where schemaObj is null. Run the provider against the OpenAPI document in the issue and verify code generation completes for the parameter whose schema is nested under Content.
由索引模型根据 Issue 内容生成。
描述
Hi,
I tried pointing the provider at an OpenApi schema on a new project at work, and got a NullReferenceException from it, causing the build to fail.
Trying to minimise the issue, it looks like if I have something like
{
"openapi": "3.1.1",
"info": {
"title": "Testing | v1",
"version": "0.2.0.0"
},
"paths": {
"/api/v1/catalogues/scan": {
"post": {
"tags": [
"Catalogue"
],
"summary": "Testing",
"description": "Testing",
"operationId": "Scan",
"parameters": [
{
"name": "properties",
"in": "header",
"description": "header description",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"stage-location": {
"type": "string",
"description": "location"
},
"file-size": {
"minimum": 0,
"type": "integer",
"format": "int64"
}
}
}
}
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
}
}
The the provider gets to https://github.com/fsprojects/SwaggerProvider/blob/4e299fd52e64fc2354a99e2acec3420078c4f7f0/src/SwaggerProvider.DesignTime/DefinitionCompiler.fs#L440 and then throws because schemaObj is null.
Looking higher up the callstack around https://github.com/fsprojects/SwaggerProvider/blob/4e299fd52e64fc2354a99e2acec3420078c4f7f0/src/SwaggerProvider.DesignTime/OperationCompiler.fs#L206, current.Schema is null, but it does have a 'Content' property, and that does contain a schema.
This is as far as I've got looking at it so far, will have another look next week if no one else of repo assist gets to it first.
Thanks.
- 主要语言
- F#
- 星标
- 278
- 派生
- 60
- 平均合并
- 14 小时 22 分钟
- 30 天内合并 PR
- 14
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fsprojects/SwaggerProvider 的其他 Issue
-
agentic-workflows automation repo-assist
难度 1/5 1 小时以内 新手友好度 84/100
fsprojects/SwaggerProvider#411 ·
维护者通常 1 天内回复
-
automation documentation repo-assist
难度 1/5 1 小时以内 新手友好度 20/100
fsprojects/SwaggerProvider#512 ·
维护者通常 1 天内回复
-
bug needs investigation
难度 3/5 1-2 天 新手友好度 64/100
fsprojects/SwaggerProvider#490 · 2 条评论 ·
维护者通常 1 天内回复
-
automation blocked enhancement repo-assist
难度 4/5 3-5 天 新手友好度 42/100
fsprojects/SwaggerProvider#358 · 2 条评论 ·
维护者通常 1 天内回复
-
enhancement help wanted
难度 4/5 3-5 天 新手友好度 45/100
fsprojects/SwaggerProvider#33 · 2 条评论 ·
维护者通常 1 天内回复
查看 fsprojects/SwaggerProvider 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
restatedev/sdk-typescript#813 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
Merit-Systems/x402scan#1312 ·
-
type:bug
难度 2/5 1-3 小时 新手友好度 78/100
Azure/apiops-cli#331 ·
维护者通常 3 天内回复