From aa4b38e71de3232d38ad8270c74f3e03316733da Mon Sep 17 00:00:00 2001 From: azizdiakite Date: Tue, 10 Sep 2024 09:34:37 +0300 Subject: [PATCH 1/2] improve swagger typings for getAll --- .../docs/swagger/SwaggerSpecificationCreator.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java b/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java index 784bf5d4a..72229d42b 100644 --- a/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java +++ b/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java @@ -132,7 +132,7 @@ private void BuildJSON() { try { initSwagger(); addPaths(); - addDefaultDefinitions(); + //addDefaultDefinitions(); // addSubclassOperations(); //FIXME uncomment after fixing the method } catch (Exception e) { @@ -253,7 +253,7 @@ private boolean testOperationImplemented(OperationEnum operation, DelegatingReso if (method == null) { return false; } else { - method.invoke(resourceHandler, new RequestContext()); + method.invoke(resourceHandler, RestConstants.SWAGGER_IMPOSSIBLE_UNIQUE_ID, new RequestContext()); } break; @@ -1069,7 +1069,10 @@ private Operation createOperation(DelegatingResourceHandler resourceHandler, operation.setSummary("Fetch all non-retired"); operation.setOperationId("getAll" + getOperationTitle(resourceHandler, true)); - operation.addResponse("200", response200.schema(new RefProperty("#/definitions/FetchAll"))); + operation.addResponse("200", + response200.schema(new ArrayProperty( + new RefProperty(getSchemaRef(resourceName, resourceParentName, OperationEnum.get))))); + operation.setParameters(buildPagingParameters()); operation.parameter(v); if (((BaseDelegatingResource) resourceHandler).hasTypesDefined()) { From ce023b32bcc5612dc3ccc653909dc51e75123b07 Mon Sep 17 00:00:00 2001 From: azizdiakite Date: Tue, 10 Sep 2024 10:15:56 +0300 Subject: [PATCH 2/2] Remove commented line --- .../webservices/docs/swagger/SwaggerSpecificationCreator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java b/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java index 72229d42b..9f235ba9b 100644 --- a/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java +++ b/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java @@ -132,7 +132,6 @@ private void BuildJSON() { try { initSwagger(); addPaths(); - //addDefaultDefinitions(); // addSubclassOperations(); //FIXME uncomment after fixing the method } catch (Exception e) {