Skip to content

Configuration validation #1573

@achingbrain

Description

We don't perform much in the way of validation on loaded libp2p config but we really should.

Ideally each module parsing it's config would use something like superstruct to validate at creation time and fail fast with good feedback to the user as to how they can fix their broken config.

This should negate the need for PRs like #1572 as the config would have been validated in src/config.ts already.

Update

@achingbrain explored a few different options and we determined that zod is perhaps the best choice. Currently Zod is 8kb minified + zipped but based on this discussion there are a few different approaches to making Zod tree-shakeable.

Anyone who takes up this work can continue with the commits on #2133 and have look at the discussion on that PR

Metadata

Assignees

No one assigned

    Labels

    good first issueGood issue for new contributorshelp wantedSeeking public contribution on this issuekind/enhancementA net-new feature or improvement to an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions