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

Example API changes programmatic extension defintions #2554

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dirkbolte
Copy link
Contributor

  • create interfaces for different extension points
  • ensure that extensions do not leak into core wiremock

References

#2553

Submitter checklist

  • Recommended: Join WireMock Slack to get any help in #help-contributing or a project-specific channel like #wiremock-java
  • The PR request is well described and justified, including the body and the references
  • The PR title represents the desired changelog entry
  • The repository's code style is followed (see the contributing guide)
  • Test coverage that demonstrates that the change works as expected
  • For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

@tomakehurst
Copy link
Member

I think we could possibly simplify this in most cases by defining a generic value class for this, something like:

public class ParameterisedExtensionDefinition {
    
    private final String name;
    private final Parameters parameters;

    public ParameterisedExtensionDefinition(
            @JsonProperty("name") String name,
            @JsonProperty("parameters") Parameters parameters) {
        this.name = name;
        this.parameters = parameters;
    }

    public String getName() {
        return name;
    }

    public Parameters getParameters() {
        return parameters;
    }
}

Then this could be supplied in all cases where there's an extension name + parameters required.

@tomakehurst tomakehurst self-assigned this Jan 30, 2024
@dirkbolte dirkbolte force-pushed the support-programmatic-extension-definition branch 3 times, most recently from 98d7fec to 05c4111 Compare February 4, 2024 21:57
@dirkbolte dirkbolte marked this pull request as ready for review February 4, 2024 21:57
@dirkbolte dirkbolte requested a review from a team as a code owner February 4, 2024 21:57
@dirkbolte
Copy link
Contributor Author

@tomakehurst I updated the PR. The proposed ParameterisedExtensionDefinition is in there but created specific implementations to ensure type safety: I want to prevent that an event listener definition is registered as matcher.

I'm working on a usage thereof in the state extension. Will link to it once it's in a presentable state..

- created common ParameterisedExtensionDefinition and use it in other
  definitions
- create additional definition classes for different extension points
- ensure that extensions do not leak into core wiremock
@dirkbolte dirkbolte force-pushed the support-programmatic-extension-definition branch from 05c4111 to dd73bad Compare February 4, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants