Add support for optional parameters for operations #105
Labels
priority:p1
High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
type:bug
A broken experience
Milestone
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.
The text was updated successfully, but these errors were encountered: