Skip to content

feat(registration): support addons.preset flag to switch app base template - #140

Merged
mazhe-nerd merged 2 commits into
v2_mainfrom
feature/support-addons-preset-flag-per-open-pages-spec
Jul 8, 2026
Merged

mazhe-nerd merged 2 commits into
v2_mainfrom
feature/support-addons-preset-flag-per-open-pages-spec

Conversation

@mazhe-nerd

@mazhe-nerd mazhe-nerd commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

What

Add support for the top-level preset boolean field in the addons parameter of register_app / aregister_app.

  • preset omitted or True (default): the app is created on top of the default base template, with addons items merged in — same behavior as before.
  • preset: False: switches to the minimal base template, so the final app config only contains what addons explicitly declares. In this mode an addons payload without any incremental item is also valid.

Why

The open platform app-creation page now supports choosing the base template through the encoded addons query parameter. SDK callers that need fully self-declared app configs (avoiding drift from the default template) can now opt in with addons={"preset": False, ...}.

Behavior details

  • preset must be a real boolean; 1 / 0 / strings / None are rejected with ValueError: addons.preset must be a boolean.
  • An explicitly passed value is encoded verbatim into the payload; when omitted, the key is absent and the encoded bytes are unchanged from previous versions (fully backward compatible, error messages for existing invalid inputs are byte-identical).
  • The existing key whitelist and string-list validation are unchanged; preset does not relax them.

Docs

README.md / README.zh.md: added the addons.preset row to the register_app parameter table plus a usage note.

Tests

  • 12 new unit tests in lark_oapi/scene/registration/test_app_preset.py: encoding round-trips (False alone, False+scopes, explicit True), non-boolean rejection (incl. the bool-is-int trap), whitelist regression, empty-payload validity matrix, QR-URL query pass-through, sync/async full-flow with mocked transport, and a guard pinning that the key is omitted when not provided.
  • All pre-existing tests pass unmodified.

Version

1.7.0 → 1.7.1 (patch).

@mazhe-nerd
mazhe-nerd merged commit dcec8e4 into v2_main Jul 8, 2026
2 checks passed
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.

1 participant