/** * Returns the display title for an operation * * @return the operation title */ public String getTitle() { String operationName = operation.getSummary(); if (isBlank(operationName)) { operationName = getMethod().toString() + " " + getPath(); } return operationName; }
/** * Adds the operation title to the document. If the operation has a summary, the title is the summary. * Otherwise the title is the method of the operation and the URL of the operation. * * @param operation the Swagger Operation */ private void buildOperationTitle(MarkupDocBuilder markupDocBuilder, PathOperation operation) { buildOperationTitle(markupDocBuilder, operation.getTitle(), operation.getId()); if (operation.getTitle().equals(operation.getOperation().getSummary())) { markupDocBuilder.block(operation.getMethod() + " " + operation.getPath(), MarkupBlockStyle.LITERAL); } }
op.description(description(route, op.getSummary()));
private String getOperationSummary(Operation operation) { String description = operation.getDescription(); if(description == null || description.equals("")) { //$NON-NLS-1$ description = operation.getSummary(); } return description; }
public static OperationDescription operationDescriptionOf(final Swagger swagger, final Operation operation) { final Entry<String, Path> pathEntry = swagger.getPaths().entrySet().stream() .filter(e -> e.getValue().getOperations().contains(operation)).findFirst().get(); final String path = pathEntry.getKey(); final Entry<HttpMethod, Operation> operationEntry = pathEntry.getValue().getOperationMap().entrySet().stream() .filter(e -> e.getValue().equals(operation)).findFirst().get(); final HttpMethod method = operationEntry.getKey(); final String specifiedSummary = trimToNull(operation.getSummary()); final String specifiedDescription = trimToNull(operation.getDescription()); final String name = ofNullable(specifiedSummary).orElseGet(() -> method + " " + path); final String description = ofNullable(specifiedDescription).orElseGet(() -> "Send " + method + " request to " + path); return new OperationDescription(name, description); }
public static OperationDescription operationDescriptionOf(final Swagger swagger, final Operation operation) { final Entry<String, Path> pathEntry = swagger.getPaths().entrySet().stream() .filter(e -> e.getValue().getOperations().contains(operation)).findFirst().get(); final String path = pathEntry.getKey(); final Entry<HttpMethod, Operation> operationEntry = pathEntry.getValue().getOperationMap().entrySet().stream() .filter(e -> e.getValue().equals(operation)).findFirst().get(); final HttpMethod method = operationEntry.getKey(); final String specifiedSummary = trimToNull(operation.getSummary()); final String specifiedDescription = trimToNull(operation.getDescription()); final String name = ofNullable(toLiteralNull(specifiedSummary)).orElseGet(() -> method + " " + path); final String description = ofNullable(toLiteralNull(specifiedDescription)) .orElseGet(() -> "Send " + method + " request to " + path); return new OperationDescription(name, description); }
public static OperationDescription operationDescriptionOf(final Swagger swagger, final Operation operation, final BiFunction<String, String, String> consumer) { final Entry<String, Path> pathEntry = swagger.getPaths().entrySet().stream() .filter(e -> e.getValue().getOperations().contains(operation)).findFirst().get(); final String path = pathEntry.getKey(); final Entry<HttpMethod, Operation> operationEntry = pathEntry.getValue().getOperationMap().entrySet().stream() .filter(e -> e.getValue().equals(operation)).findFirst().get(); final HttpMethod method = operationEntry.getKey(); final String specifiedSummary = trimToNull(operation.getSummary()); final String specifiedDescription = trimToNull(operation.getDescription()); final String name = ofNullable(toLiteralNull(specifiedSummary)).orElseGet(() -> method + " " + path); final String description = ofNullable(toLiteralNull(specifiedDescription)) .orElseGet(() -> consumer.apply(method.name(), path)); return new OperationDescription(name, description); }
@Override public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger) { CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger); op.summary = operation.getSummary(); op.notes = operation.getDescription(); return op; }
/** * Returns the display title for an operation * * @return the operation title */ public String getTitle() { String operationName = operation.getSummary(); if (isBlank(operationName)) { operationName = getMethod().toString() + " " + getPath(); } return operationName; }
private static Collection<? extends Endpoint> convert2EndpointList(String pathUrl, Map<HttpMethod, Operation> map) { List<Endpoint> endpoints = new ArrayList<Endpoint>(); if (null == map) return endpoints; map.forEach((httpMethod, operation) -> { Endpoint endpoint = new Endpoint(); endpoint.setPathUrl(pathUrl); endpoint.setMethod(httpMethod); endpoint.setSummary(operation.getSummary()); endpoint.setOperation(operation); endpoints.add(endpoint); }); return endpoints; }
private static List<Endpoint> convert2EndpointList(Map<String, Path> map) { List<Endpoint> endpoints = new ArrayList<Endpoint>(); if (null == map) return endpoints; map.forEach((url, path) -> { Map<HttpMethod, Operation> operationMap = path.getOperationMap(); operationMap.forEach((httpMethod, operation) -> { Endpoint endpoint = new Endpoint(); endpoint.setPathUrl(url); endpoint.setMethod(httpMethod); endpoint.setSummary(operation.getSummary()); endpoint.setPath(path); endpoint.setOperation(operation); endpoints.add(endpoint); }); }); return endpoints; }
/** * Adds the operation title to the document. If the operation has a summary, the title is the summary. * Otherwise the title is the method of the operation and the URL of the operation. * * @param operation the Swagger Operation */ private void buildOperationTitle(MarkupDocBuilder markupDocBuilder, PathOperation operation) { buildOperationTitle(markupDocBuilder, operation.getTitle(), operation.getId()); if (operation.getTitle().equals(operation.getOperation().getSummary())) { markupDocBuilder.block(operation.getMethod() + " " + operation.getPath(), MarkupBlockStyle.LITERAL); } }
if (operation.getSummary().length() > 120) { log.warn("'{}' api summary exceeds 120 characters", Util.toString(method));
if(operation.getOperationId() != null){ methodName = operation.getOperationId(); } else if(operation.getSummary() != null){ methodName = operation.getSummary(); } else { methodName = httpMethod.name();
final String summary = trimToNull(operation.getSummary()); final String specifiedDescription = trimToNull(operation.getDescription());
operation.setDescription(v2Operation.getDescription()); if (StringUtils.isNotBlank(v2Operation.getSummary())) { operation.setSummary(v2Operation.getSummary());
operation.setDescription(v2Operation.getDescription()); if (StringUtils.isNotBlank(v2Operation.getSummary())) { operation.setSummary(v2Operation.getSummary());
operation.setDescription(v2Operation.getDescription()); if (StringUtils.isNotBlank(v2Operation.getSummary())) { operation.setSummary(v2Operation.getSummary());
Operation oldOperation = oldOperationMap.get(method); Operation newOperation = newOperationMap.get(method); changedOperation.setSummary(newOperation.getSummary());
Operation operation = operationEntry.getValue(); String operationName = operation.getSummary(); String operationDescription = operationEntry.getKey() + " " + pathEntry.getKey();