refactor(config): migrate to js-core schema validation#161
Draft
thomas-lebeau wants to merge 2 commits into
Draft
refactor(config): migrate to js-core schema validation#161thomas-lebeau wants to merge 2 commits into
thomas-lebeau wants to merge 2 commits into
Conversation
buildConfiguration never read these fields from InitConfiguration, so they were always undefined at runtime and Transport always fell back to BatchSizes.MEDIUM / BatchUploadFrequencies.NORMAL regardless of what a consumer configured. Remove the dead fields and simplify Transport accordingly.
…tion Replace hand-rolled field validators with the shared validateAndBuildConfiguration/ConfigurationSchema API from @datadog/js-core/configuration. Configuration type is now inferred from the schema instead of hand-written. Depends on unpublished js-core configuration work, linked via a local portal: reference in package.json/yarn.lock.
|
thomas-lebeau
commented
Jul 3, 2026
| }); | ||
|
|
||
| it('logs multiple errors when multiple fields are invalid', () => { | ||
| it('stops at the first invalid required field when multiple fields are invalid', () => { |
Contributor
Author
There was a problem hiding this comment.
❓ question: This is a tiny behaviour change, it makes it more aligned with how the browser SDK does. wdyt?
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.
Motivation
Replace the hand-rolled configuration validators with the shared schema-based validation from
@datadog/js-core, reducing duplicated logic and aligning with the rest of the Datadog SDK family. Along the way, deadbatchSize/uploadFrequencyoptions that were never actually wired up were removed.Changes
buildConfigurationto usevalidateAndBuildConfiguration/ConfigurationSchemafrom@datadog/js-core/configuration;Configurationtype is now inferred from the schema instead of hand-written.batchSize/uploadFrequencyoptions fromInitConfigurationand simplifyTransportaccordingly (these fields were never read, soTransportalways fell back toBatchSizes.MEDIUM/BatchUploadFrequencies.NORMAL).commonContext,CrashCollection,OperationCollection,display,DiskValueHistory,Transport) and their tests for the newConfigurationshape.package.json/yarn.lock.Test instructions
yarn testto confirm unit tests pass with the new schema-based configuration.InitConfigurationobjects to confirm validation errors surface as expected.Checklist