cmd: add synthetic command validate-interfaces
#161
Closed
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.
The command is injected when running xcaddy with one of Caddy's commands, though
validate-interfaces
does not exist in Caddy itself. This is useful for guest modules developers to validate their implementation meets the expectation of the host module. Developers who introduce new caddy namespaces and want to participate in the validation process may include code as such in theirinit
:There's dependency on caddyserver/caddy#4838 because the Caddy executable built for the development process expects a version of Caddy that contains certain functions, namely
caddy.ConformsToNamespace
. I'm not sure if this will break any workflow. We can brainstorm an idea to conditionally inject it, but I can't think of something now.With this addition, the developer of a Caddy module can run
xcaddy validate-interfaces
to have a custom Caddy built to receive a message of eitherAll modules conform to their namespaces.
or a spit-out of the interface they're missing.Perhaps
validate-types
is a better command name? 🤔