Add NextBot configuration settings to adapter config#2
Merged
Conversation
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.
…ix-config-defaults-MW4La'
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.
Summary
This PR introduces a new
NextBotSettingsconfiguration 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
NextBotSettingsmodel: Added a new record to holdbaseUrlandtokenconfiguration properties with sensible defaultsNextBotAdapterConfig: IntegratedNextBotSettingsas the first configuration section, ensuring it serializes before other sectionsJObject.Merge()to properly handle partial configurationsImplementation Details
BuildCompletedJson()method now uses JSON object merging instead of object deserialization/reserializaton, which better preserves the structure and handles partial configurations gracefullyMergeNullValueHandling.Ignoreensures that explicit nulls in user configs are replaced with defaultshttps://claude.ai/code/session_01AYUN56EDTEmArpwGNGDiCX