Skip to content

Use the built-in JSON stream configuration provider - #21

Merged
Kralizek merged 13 commits into
masterfrom
agent/use-json-stream-provider
Aug 24, 2026
Merged

Use the built-in JSON stream configuration provider#21
Kralizek merged 13 commits into
masterfrom
agent/use-json-stream-provider

Conversation

@Kralizek

@Kralizek Kralizek commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Summary

Replace the custom JSON-to-configuration flattening pipeline with the built-in .NET JSON stream configuration provider.

  • serialize objects directly into a MemoryStream with Utf8JsonWriter
  • keep both reflection-based and JsonTypeInfo<T> serialization paths
  • encode root sections directly in the JSON document, including multi-level configuration paths such as Features:Payments
  • feed the resulting stream to JsonStreamConfigurationSource
  • preserve normal AddObject precedence by appending the source
  • preserve AddObjectAsFallback precedence by inserting the source at index 0
  • capture the object state when the configuration source is registered rather than deferring serialization until Build()
  • remove the custom JsonConfigurationFlattener, ObjectConfigurationSource, and ObjectConfigurationProvider
  • move the remaining behavioral coverage to public integration tests
  • add Microsoft.Extensions.Configuration.Json as the implementation dependency

Validation

The test suite was expanded before the implementation change and passed against the previous flattener-based implementation. The new stream-provider implementation then passed the same contract before cleanup. After removing the obsolete implementation and migrating the remaining edge cases to integration coverage, the full CI pipeline is green again.

Integration coverage includes direct configuration keys, binding into different but equivalent types, nested objects, fallback precedence, multi-level root sections, JsonTypeInfo<T>, scalar values with an explicit root, and rejection of rootless scalar JSON.

Public API

No public API changes are introduced:

AddObject<T>(...)
AddObject<T>(..., JsonTypeInfo<T>, ...)
AddObjectAsFallback<T>(...)
AddObjectAsFallback<T>(..., JsonTypeInfo<T>, ...)

@Kralizek
Kralizek marked this pull request as ready for review August 23, 2026 20:12
@Kralizek
Kralizek merged commit ea5368c into master Aug 24, 2026
1 check passed
@Kralizek
Kralizek deleted the agent/use-json-stream-provider branch August 24, 2026 00:57
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