microsoft / microsoft/OpenAPI.NET.OData

POST actions to insert new entity has empty parameters

Open
#707 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
240
Forks
70
Avg merge
7h 59m
Merged PRs (30d)
13

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named. Reproduce the issue with the supplied OData metadata and version, then inspect the OpenApiConvertSettings and generated POST request body; it is done when the generated application/json content includes the expected entity schema while respecting NonInsertableProperties.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.