Repository navigation
feat: add the shared config checks and the struct walk - #2
Merged
Merged
Conversation
…rvices share CheckListenAddress, IsLoopbackAddress, ListenAddressesConflict, CheckURL, CheckHTTPURL and CheckNonNegative, lifted from connect's configrules so connect-control and later services need not write them again. Each reports at the collector it is given and treats an empty value as not set. Refs #1 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ
…hare Lifted from connect's configschema and its config naming test. Fields reads a struct's keys as the loader does, inlining squashed and embedded structs; Walk visits every reachable struct once; Defaults records what a constructor sets, as a file writes it; the scalar patterns describe weakly typed values; and KeyNamingProblems finds keys that are not kebab-case or end in config. Only the generic parts move: building the JSON Schema stays with the generator, so this package depends on the standard library alone. Refs #1 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ
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
The parts of #1 that belong in this module, lifted from connect's
configrules,configschemaand config naming test so connect-control and later services need not write them again.configcheckgains the checks every service repeats. Each reports at the collector it is given, and treats an empty value as not set:CheckListenAddress,IsLoopbackAddress,ListenAddressesConflictCheckURL(a URL with a host),CheckHTTPURLCheckNonNegativeconfigwalk(new, standard library only) reads config structs the way the loader does:Fieldsreturns a struct's keys, inlining squashed and embedded structs;Walkvisits every reachable struct once, including self-referencing ones;SquashedFieldslists named squashed structs for generators that inline only embedded ones.Defaultsrecords what a constructor sets, as a file writes it (a duration as5s).IntegerPattern,UnsignedPattern,NumberPattern,DurationPatternandBoolStringsdescribe weakly typed scalars.KeyNamingProblemsis the naming-rule test helper: keys must be kebab-case and must not end inconfig.Only the generic parts move. Building the JSON Schema stays with connect's generator, so this module does not take on
invopop/jsonschema.Examples with checked output:
ExampleCollector(already present),ExampleCheckListenAddress,ExampleListenAddressesConflict,ExampleFields,ExampleKeyNamingProblems.The TLS and OIDC checks the issue lists live with their types, in
dioad/net/tlsanddioad/auth/oidc. They are committed on branches in those repos and will be raised once this is merged and released.Fixes #1
🤖 Generated with Claude Code
https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ