Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Adds Tenant Id field to API endpoints
- /// </summary>
- /// <seealso cref="Swashbuckle.AspNetCore.SwaggerGen.IOperationFilter" />
- public class TenantHeaderOperationFilter : IOperationFilter
- {
- /// <summary>
- /// Applies the specified operation.
- /// </summary>
- /// <param name="operation">The operation.</param>
- /// <param name="context">The context.</param>
- public void Apply(Operation operation, OperationFilterContext context)
- {
- if (operation.Parameters == null)
- {
- operation.Parameters = new List<IParameter>();
- }
- operation.Parameters.Add(new NonBodyParameter
- {
- Name = "tenantid",
- In = "header",
- Description = "tenantid",
- Required = true,
- Type = "string",
- });
- }
- }
Add Comment
Please, Sign In to add comment