Skip to content

Credentials.get_schema/1 does not respect OPENFN_ADAPTORS_REPO when LOCAL_ADAPTORS=true #4885

Description

@midigofrank

Summary

When LOCAL_ADAPTORS=true and OPENFN_ADAPTORS_REPO are set, Lightning loads adaptor code/versions from the local repo, but the credential form loads credential schemas from a completely independent path that does not respect OPENFN_ADAPTORS_REPO. As a result the credential form can render a schema that diverges from the local adaptor.

Observed behaviour

The two paths are independent:

Adaptor code (respects OPENFN_ADAPTORS_REPO):

  • lib/lightning/config/bootstrap.ex:206-235 reads OPENFN_ADAPTORS_REPO + LOCAL_ADAPTORS into config :lightning, Lightning.AdaptorRegistry, local_adaptors_repo: ...
  • lib/lightning/adaptor_registry.ex:94 (handle_continue/2) branches on local_adaptors_repo and calls read_adaptors_from_local_repo/1, reading from <repo_path>/packages/<package>.

Credential schemas (does NOT respect it):

  • lib/lightning_web/live/credential_live/credential_form_component.ex:641 calls Credentials.get_schema/1.
  • lib/lightning/credentials.ex:577-588 (get_schema/1) reads Application.fetch_env(:lightning, :schemas_path)<schemas_path>/<schema_name>.json.
  • schemas_path is configured separately at lib/lightning/config/bootstrap.ex:237-243 from SCHEMAS_PATH (default ./priv, i.e. priv/schemas).
  • That directory is populated only by mix lightning.install_schemas, which downloads configuration-schema.json from the jsdelivr CDN (lib/mix/tasks/install_schemas.ex:102-103) — i.e. the published package versions on NPM.

Nothing in the get_schema/1 path consults Lightning.AdaptorRegistry's local_adaptors_repo.

Impact

With local adaptors enabled, adaptor code/versions come from the local repo, but the credential form's schema still comes from whatever was last installed from the CDN via mix lightning.install_schemas. If a local adaptor's configuration-schema.json differs from the published version, the credential form will not reflect the local schema.

Environment

  • LOCAL_ADAPTORS=true
  • OPENFN_ADAPTORS_REPO=<path to local adaptors repo>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    New Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions