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

Add extensionScanningEnabled option to @WireMockTest. #2561

Conversation

kyle-winkelman
Copy link
Contributor

@kyle-winkelman kyle-winkelman commented Jan 8, 2024

When using extensions that utilize service loading (e.g. wiremock/wiremock-graphql-extension) it would be preferable to use the declarative option to enable extension scanning, rather than being forced to use the programmatic approach to manually define extensions.

References

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

@kyle-winkelman
Copy link
Contributor Author

Alternatively, I am curious why extensionScanningEnabled isn't true by default. Now that extensions are encouraged to register themselves via service loading, it would make sense to default to picking them up.

@kyle-winkelman
Copy link
Contributor Author

I would be willing to attempt to get all the options available available in WireMockConfiguration also available in WireMockTest annotation if that would be preferred over only adding one option.

@tomakehurst
Copy link
Member

Extension scanning is disabled by default when setting up WireMock programmatically because you might want to run multiple instances with different combinations of extensions, or you might want to programmatically construct an extension for more control.

The WireMockTest annotation is meant as a convenience when you mostly want defaults. We recommend taking the @RegisterExtension approach when you want to customise significantly. However, adding the extension scanning flag to it makes sense I think.

@tomakehurst tomakehurst merged commit d20fb75 into wiremock:master Jan 15, 2024
7 checks passed
@tomakehurst
Copy link
Member

Thanks!

Would you mind creating a documentation PR for this at https://github.com/wiremock/wiremock.org?

@kyle-winkelman kyle-winkelman deleted the wireMockTest-extensionScanningEnabled branch January 15, 2024 15:29
@kyle-winkelman
Copy link
Contributor Author

Here is the documentation PR:
wiremock/wiremock.org#242

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.

2 participants