private Path path2UtilTemplate(Parameter idParam) { Path path = new Path(); if (idParam != null) { path.setParameters(Collections.singletonList(paramId())); path.setGet(opDefault(template(ServiceDocument.class))); } else { // idParam == null -> it is a factory path.setGet(opDefault(template(ServiceDocumentQueryResult.class))); } return path; }
private Path path2Factory(ServiceDocument doc) { Path path = new Path(); path.setPost(opCreateInstance(doc)); path.setGet(opFactoryGetInstances()); return path; }
private Path buildFetchAllPath(Path path, DelegatingResourceHandler<?> resourceHandler, String resourceName, String resourceParentName) { Operation getOperation = null; if (resourceParentName == null) { if (testOperationImplemented(OperationEnum.get, resourceHandler)) { getOperation = createOperation(resourceHandler, "get", resourceName, null, OperationEnum.get); } } else { if (testOperationImplemented(OperationEnum.getSubresource, resourceHandler)) { getOperation = createOperation(resourceHandler, "get", resourceName, resourceParentName, OperationEnum.getSubresource); } } if (getOperation != null) { path.setGet(getOperation); } return path; }
private Path path2Instance(ServiceDocument doc) { Path path = new Path(); path.setParameters(Collections.singletonList(paramId())); path.setGet(opDefault(doc)); if (doc.documentDescription != null && doc.documentDescription.serviceRequestRoutes != null && !doc.documentDescription.serviceRequestRoutes.isEmpty()) { Path pathByRoutes = pathByRoutes(doc.documentDescription.serviceRequestRoutes.values()); path.setPost(pathByRoutes.getPost()); path.setPut(pathByRoutes.getPut()); path.setPatch(pathByRoutes.getPatch()); } else { io.swagger.models.Operation op = new io.swagger.models.Operation(); op.addTag(this.currentTag.getName()); op.setParameters(Collections.singletonList(paramBody(ServiceDocument.class))); op.setResponses(responseMap( Operation.STATUS_CODE_OK, responseOk(doc), Operation.STATUS_CODE_NOT_FOUND, responseGenericError() )); // service definition should be introspected to better // describe which actions are supported path.setPost(op); path.setPut(op); path.setPatch(op); } return path; }
private Path path2UtilSubscriptions(Parameter idParam) { Path path = new Path(); if (idParam != null) { path.setParameters(Collections.singletonList(paramId())); } ServiceDocument subscriptionState = template(ServiceSubscriptionState.class); path.setGet(opDefault(subscriptionState)); io.swagger.models.Operation deleteOrPost = new io.swagger.models.Operation(); deleteOrPost.addParameter(paramBody(template(ServiceSubscriber.class))); deleteOrPost.addTag(this.currentTag.getName()); deleteOrPost.setResponses(responseMap( Operation.STATUS_CODE_OK, responseOk(subscriptionState) )); path.setDelete(deleteOrPost); path.setPost(deleteOrPost); return path; }
private Path path2UtilConfig(Parameter idParam) { Path path = new Path(); if (idParam != null) { path.setParameters(Collections.singletonList(paramId())); } io.swagger.models.Operation op = new io.swagger.models.Operation(); op.addTag(this.currentTag.getName()); op.setResponses(responseMap( Operation.STATUS_CODE_OK, responseOk(template(ServiceConfiguration.class)), Operation.STATUS_CODE_NOT_FOUND, responseGenericError() )); path.setGet(op); op = new io.swagger.models.Operation(); op.addTag(this.currentTag.getName()); op.setParameters( Collections.singletonList(paramBody(ServiceConfigUpdateRequest.class))); op.setResponses(responseMap( Operation.STATUS_CODE_OK, responseOk(template(ServiceConfiguration.class)), Operation.STATUS_CODE_NOT_FOUND, responseGenericError() )); path.setPatch(op); return path; }
private Path path2UtilAvailable(Parameter idParam) { Path path = new Path(); if (idParam != null) { path.setParameters(Collections.singletonList(paramId())); } io.swagger.models.Operation get = new io.swagger.models.Operation(); get.addTag(this.currentTag.getName()); get.setResponses(responseMap( Operation.STATUS_CODE_OK, responseOk(), Operation.STATUS_CODE_UNAVAILABLE, responseNoContent(), Operation.STATUS_CODE_NOT_FOUND, responseGenericError() )); path.setGet(get); io.swagger.models.Operation patchOrPut = new io.swagger.models.Operation(); patchOrPut.addTag(this.currentTag.getName()); patchOrPut.setParameters(Collections.singletonList(paramBody(ServiceStat.class))); patchOrPut.setResponses(responseMap( Operation.STATUS_CODE_OK, responseOk(template(ServiceStats.class)), Operation.STATUS_CODE_NOT_FOUND, responseGenericError() )); path.put(patchOrPut); path.patch(patchOrPut); return path; }
Operation op = operation(on, location + "(get)", result); if(op != null) { path.setGet(op);
switch (_name) { case "GET": path.setGet(operation); break; case "POST":
getAllPath.setGet(operation);