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 support for IEndpointConventionBuilder.Finally and fix status-code 200 in PublishingEndpoint #724

Merged

Conversation

haefele
Copy link
Contributor

@haefele haefele commented Feb 11, 2024

During testing, the PublishingEndpoints still displayed the OpenAPI documentation for status-code 200, although it should have been removed in PublishingEndpoint<T>.Configure.

The issue seems to come from the timing of the Configure method; it is called before the Wolverine default metadata is added to the builder.

Specifically, Configure is executed within the HttpChain constructor in applyAttributesAndConfigureMethods.
However, the default metadata is added later during endpoint construction in establishResourceTypeMetadata.
Because of that, it's not possible to remove status-codes 200 or 404 in the Configure method because they are added afterward.

It seems that the ASP.NET Core team ran into the same problem and introduced a IEndpointConventionBuilder.Finally method in .NET 7 that allows metadata modifications after the standard processing.

This pull request implements this Finally method, and fixes the PublishingEndpoint class to correctly remove status-code 200.

This also allows users to remove status-code 404 if they want to.

@jeremydmiller
Copy link
Member

Sweet!

@jeremydmiller jeremydmiller merged commit c42770d into JasperFx:main Feb 15, 2024
1 check passed
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