op.operationId(operationId(route, tags.get(0), opIds));
@Override public void applyOperationId(Operation operation, Method method) { operation.operationId(method.getName()); }
operation.operationId(operationId);
operation.operationId(operationId);
public void applyOperationId(Operation operation, Method method) { final ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class); if (apiOperation != null && StringUtils.isNotBlank(apiOperation.nickname())) { operation.operationId(apiOperation.nickname()); } else { operation.operationId(method.getName()); } }
final String operationId = operation.getOperationId(); if (operationId == null) { operation.operationId("operation-" + idx++); } else { operation.operationId(operationId + count);
.operationId(apiOperation.nickname()) .summary(apiOperation.value()) .description(apiOperation.notes())
final Operation operation = entry.getValue(); if (operation.getOperationId() == null) { operation.operationId("operation-" + idx++);
@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")); }
final String operationId = operation.getOperationId(); if (operationId == null) { operation.operationId("operation-" + idx++); } else { operation.operationId(operationId + count);
@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"); } }
final Operation operation = entry.getValue(); if (operation.getOperationId() == null) { operation.operationId("operation-" + idx++);
op.operationId(operationId(route, tags.get(0), opIds));
output.operationId(value);
private Operation buildOperation(final ServerEndpointView endpoint, final Tag tag, final HttpRequestMethodType methodType) { final Operation operation = new Operation().summary(endpoint.getTargetAsString()).tag(tag.getName()). operationId(endpoint.getTargetAsString() + "Using" + methodType.name()); final String[] endpointParamNames = endpoint.getParamNames();
private Operation buildOperation(final ServerEndpointView endpoint, final Tag tag, final HttpRequestMethodType methodType) { final Operation operation = new Operation().summary(endpoint.getTargetAsString()).tag(tag.getName()). operationId(endpoint.getTargetAsString() + "Using" + methodType.name()); final String[] endpointParamNames = endpoint.getParamNames();
.summary(operation.getSummary()) .description(operation.getNotes()) .operationId(operation.getNickname());
.operationId(GET_NICKNAME) .summary(GET_VALUE) .description(GET_DESCRIPTION) .operationId(POST_NICKNAME) .summary(POST_VALUE) .description(POST_DESCRIPTION)