I have applied a custom IOperationProcessor globally to all endpoints:
public class DocumentationProcessor : IOperationProcessor
{
public bool Process(OperationProcessorContext context)
{
context.OperationDescription.Operation.Parameters.Add(
new OpenApiParameter
{
Name = Constants.Header.TenantId,
Kind = OpenApiParameterKind.Header,
Type = NJsonSchema.JsonObjectType.String,
IsRequired = true,
Description = "Organization identifier"
});
return true;
}
}
This shows the header field, but if the value is not provided, the UI throws an error in the console without stopping the spinner, which keeps on spinning, without showing any error message in the UI.
swagger-ui-bundle.js:2 Error: Required parameter x-my-header is not provided
at swagger-ui-bundle.js:2:1019594
at Array.forEach (<anonymous>)
at Object.execute_buildRequest [as buildRequest] (swagger-ui-bundle.js:2:1019082)
at swagger-ui-bundle.js:2:738691
at swagger-ui-bundle.js:2:597099
at swagger-ui-bundle.js:2:592921
at swagger-ui-bundle.js:2:743368
at Object.newAction (swagger-ui-bundle.js:2:606084)
at Object.executeRequest (swagger-ui-bundle.js:2:610357)
at swagger-ui-bundle.js:2:739687
I have applied a custom IOperationProcessor globally to all endpoints:
This shows the header field, but if the value is not provided, the UI throws an error in the console without stopping the spinner, which keeps on spinning, without showing any error message in the UI.