Skip to content

Add support for optional parameters for operations #105

Closed
@dagirard

Description

@dagirard

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.

Metadata

Metadata

Assignees

Labels

priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daystype:bugA broken experience

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions