Skip to content

Add NextBot configuration settings to adapter config#2

Merged
Arispex merged 3 commits intomainfrom
claude/merge-nextbot-config-branches-euLqQ
Apr 8, 2026
Merged

Add NextBot configuration settings to adapter config#2
Arispex merged 3 commits intomainfrom
claude/merge-nextbot-config-branches-euLqQ

Conversation

@Arispex
Copy link
Copy Markdown
Owner

@Arispex Arispex commented Apr 8, 2026

Summary

This PR introduces a new NextBotSettings configuration section to the adapter configuration, allowing users to specify the NextBot base URL and authentication token. The configuration system has been enhanced to properly merge user-provided partial configurations with defaults while preserving explicitly set values.

Key Changes

  • New NextBotSettings model: Added a new record to hold baseUrl and token configuration properties with sensible defaults
  • Updated NextBotAdapterConfig: Integrated NextBotSettings as the first configuration section, ensuring it serializes before other sections
  • Improved configuration merging: Replaced simple deserialization with JSON object merging using Newtonsoft.Json's JObject.Merge() to properly handle partial configurations
    • Merges user-provided values with defaults while ignoring explicit nulls
    • Preserves user values for nested fields when completing sibling fields
    • Maintains proper field ordering in serialized output
  • Enhanced test coverage: Added comprehensive tests for partial configuration handling, including:
    • Missing nested string and boolean fields
    • Preserving user values when completing siblings
    • Ignoring explicit null values from users
    • Dot notation support for updating nested NextBot fields

Implementation Details

  • The BuildCompletedJson() method now uses JSON object merging instead of object deserialization/reserializaton, which better preserves the structure and handles partial configurations gracefully
  • MergeNullValueHandling.Ignore ensures that explicit nulls in user configs are replaced with defaults
  • All existing configuration functionality remains backward compatible

https://claude.ai/code/session_01AYUN56EDTEmArpwGNGDiCX

claude added 3 commits April 8, 2026 05:52
Previously EnsureConfigComplete only replaced entire top-level sections
when they were missing. A deleted nested field (e.g. whitelist.denyMessage
or whitelist.caseSensitive) would be deserialized into null / CLR default
and then written straight back to disk, because WithDefaults() only guards
against Whitelist / LoginConfirmation being wholly null.

Rewrite the completion path to deep-merge the user config on top of a
JObject produced from NextBotAdapterConfig.Default, using
MergeNullValueHandling.Ignore so explicit nulls from the user don't clobber
defaults either. Load() goes through the same merge so in-memory reads see
the same filled values.

Add regression tests covering missing nested string/bool fields, sibling
preservation, and explicit-null handling.

https://claude.ai/code/session_01FboMbpgWhsbQ2vya4ARJUz
Introduce a new top-level "nextbot" section in NextBotAdapter.json
with two string fields, baseUrl and token, declared as the first
property of NextBotAdapterConfig so they serialize at the top of
the file. EnsureConfigComplete auto-injects the section into
existing on-disk configs via WithDefaults, and the existing config
REST API picks them up automatically through JObject.SelectToken
without any endpoint changes.
@Arispex Arispex merged commit bed9fa0 into main Apr 8, 2026
1 check passed
@Arispex Arispex deleted the claude/merge-nextbot-config-branches-euLqQ branch April 8, 2026 07:28
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.

2 participants