swagger-maven-plugin icon indicating copy to clipboard operation
swagger-maven-plugin copied to clipboard

Unable to generate correct security block

Open nbeucler opened this issue 6 years ago • 2 comments

Unable to obtain correct security description in generated openApi spec :

maven configuration :

<securityDefinitions>
    <securityDefinition>
        <jsonPath>${basedir}/src/main/resources/secDef.json</jsonPath>
   </securityDefinition>
</securityDefinitions>

secDef.json file content :

{	
    "bearerToken": {
	"type": "apiKey",
	"name": "Authorization",
	"in": "header"
    }
}

Result obtained :

"securityDefinitions" : {
    "bearerToken" : {
      "type" : "apiKey",
      "name" : "bearerToken",
      "in" : "header"
    }
  }

Result expected :

 "securityDefinitions" : {
    "bearerToken" : {
      "type" : "apiKey",
      "name" : "Authorization",
      "in" : "header"
    }
  }

nbeucler avatar Dec 05 '18 14:12 nbeucler

Same here. Did you find any fix @nbeucler? I had to manually run some sed s in the pipeline and replace the stuff myself...

TamasNeumer avatar May 20 '19 12:05 TamasNeumer

Also encountering the same behaviour...

securityDefinitions.json:

{
  "APIKeyHeader": {
    "type": "apiKey",
    "in": "header",
    "name": "Authorization"
  }
}

Output:

"securityDefinitions" : {
  "APIKeyHeader" : {
    "type" : "apiKey",
    "name" : "APIKeyHeader",
    "in" : "header"
  }
}

Expected output:

"securityDefinitions" : {
  "APIKeyHeader" : {
    "type" : "apiKey",
    "name" : "Authorization",
    "in" : "header"
  }
}

sergiofenoll avatar Aug 17 '21 12:08 sergiofenoll