Skip to content
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

source-genesys: add discriminator to endpoint config's credentials #2144

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions source-genesys/source_genesys/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
}
)

OAuth2Credentials = ClientCredentialsOAuth2Credentials
# The class name appears in the UI's Authentication section, so we wrap the non-user friendly name in a slighly better name.
# TODO(alex): figure out why the class name is appearing in the UI & determine if there's some property to set that overrides it.
class OAuth(ClientCredentialsOAuth2Credentials):
pass


def default_start_date():
Expand Down Expand Up @@ -55,8 +58,9 @@ class EndpointConfig(BaseModel):
] = Field(
title="Genesys Cloud Domain"
)
credentials: OAuth2Credentials = Field(
credentials: OAuth = Field(
title="Authentication",
discriminator="credentials_title"
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"protocol": 3032023,
"configSchema": {
"$defs": {
"ClientCredentialsOAuth2Credentials": {
"OAuth": {
"properties": {
"credentials_title": {
"const": "OAuth Credentials",
Expand All @@ -29,7 +29,7 @@
"client_id",
"client_secret"
],
"title": "ClientCredentialsOAuth2Credentials",
"title": "OAuth",
"type": "object"
}
},
Expand Down Expand Up @@ -62,7 +62,17 @@
"type": "string"
},
"credentials": {
"$ref": "#/$defs/ClientCredentialsOAuth2Credentials",
"discriminator": {
"mapping": {
"OAuth Credentials": "#/$defs/OAuth"
},
"propertyName": "credentials_title"
},
"oneOf": [
{
"$ref": "#/$defs/OAuth"
}
],
"title": "Authentication"
}
},
Expand Down
Loading