Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: add synthetic command validate-interfaces #161

Closed
wants to merge 1 commit into from

Conversation

mohammed90
Copy link
Member

@mohammed90 mohammed90 commented Dec 14, 2023

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 their init:

RegisterType("their.new.namespace", []interface{}{(*Interface1)(nil), (*Interface2)(nil)})

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 either All modules conform to their namespaces. or a spit-out of the interface they're missing.

Perhaps validate-types is a better command name? 🤔

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](https://caddyserver.com/docs/extending-caddy) developers to validate their implementation meets the expectation of the host module.
@mohammed90 mohammed90 added the enhancement New feature or request label Dec 14, 2023
@mohammed90 mohammed90 added the discussion 💬 The right solution needs to be found label Dec 14, 2023
@mohammed90 mohammed90 closed this Apr 24, 2024
@mohammed90 mohammed90 added declined This will not be worked on and removed enhancement New feature or request discussion 💬 The right solution needs to be found labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
declined This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant