kongchen/swagger-maven-plugin

Duplicate operations output results in Error: Operations must have unique operationIds

richbraman opened this issue · 0 comments

I have read about several users having similar issues in the issue log, but this one appears to be different.

I get the same error repeated on every operation with the same problem: Operations must have unique operationIds. That makes sense, because in my case, the operation is literally output twice:

In swagger.json:

  "post" : {
    "tags" : [ "Endpoint", "Metadata" ],
    "operationId" : "createEndpoint",
    "produces" : [ "application/fhir+json" ],
    "responses" : {
      "default" : {
        "description" : "successful operation"
      }
    }
  }

and

"post" : {
    "tags" : [ "Endpoint" ],
    "summary" : "Create an Endpoint",
    "description" : "Create an Endpoint resource for an Organization",
    "operationId" : "createEndpoint",
    "consumes" : [ "application/fhir+json" ],
    "produces" : [ "application/fhir+json" ],
    "parameters" : [ {
      "in" : "body",
      "name" : "body",
      "required" : false,
      "schema" : {
        "$ref" : "#/definitions/Endpoint"
      }
    } ],
    "responses" : {
      "204" : {
        "description" : "Endpoint created"
      },
      "400" : {
        "description" : "Bad request"
      },
      "422" : {
        "description" : "Endpoint not valid"
      }
    },
    "security" : [ {
      "access_token" : [ ]
    } ]

one class has the annotations for th Endpoint Resource>. create is annotated like this:

public Response createEndpoint(@ApiParam(hidden=true) @Auth OrganizationPrincipal organizationPrincipal,
                               @ApiParam @Valid @Profiled(profile = EndpointProfile.PROFILE_URI) Endpoint endpoint) {

Why are the operations being output twice?

It seems that the one first one with Metadata might be bad output but I am not sure what is causing it.