Repository navigation
feat: declare the module's settings with settingsSchema() - #28
Merged
Merged
Conversation
The Speculum admin console used to render every module option as a raw key/value text row, because nothing told it what a module understands. Modules now declare their own options, and the console renders controls from that declaration. `ExampleModuleFactory` implements `settingsSchema()` for the two keys the module reads: `greeting` as a string and `tickStep` as a bounded int, each with the default the module code itself falls back to and a line of help text. Being the reference module, it should demonstrate the current shape of the SPI. This needs `SettingSpec`, `SettingType` and `ModuleFactory.settingsSchema()`, added in mirror-api 1.3.0, so `mirrorApi` moves from 1.2.2 to 1.3.0. The method has a default empty implementation upstream, so declaring nothing stays valid for modules that do not want typed controls.
pierrejochem
force-pushed
the
feat/plugin-settings-schema
branch
from
October 4, 2026 11:32
3450b4e to
463fcf4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Mirrors pierrejochem/SpeculumSmartMirror#83 on the reference module.
The Speculum admin console used to render every module option as a raw key/value text row, because nothing told it what a module understands. Modules now declare their own options through
ModuleFactory.settingsSchema(), and the console renders typed controls from that declaration.ExampleModuleFactorydeclares the two keys the module reads:Each
defaultis the fallbackExampleModuleitself reads, which is what the console shows as a hint while a key is unset — deliberately not the same as the starting valuedefaultConfig()ships. The README gains a Module settings section explaining that distinction and listing the available types.API version
This needs
SettingSpec,SettingTypeandModuleFactory.settingsSchema(), somirrorApimoves from1.2.2to1.3.0ingradle/libs.versions.toml.That version is not published yet. CI will fail to resolve
org.speculum:mirror-api:1.3.0until a Speculum release tag publishes it to GitHub Packages. If the next release is numbered differently, that one line is the only change needed.settingsSchema()has a default empty implementation upstream, so declaring nothing stays valid for modules that do not want typed controls — this PR adopts the new SPI because the example module is the reference for how to write one.Verification
./gradlew buildgreen — compile, ktlint, detekt and tests — againstmirror-api:1.3.0published to the local Maven repository from the companion branch. Re-run after rebasing ontomain(Kotlin 2.4.20, Compose 1.12.1, Gradle 9.8.0), all 16 tasks executed from clean.ExampleModuleFactoryTestgoes from 3 tests to 6: the schema covers every keydefaultConfig()ships, the declared types/defaults/bounds match the documented ones, and every entry carries a label and help text.