Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for optional parameters for operations #105

Closed
dagirard opened this issue Jun 10, 2021 · 1 comment · Fixed by #195
Closed

Add support for optional parameters for operations #105

dagirard opened this issue Jun 10, 2021 · 1 comment · Fixed by #195
Assignees
Labels
priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days type:bug A broken experience

Comments

@dagirard
Copy link
Member

OData operations (action/functions) can have optional parameters that can be omitted from the path, and instead be specified as query parameter.

Specification: http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_InlineParameterSyntax

Example:
GET http://host/service/EmployeesByManager?ManagerID=3

ManagementID parameter has the annotation: "Core.OptionalParameter".

Today the library marks all the operations parameters as "in: path", when in fact optional parameters could be marked as "in: query", and they can be omitted.

Assemblies affected

OpenAPI.NET.OData

Steps to reproduce

ODataConventionModelBuilder:
ParameterConfiguration parameterConfig = operation.Parameter(int, "ManagerId");
parameterConfig.Optional().HasDefaultValue("10");

Expected result

ManagerId parameter is optional, and identified in the OpenAPI document as a query parameter.

Actual result

ManagerId is not optional and part of the path in the OpenAPI document.

@baywet baywet added the type:enhancement Enhancement request targeting an existing experience. label Nov 23, 2021
@baywet baywet added type:bug A broken experience and removed type:enhancement Enhancement request targeting an existing experience. labels Dec 15, 2021
@baywet baywet added this to the 1.2 milestone Dec 15, 2021
@adhiambovivian adhiambovivian modified the milestones: 1.2, 1.1 Feb 23, 2022
@darrelmiller darrelmiller added the priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days label Mar 1, 2022
@irvinesunday
Copy link
Contributor

irvinesunday commented Mar 7, 2022

There's a missing functionality in the Edm library that's required to retrieve the vocabulary annotations for operation parameters. I have created an issue for it in their repo and asked them to action it as a P1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days type:bug A broken experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants