microsoft / microsoft/OpenAPI.NET.OData

POST actions to insert new entity has empty parameters

未关闭
#707 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C#
星标
240
派生
70
平均合并
7 小时 59 分钟
30 天内合并 PR
13

描述

I'm using version 2.0.0-preview.15 and when I generate the OpenAPI document from my OData metadata file all the POST actions to insert a new entity have no parameters (thus no schema).

I've tried manually adding InsertRestrictions vocabulary and setting the value to true and that didn't seem to help. I tried this on the EntitySet and on the Entity itself

Here is an example of my metadata

<EntitySet Name="Products" EntityType="Product">
<Annotation Term="Org.OData.Capabilities.V1.InsertRestrictions">
<Record>
<PropertyValue Property="NonInsertableProperties">
<Collection>
<String>ID</String>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</EntitySet>

Then the resulting OpenAPI schema generated

"post": {
        "tags": [
          "Products.Product"
        ],
        "summary": "Add new entity to Products",
        "operationId": "Products.Product.CreateProduct",
        "requestBody": {
          "description": "New entity",
          "content": {
            "application/json": { }
          },
          "required": true
        },

Am I missing something in the OpenApiConvertSettings? Is this a known issue? Thank you

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定源文件、测试或入口点。使用提供的 OData 元数据和版本重现问题,然后检查 OpenApiConvertSettings 和生成的 POST 请求正文;当生成的 application/json 内容包含预期的实体架构,同时遵循 NonInsertableProperties 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp, openapi
领域
api
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。