domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.22k stars 1.31k forks source link

Consider making more types internal #2805

Open martincostello opened 5 months ago

martincostello commented 5 months ago

Review the public API and see if there's any types that are public that don't need to be, such as SwaggerMiddleware. That gives us more agility to change implementation details, like adding new constructor overloads (see #2801).

It may be that some types don't need to be public and are only done so through oversight or to be accessible to unit tests. In the case of tests, it might be too tricky to do with the way that some assemblies are strong named and others aren't, as [InternalsVisibleTo] requires IVT'd assemblies to also be strong named, and all dependencies of a project need to be strong named for it to be, which creates issues where a test project depends on one project that is signed and another that isn't.

Context: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/pull/2418#discussion_r1566514729

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

ahoke-cr commented 1 month ago

You can also specify InternalsVisibleTo inside the .csproj file which doesn't require any funny business with assemblies:

<ItemGroup>
     <InternalsVisibleTo Include='Swashbuckle.AspNetCore.SomeTestProject' />
</ItemGroup
martincostello commented 1 month ago

Good point, we do that here already:

https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/28128ebb4e6d809686036d1e4e45b6cd08e5d6ba/src/Swashbuckle.AspNetCore.SwaggerGen/Swashbuckle.AspNetCore.SwaggerGen.csproj#L14-L17