How can I prevent the verb to be part of operationId in openapi

Hi,

when I build the sample solution coming with the VS extension and enable the plugin OpenAPI the method verb (GET, POSt, DELETE) is part of the operationId when I take a look at http://127.0.0.1:8088/openapi

For example: HelloName_Delete

  "delete": {
    "tags": [
      "hello"
    ],
    "operationId": "HelloName_Delete",
    "consumes": [
      "application/json"
    ],
    "produces": [
      "application/json"
    ],
    "parameters": [
      {
        "name": "Name",
        "in": "path",
        "type": "string",
        "required": true
      }
    ],
    "responses": {
      "200": {
        "description": "Success",
        "schema": {
          "$ref": "#/definitions/HelloResponse"
        }
      }
    },
    "deprecated": false
  },

How can I disable this?

greetings
Andre

The operationId has to be unique which is why both is needed. You can modify the Operation with:

Plugins.Add(new OpenApiFeature {
    OperationFilter = (verb,operation) => { ... }
})

You can also use ApiDeclarationFilter to intercept and modify the /openapi response DTO before it’s returned.

Hi,

at the moment I get the following API methods when I use OpenAPI and Swagger Editor:

        var c = new ProductsApi("");
        c.DeleteProductSkuDelete();

I would prefer the method name “DeleteProduct”.

Am I doing something wrong?

It just needs to be unique as long as you’re not using multiple routes with the same Request DTO it should be ok.