public Path set(String method, Operation op) { if ("get".equals(method)) { return get(op); } if ("put".equals(method)) { return put(op); } if ("head".equals(method)) { return head(op); } if ("post".equals(method)) { return post(op); } if ("delete".equals(method)) { return delete(op); } if ("patch".equals(method)) { return patch(op); } if ("options".equals(method)) { return options(op); } return null; }
protected Map<String, Path> generateEntityRUDPaths(ModelImpl entityModel) { return Collections.singletonMap( String.format(ENTITY_RUD_OPS, entityModel.getName()), new Path() .get(generateEntityReadOperation(entityModel)) .put(generateEntityUpdateOperation(entityModel)) .delete(generateEntityDeleteOperation(entityModel))); }
private Path buildDeletePath(Path path, DelegatingResourceHandler<?> resourceHandler, String resourceName, String resourceParentName) { Operation deleteOperation = null; if (resourceParentName == null) { if (testOperationImplemented(OperationEnum.delete, resourceHandler)) { deleteOperation = createOperation(resourceHandler, "delete", resourceName, resourceParentName, OperationEnum.delete); } } else { if (testOperationImplemented(OperationEnum.deleteSubresource, resourceHandler)) { deleteOperation = createOperation(resourceHandler, "delete", resourceName, resourceParentName, OperationEnum.deleteSubresource); } } if (deleteOperation != null) { path.delete(deleteOperation); } return path; }
break; case DELETE: path.delete(buildOperation(endpoint, tag, methodType)); break; default:
break; case DELETE: path.delete(buildOperation(endpoint, tag, methodType)); break; default:
this.swagger.getPath(path).delete(createOperation(method, operationTags));
break; case HttpConstants.ANNOTATION_METHOD_DELETE: path.delete(operation); break; case HttpConstants.ANNOTATION_METHOD_OPTIONS:
break; case DELETE: path.delete(op); break; case OPTIONS:
@Test public void shouldValidateOperationUniqueness() { final Swagger swagger = new Swagger() .path("/path", new Path().get(new Operation().operationId("o1")).post(new Operation().operationId("o2"))) .path("/other", new Path().patch(new Operation().operationId("o2")).put(new Operation().operationId("o3"))) .path("/more", new Path().options(new Operation().operationId("o4")).delete(new Operation().operationId("o3"))); final SwaggerModelInfo info = new SwaggerModelInfo.Builder().model(swagger).build(); final SwaggerModelInfo validated = SyndesisSwaggerValidationRules.validateUniqueOperationIds(info); final List<Violation> warnings = validated.getWarnings(); assertThat(warnings).hasSize(1); final Violation nonUniqueWarning = warnings.get(0); assertThat(nonUniqueWarning.error()).isEqualTo("non-unique-operation-ids"); assertThat(nonUniqueWarning.property()).isNull(); assertThat(nonUniqueWarning.message()).isEqualTo("Found operations with non unique operationIds: o2, o3"); } }
path.delete(purgeOperation);
@Test public void shouldValidateOperationUniqueness() { final Swagger swagger = new Swagger() .path("/path", new Path().get(new Operation().operationId("o1")).post(new Operation().operationId("o2"))) .path("/other", new Path().patch(new Operation().operationId("o2")).put(new Operation().operationId("o3"))) .path("/more", new Path().options(new Operation().operationId("o4")).delete(new Operation().operationId("o3"))); final SwaggerModelInfo info = new SwaggerModelInfo.Builder().model(swagger).build(); final SwaggerModelInfo validated = SyndesisSwaggerValidationRules.validateUniqueOperationIds(info); final List<Violation> warnings = validated.getWarnings(); assertThat(warnings).hasSize(1); final Violation nonUniqueWarning = warnings.get(0); assertThat(nonUniqueWarning.error()).isEqualTo("non-unique-operation-ids"); assertThat(nonUniqueWarning.property()).isNull(); assertThat(nonUniqueWarning.message()).isEqualTo("Found operations with non unique operationIds: o2, o3"); } }
); path.delete(new JsonApiOperation() .description("Deletes an instance of type " + typeName) .tag(getTag())
.name("relationship")) ); path.delete(new JsonApiOperation() .description("Deletes items from the relationship " + name) .tag(getTag())