-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Python: OpenAPI updates to support multiple operation servers & security config #9670
base: main
Are you sure you want to change the base?
Conversation
INFO_KEY = "info" | ||
SECURITY_KEY = "security" | ||
SERVER_URLS_KEY = "server-urls" | ||
METADATA_KEY = "operation-extensions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making sure: the value of METADATA_KEY
is not metadata
. And I am not seeing it being used.
|
||
|
||
@experimental_class | ||
class RestApiOAuthFlow: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use a dataclass?
|
||
|
||
@experimental_class | ||
class RestApiOAuthFlows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here as well
class RestApiSecurityRequirement(dict[RestApiSecurityScheme, list[str]]): | ||
"""Represents the security requirements used by the REST API.""" | ||
|
||
def __init__(self, dictionary: dict[RestApiSecurityScheme, list[str]]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can the parameter name be more descriptive?
@@ -29,6 +31,18 @@ | |||
logger: logging.Logger = logging.getLogger(__name__) | |||
|
|||
|
|||
@experimental_class | |||
class OperationExtensions(Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we move this into a seperate file, maybe const.py?
Motivation and Context
We currently handle OpenAPI plugins via the kernel, but in a pretty simple way. The changes in this PR are allowing one to define multiple server paths for an operation as well as configure security on the operations either at the operation level or at the "global" spec level (these are included as metadata in the kernel function parameter
additional_parameters
dict).Description
Adds support for OpenAPI plugin:
excluded_operations
on the execution settings were never checked during REST API operation buildingOpenAI plugin
code as it was deprecated by OpenAI and we never handled it in SK Python.Contribution Checklist