OpenAPI SwaggerUI Operation filter

Hi,

In swagger feature I was able to add operation filter as described below. How would this translate to in OpenAPI?

OperationFilter = op =>
            {
                var name = op.Nickname;
                if ((name == typeof(UploadRequest).Name 
                    && op.Method == HttpMethods.Post)
                {
                    op.Parameters.Add(new SwaggerParameter
                    {
                        Name = "Upload",
                        ParamType = "body",
                        Type = "file",
                        AllowMultiple = true
                    });
                }
            }

There’s an OperationFilter on OpenApiFeature, it takes a Verb and an OpenApiOperation which has parameters

But there is no proper name for the operation. Only property that seems usable is OperationId but that appended with property name. Something like UploadRequestUpload_Post.

OpenApiParameter has a Name property?

Yes it does but how do I filter the endpoints. Before I was able to do that by comparing the SwaggerOperation.Nickname to Type.Name. Now there is no Nickname property on OpenApiOperation so I can’t really filter the operations.

NickName isn’t apart of the OpenApi Specification which is why it doesn’t exist on the Open API Operation DTO. The OperationId starts with the name of the request DTO so you could check for that. I’ve also added a non-serializable RequestType property you can use in this commit.

This change is available from v4.5.13 that’s now available on MyGet.