azure-functions-openapi-extension icon indicating copy to clipboard operation
azure-functions-openapi-extension copied to clipboard

Extend definition objects with custom properties - support Power Apps Custom Connector definition

Open dominicusmento opened this issue 4 years ago • 3 comments

Hi,

I have a need to set some custom parameters into openapi definition. To be more specific I need my swagger definition to be compliant with Microsoft Power Apps Custom Connector rules: https://docs.microsoft.com/en-us/connectors/custom-connectors/openapi-extensions

For example, every parameter in my definition has to have "x-ms-summary" defined to pass the validator.

Can you please provide an example on how to achieve this or update the library to support it?

dominicusmento avatar Sep 07 '21 15:09 dominicusmento

Related to: #36

justinyoo avatar Sep 07 '21 16:09 justinyoo

@justinyoo Yes, it is related but I actually lean towards a unique resolution. For me it would be better if this issue is solved in a way not to support only custom connector definition but basically any need for custom properties in an openApi document. I assume there are more needs for custom properties.

What I see as solution is to allow us to use something like this: [OpenApiParameter(name: "entityId", In = ParameterLocation.Path, Required = true, Type = typeof(Guid)), Other = new { x_ms_summary = "Some summary", x_ms_url_encoding = "single" }] where 'Other' would just take any object and for each primitive data type property would output a new property.

Also, as we cant use x-ms-summary in C#; underline should be converted to hyphen(-) So my example should output something like: "parameters": [ { "in": "path", "name": "entityId", "required": true, "type": "string", "format": "uuid", "x-ms-summary": "Some summary", "x-ms-url-encoding": "single" } ],

The 'Other' object property should apply for all open api definitions: OpenApiRequestBody, OpenApiParameter... and we also need a way to enter 'x-ms-connector-metadata' which would be the same level as OpenApiInfo..

dominicusmento avatar Sep 08 '21 07:09 dominicusmento

@dominicusmento Thanks for the elaboration. I'll look into that.

justinyoo avatar Feb 10 '22 01:02 justinyoo