This commit is contained in:
Andy Wilkinson
2017-09-23 17:20:03 +01:00
parent a084175afd
commit 7c6c2e7523
41 changed files with 95 additions and 54 deletions

View File

@@ -103,7 +103,6 @@ final class CliOperationRequest implements OperationRequest {
}
}
return true;
}
@Override

View File

@@ -44,14 +44,12 @@ final class ConcatenatingCommandFormatter implements CommandFormatter {
if (CollectionUtils.isEmpty(elements)) {
return "";
}
StringBuilder result = new StringBuilder();
for (String element : elements) {
result.append(String.format(this.separator));
result.append(element);
}
return result.toString();
}
}

View File

@@ -184,7 +184,6 @@ public class CurlRequestSnippet extends TemplatedSnippet {
private void writePartsIfNecessary(OperationRequest request, List<String> lines) {
for (OperationRequestPart part : request.getParts()) {
StringBuilder oneLine = new StringBuilder();
oneLine.append(String.format("-F '%s=", part.getName()));
if (!StringUtils.hasText(part.getSubmittedFileName())) {
@@ -197,7 +196,6 @@ public class CurlRequestSnippet extends TemplatedSnippet {
oneLine.append(";type=");
oneLine.append(part.getHeaders().getContentType().toString());
}
oneLine.append("'");
lines.add(oneLine.toString());
}

View File

@@ -237,4 +237,5 @@ public class HttpieRequestSnippet extends TemplatedSnippet {
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,4 +31,5 @@ interface NestedConfigurer<PARENT> {
* @return the parent
*/
PARENT and();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@ package org.springframework.restdocs.constraints;
* Resolves a description for a {@link Constraint}.
*
* @author Andy Wilkinson
*
*/
public interface ConstraintDescriptionResolver {
@@ -31,4 +30,5 @@ public interface ConstraintDescriptionResolver {
* @return the description
*/
String resolveDescription(Constraint constraint);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -77,4 +77,5 @@ public class ValidatorConstraintResolver implements ConstraintResolver {
}
return constraints;
}
}

View File

@@ -30,7 +30,6 @@ import org.springframework.restdocs.operation.OperationResponse;
* content type.
*
* @author Andy Wilkinson
*
*/
class ContentTypeLinkExtractor implements LinkExtractor {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -472,4 +472,5 @@ public abstract class HypermediaDocumentation {
public static LinkExtractor atomLinks() {
return new AtomLinkExtractor();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,4 +66,5 @@ class HeaderRemovingOperationPreprocessor implements OperationPreprocessor {
}
return processedHeaders;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -141,7 +141,9 @@ public class PrettyPrintingContentModifier implements ContentModifier {
public void fatalError(SAXParseException exception) throws SAXException {
// Suppress
}
}
}
private static final class JsonPrettyPrinter implements PrettyPrinter {
@@ -154,6 +156,7 @@ public class PrettyPrintingContentModifier implements ContentModifier {
return this.objectMapper
.writeValueAsBytes(this.objectMapper.readTree(original));
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,4 +34,5 @@ public class FieldTypeRequiredException extends RuntimeException {
public FieldTypeRequiredException(String message) {
super(message);
}
}

View File

@@ -124,15 +124,18 @@ final class JsonFieldPath {
return segments;
}
/**
* The type of a field path.
*/
static enum PathType {
/**
* The path identifies a single item in the payload
* The path identifies a single item in the payload.
*/
SINGLE,
/**
* The path identifies multiple items in the payload
* The path identifies multiple items in the payload.
*/
MULTI;

View File

@@ -327,13 +327,13 @@ final class JsonFieldProcessor {
}
private static class LeafCollectionMatch implements Match {
private static final class LeafCollectionMatch implements Match {
private final Collection<?> collection;
private final Match parent;
public LeafCollectionMatch(Collection<?> collection, Match parent) {
private LeafCollectionMatch(Collection<?> collection, Match parent) {
this.collection = collection;
this.parent = parent;
}
@@ -387,6 +387,7 @@ final class JsonFieldProcessor {
void remove();
void removeSubsection();
}
private static final class ProcessingContext {
@@ -432,8 +433,12 @@ final class JsonFieldProcessor {
return new ProcessingContext(payload, this.path,
this.segments.subList(1, this.segments.size()), match);
}
}
/**
* A field that has been extracted from a JSON payload.
*/
static class ExtractedField {
private final Object value;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,4 +66,5 @@ public enum JsonFieldType {
public String toString() {
return StringUtils.capitalize(this.name().toLowerCase(Locale.ENGLISH));
}
}

View File

@@ -77,4 +77,5 @@ class JsonFieldTypeResolver {
}
return JsonFieldType.NUMBER;
}
}