This is the second PR to add a mechanism to transform OpenAPI documents before creating a kernel plugin from them.
Description
This PR:
Makes the OpenApiDocumentParser public, allowing for the parsing of OpenAPI documents and accessing the instance of the RestApiSpecification class representing the parsed document, which can be modified, by the consumer, if needed, before creating a plugin from it. Currently, it's only possible to modify argument name property of parameters and server variables.
Adds a few kernel extension overload methods to create and import OpenAPI document represented by the RestApiSpecification model class. This is the final element of the transformation mechanism that receives the specification model class instance returned by the parser and transformed by the consumer and creates an SK plugin from it.
Adds the OpenApiDocumentParserOptions class to represent existing parser options and allows adding new ones with no breaking changes.
Replaces the operationsToExclude exclusion list, which is limited to filtering out operations by operation id, with the OperationSelectionPredicate callback that can filter out operations based on id, method, path, and description.
Removes the internalIOpenApiDocumentParser unneeded interface that was not used all that time.
Other: XML comments + OpenAPI specification transformation sample
Motivation and Context
This is the second PR to add a mechanism to transform OpenAPI documents before creating a kernel plugin from them.
Description
This PR:
Makes the
OpenApiDocumentParser
public, allowing for the parsing of OpenAPI documents and accessing the instance of theRestApiSpecification
class representing the parsed document, which can be modified, by the consumer, if needed, before creating a plugin from it. Currently, it's only possible to modify argument name property of parameters and server variables.Adds a few kernel extension overload methods to create and import OpenAPI document represented by the
RestApiSpecification
model class. This is the final element of the transformation mechanism that receives the specification model class instance returned by the parser and transformed by the consumer and creates an SK plugin from it.Adds the
OpenApiDocumentParserOptions
class to represent existing parser options and allows adding new ones with no breaking changes.Replaces the
operationsToExclude
exclusion list, which is limited to filtering out operations by operation id, with theOperationSelectionPredicate
callback that can filter out operations based on id, method, path, and description.Removes the internal
IOpenApiDocumentParser
unneeded interface that was not used all that time.Other: XML comments + OpenAPI specification transformation sample
Contributes to the issue: https://github.com/microsoft/semantic-kernel/issues/4666 The first PR: https://github.com/microsoft/semantic-kernel/pull/9668