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 ProtoDefinitionHelper.FromDirectory #1263

Open
wants to merge 10 commits into
base: 1.7.x
Choose a base branch
from
Open

Conversation

StefH
Copy link
Collaborator

@StefH StefH commented Mar 13, 2025

No description provided.

Verified

This commit was signed with the committer’s verified signature.
ronjaquensel Ronja Quensel
@StefH StefH added the bug label Mar 13, 2025
@StefH StefH self-assigned this Mar 13, 2025
StefH added 2 commits March 13, 2025 19:26
.

Verified

This commit was signed with the committer’s verified signature.
ronjaquensel Ronja Quensel
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 62.41135% with 53 lines in your changes missing coverage. Please review.

Project coverage is 39.15%. Comparing base (be55022) to head (7a0e136).

Files with missing lines Patch % Lines
src/WireMock.Net/Util/ProtoDefinitionHelper.cs 59.61% 21 Missing ⚠️
src/WireMock.Net/Extensions/StringExtensions.cs 24.00% 16 Missing and 3 partials ⚠️
src/WireMock.Net/Util/WireMockProtoFileResolver.cs 62.50% 6 Missing ⚠️
src/WireMock.Net/Models/ProtoDefinitionData.cs 88.88% 3 Missing ⚠️
....Net/RequestBuilders/Request.WithBodyAsProtoBuf.cs 81.25% 3 Missing ⚠️
src/WireMock.Net/Server/RespondWithAProvider.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            1.7.x    #1263      +/-   ##
==========================================
+ Coverage   34.94%   39.15%   +4.21%     
==========================================
  Files         201      202       +1     
  Lines       33266    34146     +880     
==========================================
+ Hits        11624    13370    +1746     
+ Misses      21087    20235     -852     
+ Partials      555      541      -14     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

StefH added 4 commits March 13, 2025 20:18
.
var modifiedContent = !content.StartsWith(comment) ? $"{comment}\n{content}" : content;
var key = Path.GetFileNameWithoutExtension(filePath);

dictionary.Add(key, modifiedContent);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why the filename isn't used as the key here. That would make resolving imports work without the comment.
The only change needed is to replace \ with / of the relative path.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm curious why the filename isn't used as the key here.
The filename is used: var key = Path.GetFileNameWithoutExtension(filePath);

That would make resolving imports work without the comment.
The IProtoFileResolver is used in ProtobufJsonConverterFileSystem.cs which is required by protobuf-net to resolve additional files.

Copy link
Contributor

Choose a reason for hiding this comment

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

From my debugging, it tries to resolve based on the import filename, which would match the key in the dictionary based on the relative file path, no?

StefH added 3 commits March 15, 2025 15:55
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants