Skip to content

Conversation

@stmh
Copy link
Collaborator

@stmh stmh commented Jan 26, 2026

Summary

Implements GitHub issue #5: REST endpoint for dynamic enum options.

This feature allows select fields in config forms to fetch their options from a REST API at runtime, without requiring a full dynamic schema replacement.

Changes

  • New OptionsEndpoint interface for configuring how to fetch options from REST endpoints
  • New optionsService.ts with fetching, caching (TTL-based), and response normalization
  • New templateResolver.ts - extracted shared URL template resolution from dynamicSchemaService
  • ConfigForm integration - pre-fetches options via $effect and merges into enrichedSchema
  • OpenAPI spec updated with OptionsEndpoint schema
  • Comprehensive tests - 27 unit tests + 7 integration tests

Example Usage

const schema: ConfigSchema = {
  type: "object",
  properties: {
    api_key: {
      type: "string",
      title: "API Key",
      optionsEndpoint: {
        url: "/api/flowdrop/secrets",
        valuePath: "name",
        labelPath: "label",
        cacheTtl: 300000
      }
    }
  }
};

Verification

  • Type check: 0 errors (npm run check)
  • Tests: 228 tests pass (npm test)
  • OpenAPI spec bundled successfully

Closes #5

@stmh stmh force-pushed the feat/options-endpoint branch from 2d52158 to 5a5efe1 Compare January 27, 2026 00:00
…drop-io#5)

Adds the ability for select fields in config forms to fetch their options
from a REST API at runtime, without requiring full dynamic schema replacement.

Changes:
- Add OptionsEndpoint interface for configuring runtime option fetching
- Create optionsService.ts with fetch, cache, and normalization logic
- Extract templateResolver.ts as shared utility from dynamicSchemaService
- Integrate options loading into ConfigForm.svelte with $effect and enrichedSchema
- Update OpenAPI spec with OptionsEndpoint schema
- Add unit tests (27) and integration tests (7)
- Add mise.toml for Node 20 version pinning

Closes flowdrop-io#5
@stmh stmh force-pushed the feat/options-endpoint branch from 5a5efe1 to e9a9182 Compare January 27, 2026 00:05
@stmh
Copy link
Collaborator Author

stmh commented Jan 27, 2026

hi @d34dman

here's a vibecoded submission for having dynamic options for select fields. So we do not need to use dynamicOptions just for a dynamic select.

Will try to test it tomorrow against a backend, but would be good to know if you are open for the contribution.

Not sure, why the ci is failing...

@d34dman
Copy link
Collaborator

d34dman commented Jan 31, 2026

fixed in 0.0.44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: REST endpoint for dynamic enum options

2 participants