Skip to content

Conversation

@Bahati308
Copy link
Contributor

Add comprehensive extension support allowing custom apps (e.g., AnthroCollect)
to define their own question types, renderers, functions, and schema definitions
without requiring changes to ODE core.

Architecture:

  • Formulus: Extension discovery and loading via ExtensionService
  • Synkronus: Extension validation during bundle upload
  • Formplayer: Runtime dynamic import and registration

Key Features:

  • Discovers ext.json files at app-level (/forms/ext.json) and form-level
    (/forms/{formName}/ext.json) with merge precedence
  • Validates extension structure, module existence, and renderer references
  • Dynamically loads and registers extension renderers at runtime
  • Supports extension definitions for JSON Schema $ref resolution
  • Graceful error handling with actionable validation messages

Files Added:

  • formulus/src/services/ExtensionService.ts
  • formulus-formplayer/src/extensionLoader.ts
  • EXTENSION_IMPLEMENTATION.md

Files Modified:

  • formulus/src/services/index.ts (export ExtensionService)
  • formulus/src/components/FormplayerModal.tsx (load and pass extensions)
  • formulus/src/webview/FormulusInterfaceDefinition.ts (add ExtensionMetadata)
  • formulus-formplayer/src/App.tsx (register extension renderers)
  • formulus-formplayer/src/FormulusInterfaceDefinition.ts (add ExtensionMetadata)
  • synkronus-cli/pkg/validation/bundle.go (add extension validation)

Constraints Met:

  • No app logic in ODE core
  • No hard-coded app paths
  • No use of eval
  • Backwards compatible (extensions optional)
  • Declarative only (no JS imports in ExtensionService)

Bahati308 and others added 6 commits January 6, 2026 14:21
Implement extension discovery, validation, and runtime registration
allowing custom apps to define their own renderers, functions, and
schema definitions without modifying ODE core.

- ExtensionService discovers and merges ext.json files
- Synkronus validates extension structure and references
- Formplayer dynamically loads and registers extensions at runtime
- Full backwards compatibility maintained

See EXTENSION_IMPLEMENTATION.md for details.
@Bahati308 Bahati308 marked this pull request as ready for review January 8, 2026 13:08
@Bahati308 Bahati308 self-assigned this Jan 9, 2026
@Bahati308 Bahati308 added the feature New functionality or capability label Jan 9, 2026
r0ssing
r0ssing previously approved these changes Jan 11, 2026
Copy link
Contributor

@r0ssing r0ssing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @Bahati308. I think this is exactly what we need! 👍

Would it be possible to add a an example of this system to our malaria demo app?
That way we could see if it works end-to-end, by:

  • Defining the appropriate ext.json (e.g. a "Mosquito size" question type, with 5 sketches of mosquitoes in different sizes or something)
  • Defining the appropriate renderer +tester
  • Defining the question in jsonforms schema/ui json

Mishael-2584
Mishael-2584 previously approved these changes Jan 12, 2026
Copy link
Contributor

@Mishael-2584 Mishael-2584 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @Bahati308 would love to see how this takes shape with the forms we have

@Bahati308 Bahati308 dismissed stale reviews from Mishael-2584 and r0ssing via a957cdd January 12, 2026 16:26
Copy link
Contributor

@r0ssing r0ssing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid work! I really think this enables a rich ecosystem of extensions for the custom apps👌😃

@Bahati308
Copy link
Contributor Author

Solid work! I really think this enables a rich ecosystem of extensions for the custom apps👌😃

thanks @r0ssing , let's go for it.

@Bahati308 Bahati308 merged commit c506ca3 into OpenDataEnsemble:dev Jan 12, 2026
15 checks passed
Mishael-2584 added a commit that referenced this pull request Jan 14, 2026
- Add support for v1 extension format (PR #18) with renderer/tester objects
- Maintain backward compatibility with legacy format (PR #226)
- Add 'html' to known formats list for HtmlLabelRenderer support
- Fix ext.json file handling to prevent form validation errors
- Add comprehensive test cases for both formats

Fixes bundle upload failures for AnthroCollect and other apps using v1 format.
Tested with real bundle (bundle-v1.0.6.zip) - validation passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New functionality or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants