Skip to content

.Net: Mechanism for transforming OpenAPI documents - part2 #9689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

SergeyMenshykh
Copy link
Member

@SergeyMenshykh SergeyMenshykh commented Nov 13, 2024

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:

  1. 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.

  2. 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.

  3. Adds the OpenApiDocumentParserOptions class to represent existing parser options and allows adding new ones with no breaking changes.

  4. 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.

  5. Removes the internal IOpenApiDocumentParser unneeded interface that was not used all that time.

  6. Other: XML comments + OpenAPI specification transformation sample

Contributes to the issue: #4666
The first PR: #9668

@SergeyMenshykh SergeyMenshykh added openapi Issues related to the OpenAPI function importer Ignite Features planned for next Ignite conference labels Nov 13, 2024
@SergeyMenshykh SergeyMenshykh self-assigned this Nov 13, 2024
@SergeyMenshykh SergeyMenshykh requested a review from a team as a code owner November 13, 2024 19:14
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Nov 13, 2024
@markwallace-microsoft markwallace-microsoft added the kernel Issues or pull requests impacting the core kernel label Nov 14, 2024
…ernelExtensions.ImportPluginFromOpenApi methods with the experimental attribute
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Nov 14, 2024
Merged via the queue into microsoft:main with commit d6605d7 Nov 14, 2024
15 checks passed
@SergeyMenshykh SergeyMenshykh deleted the name-resolution-mechanism-part2 branch November 14, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ignite Features planned for next Ignite conference kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code openapi Issues related to the OpenAPI function importer
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants