Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Do not default operation id to controller method name. #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,7 @@ private Operation parseMethod(Class<?> cls, Method method, Route route) {
ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
ApiResponses responseAnnotation = ReflectionUtils.getAnnotation(method, ApiResponses.class);

String operationId = method.getName();
operation.operationId(operationId);
String operationId = null;
String responseContainer = null;

Type responseType = null;
Expand Down
6 changes: 3 additions & 3 deletions play-2.6/swagger-play2/test/PlayApiListingCacheSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ PUT /api/dog/api/:id testdata.DogController.add0(id:String)
opCatGet.getProduces must beNull

val opCatPut = pathCat.getOperationMap.get(HttpMethod.PUT)
opCatPut.getOperationId must beEqualTo("add1")
opCatPut.getOperationId must beEqualTo(null)
opCatPut.getParameters.head.getName must beEqualTo("cat")
opCatPut.getParameters.head.getIn must beEqualTo("body")
opCatPut.getParameters.head.asInstanceOf[BodyParameter].getSchema.getReference must beEqualTo("#/definitions/Cat")
Expand Down Expand Up @@ -162,7 +162,7 @@ PUT /api/dog/api/:id testdata.DogController.add0(id:String)
opDogGet.getProduces.asScala.toList must beEqualTo(List("application/json","application/xml"))

val opDogPut = pathDog.getOperationMap.get(HttpMethod.PUT)
opDogPut.getOperationId must beEqualTo("add1")
opDogPut.getOperationId must beEqualTo(null)
opDogPut.getParameters.head.getName must beEqualTo("dog")
opDogPut.getParameters.head.getIn must beEqualTo("body")
opDogPut.getParameters.head.asInstanceOf[BodyParameter].getSchema.getReference must beEqualTo("#/definitions/Dog")
Expand All @@ -174,7 +174,7 @@ PUT /api/dog/api/:id testdata.DogController.add0(id:String)
pathDogParam.getOperations.size must beEqualTo(1)

val opDogParamPut = pathDogParam.getOperationMap.get(HttpMethod.PUT)
opDogParamPut.getOperationId must beEqualTo("add0")
opDogParamPut.getOperationId must beEqualTo(null)
opDogParamPut.getParameters.head.getName must beEqualTo("id")
opDogParamPut.getParameters.head.getIn must beEqualTo("path")
opDogParamPut.getParameters.head.asInstanceOf[PathParameter].getType must beEqualTo("string")
Expand Down