Files
semantic-kernel/samples/dotnet
SergeyMenshykh e0a439decd Support complex payload for OpenAPI skills (#680)
### Motivation and Context

This PR changes the way payload/body for POST and PUT operations is
resolved.

This change is required to support the following scenarios:
- A POST/PUT operation payload has more than one property with the same
name - { 'sender': { '**name**': 'val1'}, 'receiver': {'**name**':
'val2'} }
- A POST/PUT operation payload has a property of array of objects with
the same name - { 'receivers': [ {'**name**':'val1'},
{'**name**':'val2'} ] }
- A POST/PUT operation payload metadata is missing.

### Description
Curent RestApi functionality builds operation payload dynamically and
relies on:
- Payload metadata that describes the payload/body schema/shape and
usually obtained from OpenAPI documents.
- Arguments resolution mechanism that resolves payload parameters in SK
context.

As practice shows, in some cases (malformed OpenAPI document), the
payload metadata is missing which means that it's not possible to create
operation payload dynamically and as a result it's not possible to run
the operation. In other cases, if a payload has two of more parameters
with the same name or parameters of array type with object items it is
impossible to resolve them from SK context.

To support these scenarios, the RestApi functionality does not build the
payload dynamically anymore and instead relies on either AI or a caller
of the APi to create/supply it. To help AI generate the payload, a new
schema property will be added to the ParameterView class to describe the
payload structure/shape to AI.
2023-04-27 22:23:30 +00:00
..