You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have IBindableFromHttpContext<CurrentLanguage> endpoint parameter that I am parsing from language header.
Problem is that it does not show up on OpenAPI/Swagger as a header parameter field.
I need "Accept-Language" header parameter to show up for endpoints that have CurrentLanguage Parameter
What I have tried
I believe for that CurrentLanguage should implement IEndpointParameterMetadataProvider and add corresponding metadata, but I have been unable to do so.
Just adding builder.Metadata.Add(new FromHeaderAttribute { Name = "Accept-Language" }); does nothing.
I also tried adding LanguageParameterMetadata(ParameterInfo parameter) : IParameterBindingMetadata metadata but thats no-go either, since that interface contains ParameterInfo parameter, which has a protected contructor and CustomAttributes are not editable.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem:
I have
IBindableFromHttpContext<CurrentLanguage>endpoint parameter that I am parsing from language header.Problem is that it does not show up on OpenAPI/Swagger as a header parameter field.
I need "Accept-Language" header parameter to show up for endpoints that have
CurrentLanguageParameterWhat I have tried
I believe for that
CurrentLanguageshould implement IEndpointParameterMetadataProvider and add corresponding metadata, but I have been unable to do so.Just adding
builder.Metadata.Add(new FromHeaderAttribute { Name = "Accept-Language" });does nothing.I also tried adding
LanguageParameterMetadata(ParameterInfo parameter) : IParameterBindingMetadatametadata but thats no-go either, since that interface containsParameterInfoparameter, which has a protected contructor and CustomAttributes are not editable.Code Samples:
Minimal repro with problem
What fixes the problem but does not solve it:
Adding
WithOpenApiStealing
ParameterInfofrom other header parameterBeta Was this translation helpful? Give feedback.
All reactions