protected Map<String, Path> generateEntityFilterPaths(ModelImpl entityModel) { return Collections.singletonMap( String.format(ENTITY_SEARCH, entityModel.getName()), new Path() .get(generateEntitySearchOperation(entityModel, RequestMethod.GET)) .post(generateEntitySearchOperation(entityModel, RequestMethod.POST))); }
protected Map<String, Path> generateEntityPath(ModelImpl entityModel) { return Collections.singletonMap( String.format(ENTITY_PATH, entityModel.getName()), new Path() .get(generateEntityBrowseOperation(entityModel)) .post(generateEntityCreateOperation(entityModel))); }
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 Path generateQueryPath(RestQueriesConfiguration.QueryInfo query) { return new Path() .get(generateQueryOperation(query, RequestMethod.GET)) .post(generateQueryOperation(query, RequestMethod.POST)); }
protected Path generateQueryCountPath(RestQueriesConfiguration.QueryInfo query) { return new Path() .get(generateQueryCountOperation(query, RequestMethod.GET)) .post(generateQueryCountOperation(query, RequestMethod.POST)); }
protected Path generateServiceMethodPath(String service, RestMethodInfo methodInfo) { return new Path() .get(generateServiceMethodOp(service, methodInfo, RequestMethod.GET)) .post(generateServiceMethodOp(service, methodInfo, RequestMethod.POST)); }
private Path buildCreatePath(Path path, DelegatingResourceHandler<?> resourceHandler, String resourceName, String resourceParentName) { Operation postCreateOperation = null; if (resourceParentName == null) { if (testOperationImplemented(OperationEnum.postCreate, resourceHandler)) { postCreateOperation = createOperation(resourceHandler, "post", resourceName, null, OperationEnum.postCreate); } } else { if (testOperationImplemented(OperationEnum.postSubresource, resourceHandler)) { postCreateOperation = createOperation(resourceHandler, "post", resourceName, resourceParentName, OperationEnum.postSubresource); } } if (postCreateOperation != null) { path.post(postCreateOperation); } return path; }
private Path buildUpdatePath(Path path, DelegatingResourceHandler<?> resourceHandler, String resourceName, String resourceParentName) { Operation postUpdateOperation = null; if (resourceParentName == null) { if (testOperationImplemented(OperationEnum.postUpdate, resourceHandler)) { postUpdateOperation = createOperation(resourceHandler, "post", resourceName, resourceParentName, OperationEnum.postUpdate); } } else { if (testOperationImplemented(OperationEnum.postUpdateSubresouce, resourceHandler)) { postUpdateOperation = createOperation(resourceHandler, "post", resourceName, resourceParentName, OperationEnum.postUpdateSubresouce); } } if (postUpdateOperation != null) { path.post(postUpdateOperation); } return path; }
break; case POST: path.post(buildOperation(endpoint, tag, methodType)); break; case PUT:
break; case POST: path.post(buildOperation(endpoint, tag, methodType)); break; case PUT:
this.swagger.getPath(path).post(createOperation(method, operationTags));
break; case HttpConstants.ANNOTATION_METHOD_POST: path.post(operation); break; case HttpConstants.ANNOTATION_METHOD_DELETE:
@Test public void shouldMakeNonUniqueOperationIdsUnique() { final Swagger swagger = new Swagger().path("/path", new Path().get(new Operation().operationId("foo")) .post(new Operation().operationId("foo")).put(new Operation().operationId("bar"))); final Connector generated = generator.configureConnector(SWAGGER_TEMPLATE, new Connector.Builder().id("connector1").build(), createSettingsFrom(swagger)); final List<ConnectorAction> actions = generated.getActions(); assertThat(actions).hasSize(3); assertThat(actions.get(0).getId()).hasValueSatisfying(id -> assertThat(id).endsWith("foo")); assertThat(actions.get(1).getId()).hasValueSatisfying(id -> assertThat(id).endsWith("foo1")); assertThat(actions.get(2).getId()).hasValueSatisfying(id -> assertThat(id).endsWith("bar")); }
@Test public void shouldMakeNonUniqueOperationIdsUnique() { final Swagger swagger = new Swagger().path("/path", new Path().get(new Operation().operationId("foo")) .post(new Operation().operationId("foo")).put(new Operation().operationId("bar"))); final Connector generated = generator.configureConnector(SWAGGER_TEMPLATE, new Connector.Builder().id("connector1").build(), createSettingsFrom(swagger)); final List<ConnectorAction> actions = generated.getActions(); assertThat(actions).hasSize(3); assertThat(actions.get(0).getId()).hasValueSatisfying(id -> assertThat(id).endsWith("foo")); assertThat(actions.get(1).getId()).hasValueSatisfying(id -> assertThat(id).endsWith("foo1")); assertThat(actions.get(2).getId()).hasValueSatisfying(id -> assertThat(id).endsWith("bar")); }
path.post(op); break; case PUT:
@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"); } }
@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.post(post); path.patch(post);
path.post(new JsonApiOperation() .description(postDescription) .tag(getTag())
.post(new Operation() .operationId(POST_NICKNAME) .summary(POST_VALUE)