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

refactor(backend): Simplify CredentialsField usage + use ProviderName globally #8725

Open
wants to merge 4 commits into
base: reinier/open-1961-implement-github-on-pull-request-block
Choose a base branch
from

Conversation

Pwuts
Copy link
Member

@Pwuts Pwuts commented Nov 20, 2024

  1. For convenience we need a single "directory" of all the providers existing in our system. ProviderName fills that gap.
  2. Defining a credentials input currently requires defining the provider and credential type(s) both on CredentialsMetaInput and CredentialsField. For better DX, this redundancy should be removed, but without compromising schema generation and data validation.

Changes 🏗️

  • refactor(backend): Avoid double specifying provider and cred types on credentials inputs
  • refactor(backend): Use ProviderName enum globally

… `credentials` inputs

- Add `credentials_provider` and `credentials_types` to field schema from `CredentialsMetaInput` instead of `CredentialsField`
  - Remove `provider` and `supported_credential_types` params from `CredentialsField` and all its usages
  - Add `credentials` schema validation logic to `CredentialsMetaInput`, which is called from `BlockSchema.__pydantic_init_subclass__`
- Add missing providers to `ProviderName`
- Replace string literals for provider names with `ProviderName.{PROVIDER}` on blocks and in `CredentialsMetaInput`, `BlockWebhookConfig`, `*OAuthHandler`
- docs: Update instructions for blocks with authentication
@Pwuts Pwuts requested a review from a team as a code owner November 20, 2024 00:22
@Pwuts Pwuts requested review from Bentlybro and majdyz and removed request for a team November 20, 2024 00:22
@github-actions github-actions bot added documentation Improvements or additions to documentation platform/backend AutoGPT Platform - Back end platform/blocks size/l labels Nov 20, 2024
@aarushik93
Copy link
Contributor

Haven't reviewed or tested yet - but is this going to be a breaking change for ppls existing blocks at all?

@majdyz majdyz removed their request for review November 20, 2024 12:52
@Pwuts
Copy link
Member Author

Pwuts commented Nov 20, 2024

is this going to be a breaking change for ppls existing blocks at all?

Nope, this is purely a refactor for DX purposes. Serialization and validation of existing objects shouldn't be affected.

@Pwuts Pwuts force-pushed the reinier/open-1961-implement-github-on-pull-request-block branch from c415bd0 to 397ae0b Compare November 21, 2024 19:09
@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Nov 21, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts documentation Improvements or additions to documentation platform/backend AutoGPT Platform - Back end platform/blocks size/l
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants