OData / OData/AspNetCoreOData

Api End point is exposed even if PropertyValue bool = false of Navigational property

Open
#292 1 comment 0 reactions 1 assignee View on GitHub

@xuzhg is already working on this.

Since Aug 31, 2021.

investigated P3
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Short summary (3-5 sentences) describing the issue.
Swagger displays API on the UI even if PropertyValue bool = false
OData validation rules do not currently check if annotations containing properties of navigation or property paths are valid or reachable

Assemblies affected

Which assemblies and versions are known to be affected e.g. OData .Net lib 7.x

Reproduce steps

image
image

We see that even though property value bool = false, we still see the API end points exposed on the swagger UI

The above IEdmModel is parsed and converted to OpenApiDocument and later which is displayed in swagger

image

image

The End points Put, Post and Delete should not be displayed as it is not reachable. This may be because of the property value attribute bool = false.
This causes an issue when trying to invoke these api’s
For Example If I try to post

image
image

As we can see the endpoint does not exists and there by we get 405 exception. Is the exception occurring due to property value attribute bool = false? And the swagger displaying the endpoint. What should be done to hide such API's

Expected result

All the API End points which are not reachable should not be displayed on swagger.

Actual result

The API End points which are not reachable are displayed on swagger.

Additional detail

Optional, details of the root cause if known. Delete this section if you have no additional details to add.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.