Skip to content

Swagger plugins support#3056

Merged
martincostello merged 10 commits intodomaindrivendev:masterfrom
jvmlet:master
Sep 1, 2024
Merged

Swagger plugins support#3056
martincostello merged 10 commits intodomaindrivendev:masterfrom
jvmlet:master

Conversation

@jvmlet
Copy link
Contributor

@jvmlet jvmlet commented Aug 29, 2024

Pull Request

The issue or feature being addressed

Closes #3049

Copy link
Collaborator

@martincostello martincostello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests.

@martincostello
Copy link
Collaborator

I also don't see tests for request/response interceptors.

[Fact]
public async Task IndexUrl_ReturnsInterceptors_IfConfigured()
{
var client = new TestSite(typeof(CustomUIConfig.Startup)).BuildClient();
var response = await client.GetAsync("/swagger/index.js");
var content = await response.Content.ReadAsStringAsync();
Assert.Contains("\"RequestInterceptorFunction\":", content);
Assert.Contains("\"ResponseInterceptorFunction\":", content);
}

@jvmlet
Copy link
Contributor Author

jvmlet commented Aug 29, 2024

Please add tests.

There is no infrastructure in integration tests to evaluate the index.html in browser (like Selenium) and I also don't see tests for request/response interceptors.

@martincostello
Copy link
Collaborator

martincostello commented Aug 29, 2024

#3056 (comment)

We don't test with Selenium, we test that the desired rendering effect is in the HTML as in the examples of existing tests I've directed you to.

@jvmlet
Copy link
Contributor Author

jvmlet commented Aug 29, 2024

I also don't see tests for request/response interceptors.

[Fact]
public async Task IndexUrl_ReturnsInterceptors_IfConfigured()
{
var client = new TestSite(typeof(CustomUIConfig.Startup)).BuildClient();
var response = await client.GetAsync("/swagger/index.js");
var content = await response.Content.ReadAsStringAsync();
Assert.Contains("\"RequestInterceptorFunction\":", content);
Assert.Contains("\"ResponseInterceptorFunction\":", content);
}

Great, I would expect to see test that actually asserts the js function functionality , not the template. With plugins it always there ....

@martincostello
Copy link
Collaborator

I would expect to see test that actually asserts the js function functionality

That would be testing swagger-ui itself, which isn't our code.

@jvmlet
Copy link
Contributor Author

jvmlet commented Aug 29, 2024

I would expect to see test that actually asserts the js function functionality

That would be testing swagger-ui itself, which isn't our code.

Then how do you suggest to test this line ? Without Selenium I can't assert that the plugin was loaded ...

@martincostello
Copy link
Collaborator

Then how do you suggest to test this line ? Without Selenium I can't assert that the plugin was loaded ...

Do what the tests I already directed you to do - check that the text of the configured plugins is in the rendered document.

@jvmlet
Copy link
Contributor Author

jvmlet commented Aug 29, 2024

Please add tests.

added

@martincostello martincostello added this to the v6.8.0 milestone Sep 1, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 1, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.53%. Comparing base (90f302d) to head (b7b55d4).
Report is 13 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3056      +/-   ##
==========================================
+ Coverage   90.49%   90.53%   +0.03%     
==========================================
  Files          76       76              
  Lines        3063     3095      +32     
  Branches      496      504       +8     
==========================================
+ Hits         2772     2802      +30     
- Misses        291      293       +2     
Flag Coverage Δ
Linux 90.53% <100.00%> (+0.03%) ⬆️
Windows 90.53% <100.00%> (+0.03%) ⬆️
macOS 90.53% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This was referenced Feb 18, 2026
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.

[Feature request]: Expose plugins settings in swagger ui config API

4 participants

Comments