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

[connector builder]: Support declaring & exporting stream schemas in the UI #19499

Closed
3 tasks done
Tracked by #19995
sherifnada opened this issue Nov 16, 2022 · 2 comments
Closed
3 tasks done
Tracked by #19995
Assignees
Labels

Comments

@sherifnada
Copy link
Contributor

sherifnada commented Nov 16, 2022

Tell us about the problem you're trying to solve

a user of the connector builder UI needs the ability to specify stream schemas in the UI such that when they click "export connector" the schemas they specified in the UI are the same ones that actually run in the connector itself outside of the connector builder.

Implementation options

Bundle into manifest
The most obvious way to achieve this is to bundle schema definitions into the manifest itself. This way the user maintains only one file they download from the UI, which they copy-paste into their connector directory to build the connector.

The pro of this approach is that it is the most portable/lightweight
The con is that it makes the YAML file very large/maybe unreadable

Implementation steps:

  1. Create StaticSchemaLoader class which takes a schema mapping object as parameter
  2. Add StaticSchemaLoader to the class type registry
  3. Update one of the connectors to use the new schema definition:
  applications_stream:
    $ref: "*ref(definitions.base_incremental_stream)"
    $options:
      name: "applications"
      path: "applications"
    stream_cursor_field: "applied_at"
    schema_loader:
      type: "StaticSchema"
      schema:
        status:
          type: string
        source:
          type: object
          properties:
            public_name:
              type: string
            id:
              type: integer
    <...>
    retriever:
      $ref: "*ref(definitions.retriever)"
      requester: "*ref(definitions.requester)"
      stream_slicer:
        request_cursor_field: "created_after"
        cursor_field: "applied_at"
        class_name: source_greenhouse.components.GreenHouseSlicer

Continue using schemas/ folders pattern
Instead of bundling, we could also change the behavior of the "export YAML" button to download instead a zip folder which contains the YAML manifest in addition to a schemas/ folder, containing one .json schema file per stream. This would mirror exactly the way we typically specify schemas today.

The pro of this approach is that it keeps the YAML file clean
The con of this approach is that it complicates how a user consumes a downloaded connector

Acceptance Criteria

  • Follow implementation steps for "bundle" option 1 above
  • At least 1 existing connector defines its stream schemas inline
  • The output of the discover method must be unchanged for connectors we migrated

Out of scope:

  • Schema auto-detection

Open questions

  • do we want to rename SchemaLoader to Schema since we're not always loading it from a file?
@girarda
Copy link
Contributor

girarda commented Dec 6, 2022

notes:

  • UX feels worse using a zip file
  • moving the spec to the manifest was well received by early users
  • out of scope: UI changes. @girarda to create a follow up ticket

@clnoll
Copy link
Contributor

clnoll commented Dec 8, 2022

Based on @girarda's notes I'll proceed with the first implementation option, moving the spec to the manifest.
cc @sherifnada

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants