Merge branch '1.2.x'
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven { url 'https://repo.spring.io/plugins-snapshot' }
|
||||
maven { url 'https://repo.spring.io/plugins-release' }
|
||||
maven { url 'https://plugins.gradle.org/m2/' }
|
||||
@@ -9,6 +10,7 @@ buildscript {
|
||||
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
|
||||
classpath 'io.spring.gradle:spring-io-plugin:0.0.8.RELEASE'
|
||||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
|
||||
classpath "io.spring.javaformat:spring-javaformat-gradle-plugin:$javaFormatVersion"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +18,7 @@ allprojects {
|
||||
group = 'org.springframework.restdocs'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
}
|
||||
}
|
||||
@@ -108,7 +111,7 @@ subprojects {
|
||||
}
|
||||
|
||||
configure(subprojects - project(":docs")) { subproject ->
|
||||
|
||||
apply plugin: 'io.spring.javaformat'
|
||||
apply plugin: 'checkstyle'
|
||||
apply from: "${rootProject.projectDir}/gradle/publish-maven.gradle"
|
||||
|
||||
@@ -139,6 +142,7 @@ configure(subprojects - project(":docs")) { subproject ->
|
||||
}
|
||||
|
||||
dependencies {
|
||||
checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:$javaFormatVersion"
|
||||
jacoco 'org.jacoco:org.jacoco.agent::runtime'
|
||||
}
|
||||
|
||||
|
||||
@@ -25,4 +25,4 @@ public class MatrixTestPlugin implements Plugin<Project> {
|
||||
project.extensions.create('matrixTest', MatrixTestExtension, project)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
^\Q/*\E$
|
||||
^\Q * Copyright \E20\d\d\-20\d\d\Q the original author or authors.\E$
|
||||
^\Q *\E$
|
||||
^\Q * Licensed under the Apache License, Version 2.0 (the "License");\E$
|
||||
^\Q * you may not use this file except in compliance with the License.\E$
|
||||
^\Q * You may obtain a copy of the License at\E$
|
||||
^\Q *\E$
|
||||
^\Q * http://www.apache.org/licenses/LICENSE-2.0\E$
|
||||
^\Q *\E$
|
||||
^\Q * Unless required by applicable law or agreed to in writing, software\E$
|
||||
^\Q * distributed under the License is distributed on an "AS IS" BASIS,\E$
|
||||
^\Q * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\E$
|
||||
^\Q * See the License for the specific language governing permissions and\E$
|
||||
^\Q * limitations under the License.\E$
|
||||
^\Q */\E$
|
||||
^$
|
||||
^.*$
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE import-control PUBLIC "-//Puppy Crawl//DTD Import Control 1.1//EN" "http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
|
||||
<import-control pkg="org.springframework.restdocs">
|
||||
|
||||
<allow pkg=".*" regex="true"/>
|
||||
|
||||
<!-- Use BDD Mockito -->
|
||||
<disallow class="org.mockito.Mockito.when"/>
|
||||
<disallow class="org.mockito.Mockito.doThrow"/>
|
||||
<disallow class="org.mockito.Mockito.doAnswer"/>
|
||||
|
||||
</import-control>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||
<suppressions>
|
||||
<suppress files="[\\/]src[\\/]test[\\/]java[\\/]" checks="JavadocVariable" />
|
||||
<suppress files="[\\/]src[\\/]test[\\/]java[\\/]" checks="JavadocMethod" />
|
||||
</suppressions>
|
||||
@@ -1,156 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
|
||||
<module name="Checker">
|
||||
|
||||
<!-- Root Checks -->
|
||||
<module name="RegexpHeader">
|
||||
<property name="headerFile" value="${checkstyle.config.dir}/checkstyle-header.txt" />
|
||||
<property name="fileExtensions" value="java" />
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile" />
|
||||
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="${checkstyle.config.dir}/checkstyle-suppressions.xml"/>
|
||||
</module>
|
||||
|
||||
<!-- TreeWalker Checks -->
|
||||
<module name="TreeWalker">
|
||||
|
||||
<!-- Annotations -->
|
||||
<module name="AnnotationUseStyle">
|
||||
<property name="elementStyle" value="compact" />
|
||||
</module>
|
||||
<module name="MissingOverride" />
|
||||
<module name="PackageAnnotation" />
|
||||
<module name="AnnotationLocation">
|
||||
<property name="allowSamelineSingleParameterlessAnnotation"
|
||||
value="false" />
|
||||
</module>
|
||||
|
||||
<!-- Block Checks -->
|
||||
<module name="EmptyBlock">
|
||||
<property name="option" value="text" />
|
||||
</module>
|
||||
<module name="LeftCurly" />
|
||||
<module name="RightCurly">
|
||||
<property name="option" value="alone" />
|
||||
</module>
|
||||
<module name="NeedBraces" />
|
||||
<module name="AvoidNestedBlocks" />
|
||||
|
||||
<!-- Class Design -->
|
||||
<module name="FinalClass" />
|
||||
<module name="InterfaceIsType" />
|
||||
<module name="HideUtilityClassConstructor" />
|
||||
<module name="MutableException" />
|
||||
<module name="InnerTypeLast" />
|
||||
<module name="OneTopLevelClass" />
|
||||
|
||||
<!-- Coding -->
|
||||
<module name="CovariantEquals" />
|
||||
<module name="EmptyStatement" />
|
||||
<module name="EqualsHashCode" />
|
||||
<module name="InnerAssignment" />
|
||||
<module name="SimplifyBooleanExpression" />
|
||||
<module name="SimplifyBooleanReturn" />
|
||||
<module name="StringLiteralEquality" />
|
||||
<module name="NestedForDepth">
|
||||
<property name="max" value="3" />
|
||||
</module>
|
||||
<module name="NestedIfDepth">
|
||||
<property name="max" value="3" />
|
||||
</module>
|
||||
<module name="NestedTryDepth">
|
||||
<property name="max" value="3" />
|
||||
</module>
|
||||
<module name="MultipleVariableDeclarations" />
|
||||
<module name="RequireThis">
|
||||
<property name="checkMethods" value="false" />
|
||||
</module>
|
||||
<module name="OneStatementPerLine" />
|
||||
|
||||
<!-- Imports -->
|
||||
<module name="AvoidStarImport" />
|
||||
<module name="AvoidStaticImport">
|
||||
<property name="excludes"
|
||||
value="io.restassured.RestAssured.*, org.assertj.core.api.Assertions.*, org.hamcrest.CoreMatchers.*, org.hamcrest.Matchers.*, org.mockito.Mockito.*, org.mockito.BDDMockito.*, org.mockito.Matchers.*, org.springframework.restdocs.cli.CliDocumentation.*, org.springframework.restdocs.headers.HeaderDocumentation.*, org.springframework.restdocs.hypermedia.HypermediaDocumentation.*, org.springframework.restdocs.mockmvc.IterableEnumeration.*, org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.*, org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*, org.springframework.restdocs.payload.PayloadDocumentation.*, org.springframework.restdocs.operation.preprocess.Preprocessors.*, org.springframework.restdocs.request.RequestDocumentation.*, org.springframework.restdocs.restassured3.RestAssuredRestDocumentation.*, org.springframework.restdocs.restassured3.operation.preprocess.RestAssuredPreprocessors.*, org.springframework.restdocs.snippet.Attributes.*, org.springframework.restdocs.templates.TemplateFormats.*, org.springframework.restdocs.test.SnippetConditions.*, org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation.*, org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*, org.springframework.test.web.servlet.result.MockMvcResultMatchers.*, org.springframework.web.reactive.function.BodyInserters.*, org.springframework.web.reactive.function.server.RequestPredicates.GET, org.springframework.web.reactive.function.server.RequestPredicates.POST" />
|
||||
</module>
|
||||
<module name="IllegalImport" />
|
||||
<module name="RedundantImport" />
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="true" />
|
||||
</module>
|
||||
<module name="ImportOrder">
|
||||
<property name="groups" value="java,/^javax?\./,*,org.springframework" />
|
||||
<property name="ordered" value="true" />
|
||||
<property name="separated" value="true" />
|
||||
<property name="option" value="bottom" />
|
||||
<property name="sortStaticImportsAlphabetically" value="true" />
|
||||
</module>
|
||||
<module name="ImportControl">
|
||||
<property name="file" value="${checkstyle.config.dir}/checkstyle-import-control.xml"/>
|
||||
</module>
|
||||
|
||||
<!-- Javadoc Comments -->
|
||||
<module name="JavadocType">
|
||||
<property name="scope" value="package"/>
|
||||
<property name="authorFormat" value=".+\s.+"/>
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope" value="protected"/>
|
||||
</module>
|
||||
<module name="JavadocVariable">
|
||||
<property name="scope" value="protected"/>
|
||||
</module>
|
||||
<module name="JavadocStyle">
|
||||
<property name="checkEmptyJavadoc" value="true"/>
|
||||
</module>
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
<module name="JavadocTagContinuationIndentation">
|
||||
<property name="offset" value="0"/>
|
||||
</module>
|
||||
<module name="AtclauseOrder">
|
||||
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF"/>
|
||||
<property name="tagOrder" value="@param, @author, @since, @see, @version, @serial, @deprecated"/>
|
||||
</module>
|
||||
<module name="AtclauseOrder">
|
||||
<property name="target" value="METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||
<property name="tagOrder" value="@param, @return, @throws, @since, @deprecated, @see"/>
|
||||
</module>
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<module name="CommentsIndentation" />
|
||||
<module name="UpperEll" />
|
||||
<module name="ArrayTypeStyle" />
|
||||
<module name="OuterTypeFilename" />
|
||||
|
||||
<!-- Modifiers -->
|
||||
<module name="RedundantModifier" />
|
||||
|
||||
<!-- Regexp -->
|
||||
<module name="RegexpSinglelineJava">
|
||||
<property name="format" value="^\t* +\t*\S" />
|
||||
<property name="message"
|
||||
value="Line has leading space characters; indentation should be performed with tabs only." />
|
||||
<property name="ignoreComments" value="true" />
|
||||
</module>
|
||||
<module name="Regexp">
|
||||
<property name="format" value="[ \t]+$" />
|
||||
<property name="illegalPattern" value="true" />
|
||||
<property name="message" value="Trailing whitespace" />
|
||||
</module>
|
||||
|
||||
<!-- Whitespace -->
|
||||
<module name="GenericWhitespace" />
|
||||
<module name="MethodParamPad" />
|
||||
<module name="NoWhitespaceAfter" >
|
||||
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS, ARRAY_DECLARATOR"/>
|
||||
</module>
|
||||
<module name="NoWhitespaceBefore" />
|
||||
<module name="ParenPad" />
|
||||
<module name="TypecastParenPad" />
|
||||
<module name="WhitespaceAfter" />
|
||||
<module name="WhitespaceAround" />
|
||||
|
||||
</module>
|
||||
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
<module name="com.puppycrawl.tools.checkstyle.Checker">
|
||||
<module name="io.spring.javaformat.checkstyle.SpringChecks" />
|
||||
</module>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
javaFormatVersion=0.0.7-SNAPSHOT
|
||||
version=2.0.3.BUILD-SNAPSHOT
|
||||
org.gradle.daemon=false
|
||||
|
||||
@@ -43,7 +43,6 @@ public class JUnitRestDocumentation
|
||||
/**
|
||||
* Creates a new {@code JUnitRestDocumentation} instance that will generate snippets
|
||||
* to the given {@code outputDirectory}.
|
||||
*
|
||||
* @param outputDirectory the output directory
|
||||
*/
|
||||
public JUnitRestDocumentation(String outputDirectory) {
|
||||
|
||||
@@ -46,7 +46,6 @@ public final class ManualRestDocumentation implements RestDocumentationContextPr
|
||||
/**
|
||||
* Creates a new {@code ManualRestDocumentation} instance that will generate snippets
|
||||
* to the given {@code outputDirectory}.
|
||||
*
|
||||
* @param outputDirectory the output directory
|
||||
*/
|
||||
public ManualRestDocumentation(String outputDirectory) {
|
||||
@@ -62,7 +61,6 @@ public final class ManualRestDocumentation implements RestDocumentationContextPr
|
||||
* {@link RestDocumentationContext} for the test on the given {@code testClass} with
|
||||
* the given {@code testMethodName}. Must be followed by a call to
|
||||
* {@link #afterTest()} once the test has completed.
|
||||
*
|
||||
* @param testClass the test class
|
||||
* @param testMethodName the name of the test method
|
||||
* @throws IllegalStateException if a context has already be created
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -28,28 +28,24 @@ public interface RestDocumentationContext {
|
||||
|
||||
/**
|
||||
* Returns the class whose tests are currently executing.
|
||||
*
|
||||
* @return The test class
|
||||
* @return the test class
|
||||
*/
|
||||
Class<?> getTestClass();
|
||||
|
||||
/**
|
||||
* Returns the name of the test method that is currently executing.
|
||||
*
|
||||
* @return The name of the test method
|
||||
* @return the name of the test method
|
||||
*/
|
||||
String getTestMethodName();
|
||||
|
||||
/**
|
||||
* Returns the current step count.
|
||||
*
|
||||
* @return The current step count
|
||||
* @return the current step count
|
||||
*/
|
||||
int getStepCount();
|
||||
|
||||
/**
|
||||
* Returns the output directory to which generated snippets should be written.
|
||||
*
|
||||
* @return the output directory
|
||||
*/
|
||||
File getOutputDirectory();
|
||||
|
||||
@@ -28,7 +28,6 @@ public interface RestDocumentationContextProvider {
|
||||
/**
|
||||
* Returns a {@link RestDocumentationContext} for the operation that is about to be
|
||||
* performed.
|
||||
*
|
||||
* @return the context for the operation
|
||||
*/
|
||||
RestDocumentationContext beforeOperation();
|
||||
|
||||
@@ -41,7 +41,6 @@ public abstract class CliDocumentation {
|
||||
/**
|
||||
* Returns a new {@code Snippet} that will document the curl request for the API
|
||||
* operation.
|
||||
*
|
||||
* @return the snippet that will document the curl request
|
||||
*/
|
||||
public static Snippet curlRequest() {
|
||||
@@ -52,7 +51,6 @@ public abstract class CliDocumentation {
|
||||
* Returns a new {@code Snippet} that will document the curl request for the API
|
||||
* operation. The given {@code attributes} will be available during snippet
|
||||
* generation.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the curl request
|
||||
*/
|
||||
@@ -64,7 +62,6 @@ public abstract class CliDocumentation {
|
||||
* Returns a new {@code Snippet} that will document the curl request for the API
|
||||
* operation. The given {@code commandFormatter} will be used to format the curl
|
||||
* command in the snippet.
|
||||
*
|
||||
* @param commandFormatter the command formatter
|
||||
* @return the snippet that will document the curl request
|
||||
* @since 1.2.0
|
||||
@@ -78,7 +75,6 @@ public abstract class CliDocumentation {
|
||||
* operation. The given {@code attributes} will be available during snippet
|
||||
* generation. The given {@code commandFormatter} will be used to format the curl
|
||||
* command in the snippet.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param commandFormatter the command formatter
|
||||
* @return the snippet that will document the curl request
|
||||
@@ -92,7 +88,6 @@ public abstract class CliDocumentation {
|
||||
/**
|
||||
* Returns a new {@code Snippet} that will document the HTTPie request for the API
|
||||
* operation.
|
||||
*
|
||||
* @return the snippet that will document the HTTPie request
|
||||
*/
|
||||
public static Snippet httpieRequest() {
|
||||
@@ -103,7 +98,6 @@ public abstract class CliDocumentation {
|
||||
* Returns a new {@code Snippet} that will document the HTTPie request for the API
|
||||
* operation. The given {@code attributes} will be available during snippet
|
||||
* generation.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the HTTPie request
|
||||
*/
|
||||
@@ -115,7 +109,6 @@ public abstract class CliDocumentation {
|
||||
* Returns a new {@code Snippet} that will document the HTTPie request for the API
|
||||
* operation. The given {@code commandFormatter} will be used to format the HTTPie
|
||||
* command in the snippet.
|
||||
*
|
||||
* @param commandFormatter the command formatter
|
||||
* @return the snippet that will document the HTTPie request
|
||||
* @since 1.2.0
|
||||
@@ -129,7 +122,6 @@ public abstract class CliDocumentation {
|
||||
* operation. The given {@code attributes} will be available during snippet
|
||||
* generation. The given {@code commandFormatter} will be used to format the HTTPie
|
||||
* command in the snippet snippet.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param commandFormatter the command formatter
|
||||
* @return the snippet that will document the HTTPie request
|
||||
@@ -142,8 +134,7 @@ public abstract class CliDocumentation {
|
||||
|
||||
/**
|
||||
* Creates a new {@code CommandFormatter} that produces multi-line output.
|
||||
*
|
||||
* @return A multi-line {@code CommandFormatter}
|
||||
* @return a multi-line {@code CommandFormatter}
|
||||
*/
|
||||
public static CommandFormatter multiLineFormat() {
|
||||
return new ConcatenatingCommandFormatter(" \\%n ");
|
||||
@@ -151,8 +142,7 @@ public abstract class CliDocumentation {
|
||||
|
||||
/**
|
||||
* Creates a new {@code CommandFormatter} that produces single-line output.
|
||||
*
|
||||
* @return A single-line {@code CommandFormatter}
|
||||
* @return a single-line {@code CommandFormatter}
|
||||
*/
|
||||
public static CommandFormatter singleLineFormat() {
|
||||
return new ConcatenatingCommandFormatter(" ");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -133,6 +133,7 @@ final class CliOperationRequest implements OperationRequest {
|
||||
private interface HeaderFilter {
|
||||
|
||||
boolean allow(String name, List<String> value);
|
||||
|
||||
}
|
||||
|
||||
private static final class BasicAuthHeaderFilter implements HeaderFilter {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -29,9 +29,8 @@ public interface CommandFormatter {
|
||||
|
||||
/**
|
||||
* Formats a list of {@code elements} into a single {@code String}.
|
||||
*
|
||||
* @param elements The {@code String} elements to be formatted
|
||||
* @return A single formatted {@code String}
|
||||
* @param elements the {@code String} elements to be formatted
|
||||
* @return a single formatted {@code String}
|
||||
*/
|
||||
String format(List<String> elements);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -35,9 +35,8 @@ final class ConcatenatingCommandFormatter implements CommandFormatter {
|
||||
|
||||
/**
|
||||
* Concatenates a list of {@code String}s with a specified separator.
|
||||
*
|
||||
* @param elements A list of {@code String}s to be concatenated
|
||||
* @return Concatenated list of {@code String}s as one {@code String}
|
||||
* @param elements a list of {@code String}s to be concatenated
|
||||
* @return concatenated list of {@code String}s as one {@code String}
|
||||
*/
|
||||
@Override
|
||||
public String format(List<String> elements) {
|
||||
|
||||
@@ -45,7 +45,6 @@ import org.springframework.util.StringUtils;
|
||||
* @see CliDocumentation#curlRequest()
|
||||
* @see CliDocumentation#curlRequest(CommandFormatter)
|
||||
* @see CliDocumentation#curlRequest(Map)
|
||||
* @see CliDocumentation#curlRequest(Map, CommandFormatter)
|
||||
*/
|
||||
public class CurlRequestSnippet extends TemplatedSnippet {
|
||||
|
||||
@@ -54,8 +53,7 @@ public class CurlRequestSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Creates a new {@code CurlRequestSnippet} that will use the given
|
||||
* {@code commandFormatter} to format the curl command.
|
||||
*
|
||||
* @param commandFormatter The formatter
|
||||
* @param commandFormatter the formatter
|
||||
*/
|
||||
protected CurlRequestSnippet(CommandFormatter commandFormatter) {
|
||||
this(null, commandFormatter);
|
||||
@@ -65,9 +63,8 @@ public class CurlRequestSnippet extends TemplatedSnippet {
|
||||
* Creates a new {@code CurlRequestSnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
* The given {@code commandFormaatter} will be used to format the curl command.
|
||||
*
|
||||
* @param attributes The additional attributes
|
||||
* @param commandFormatter The formatter for generating the snippet
|
||||
* @param attributes the additional attributes
|
||||
* @param commandFormatter the formatter for generating the snippet
|
||||
*/
|
||||
protected CurlRequestSnippet(Map<String, Object> attributes,
|
||||
CommandFormatter commandFormatter) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -54,8 +54,7 @@ public class HttpieRequestSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Creates a new {@code HttpieRequestSnippet} that will use the given
|
||||
* {@code commandFormatter} to format the HTTPie command.
|
||||
*
|
||||
* @param commandFormatter The formatter
|
||||
* @param commandFormatter the formatter
|
||||
*/
|
||||
protected HttpieRequestSnippet(CommandFormatter commandFormatter) {
|
||||
this(null, commandFormatter);
|
||||
@@ -65,9 +64,8 @@ public class HttpieRequestSnippet extends TemplatedSnippet {
|
||||
* Creates a new {@code HttpieRequestSnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
* The given {@code commandFormaatter} will be used to format the HTTPie command.
|
||||
*
|
||||
* @param attributes The additional attributes
|
||||
* @param commandFormatter The formatter for generating the snippet
|
||||
* @param attributes the additional attributes
|
||||
* @param commandFormatter the formatter for generating the snippet
|
||||
*/
|
||||
protected HttpieRequestSnippet(Map<String, Object> attributes,
|
||||
CommandFormatter commandFormatter) {
|
||||
|
||||
@@ -31,7 +31,6 @@ public abstract class AbstractConfigurer {
|
||||
|
||||
/**
|
||||
* Applies the configurer to the given {@code configuration}.
|
||||
*
|
||||
* @param configuration the configuration to be configured
|
||||
* @param context the current documentation context
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -19,7 +19,7 @@ package org.springframework.restdocs.config;
|
||||
/**
|
||||
* Base class for {@link NestedConfigurer} implementations.
|
||||
*
|
||||
* @param <PARENT> The type of the configurer's parent
|
||||
* @param <PARENT> the type of the configurer's parent
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -19,7 +19,7 @@ package org.springframework.restdocs.config;
|
||||
/**
|
||||
* A configurer that is nested and, therefore, has a parent.
|
||||
*
|
||||
* @param <PARENT> The parent's type
|
||||
* @param <PARENT> the parent's type
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@@ -27,7 +27,6 @@ interface NestedConfigurer<PARENT> {
|
||||
|
||||
/**
|
||||
* Returns the configurer's parent.
|
||||
*
|
||||
* @return the parent
|
||||
*/
|
||||
PARENT and();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -28,8 +28,8 @@ import org.springframework.restdocs.operation.preprocess.Preprocessors;
|
||||
/**
|
||||
* A configurer that can be used to configure the default operation preprocessors.
|
||||
*
|
||||
* @param <PARENT> The type of the configurer's parent
|
||||
* @param <TYPE> The concrete type of the configurer to be returned from chained methods
|
||||
* @param <PARENT> the type of the configurer's parent
|
||||
* @param <TYPE> the concrete type of the configurer to be returned from chained methods
|
||||
* @author Filip Hrisafov
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
@@ -44,7 +44,6 @@ public abstract class OperationPreprocessorsConfigurer<PARENT, TYPE>
|
||||
/**
|
||||
* Creates a new {@code OperationPreprocessorConfigurer} with the given
|
||||
* {@code parent}.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
protected OperationPreprocessorsConfigurer(PARENT parent) {
|
||||
@@ -64,7 +63,6 @@ public abstract class OperationPreprocessorsConfigurer<PARENT, TYPE>
|
||||
|
||||
/**
|
||||
* Configures the default operation request preprocessors.
|
||||
*
|
||||
* @param preprocessors the preprocessors
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -77,7 +75,6 @@ public abstract class OperationPreprocessorsConfigurer<PARENT, TYPE>
|
||||
|
||||
/**
|
||||
* Configures the default operation response preprocessors.
|
||||
*
|
||||
* @param preprocessors the preprocessors
|
||||
* @return {@code this}
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -35,9 +35,9 @@ import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
|
||||
/**
|
||||
* Abstract base class for the configuration of Spring REST Docs.
|
||||
*
|
||||
* @param <S> The concrete type of the {@link SnippetConfigurer}
|
||||
* @param <P> The concrete type of the {@link OperationPreprocessorsConfigurer}
|
||||
* @param <T> The concrete type of this configurer, to be returned from methods that
|
||||
* @param <S> the concrete type of the {@link SnippetConfigurer}
|
||||
* @param <P> the concrete type of the {@link OperationPreprocessorsConfigurer}
|
||||
* @param <T> the concrete type of this configurer, to be returned from methods that
|
||||
* support chaining
|
||||
* @author Andy Wilkinson
|
||||
* @author Filip Hrisafov
|
||||
@@ -52,7 +52,6 @@ public abstract class RestDocumentationConfigurer<S extends AbstractConfigurer,
|
||||
/**
|
||||
* Returns a {@link SnippetConfigurer} that can be used to configure the snippets that
|
||||
* will be generated.
|
||||
*
|
||||
* @return the snippet configurer
|
||||
*/
|
||||
public abstract S snippets();
|
||||
@@ -60,14 +59,12 @@ public abstract class RestDocumentationConfigurer<S extends AbstractConfigurer,
|
||||
/**
|
||||
* Returns an {@link OperationPreprocessorsConfigurer} that can be used to configure
|
||||
* the operation request and response preprocessors that will be used.
|
||||
*
|
||||
* @return the operation preprocessors configurer
|
||||
*/
|
||||
public abstract P operationPreprocessors();
|
||||
|
||||
/**
|
||||
* Configures the {@link TemplateEngine} that will be used for snippet rendering.
|
||||
*
|
||||
* @param templateEngine the template engine to use
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -80,8 +77,7 @@ public abstract class RestDocumentationConfigurer<S extends AbstractConfigurer,
|
||||
/**
|
||||
* Configures the {@link WriterResolver} that will be used to resolve a writer for a
|
||||
* snippet.
|
||||
*
|
||||
* @param writerResolver The writer resolver to use
|
||||
* @param writerResolver the writer resolver to use
|
||||
* @return {@code this}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -93,7 +89,6 @@ public abstract class RestDocumentationConfigurer<S extends AbstractConfigurer,
|
||||
/**
|
||||
* Applies this configurer to the given {@code configuration} within the given
|
||||
* {@code context}.
|
||||
*
|
||||
* @param configuration the configuration
|
||||
* @param context the current context
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -33,8 +33,8 @@ import org.springframework.restdocs.templates.TemplateFormats;
|
||||
/**
|
||||
* A configurer that can be used to configure the generated documentation snippets.
|
||||
*
|
||||
* @param <PARENT> The type of the configurer's parent
|
||||
* @param <TYPE> The concrete type of the configurer to be returned from chained methods
|
||||
* @param <PARENT> the type of the configurer's parent
|
||||
* @param <TYPE> the concrete type of the configurer to be returned from chained methods
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@@ -67,7 +67,6 @@ public abstract class SnippetConfigurer<PARENT, TYPE>
|
||||
|
||||
/**
|
||||
* Creates a new {@code SnippetConfigurer} with the given {@code parent}.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
protected SnippetConfigurer(PARENT parent) {
|
||||
@@ -86,7 +85,6 @@ public abstract class SnippetConfigurer<PARENT, TYPE>
|
||||
/**
|
||||
* Configures any documentation snippets to be written using the given
|
||||
* {@code encoding}. The default is UTF-8.
|
||||
*
|
||||
* @param encoding the encoding
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -98,7 +96,6 @@ public abstract class SnippetConfigurer<PARENT, TYPE>
|
||||
|
||||
/**
|
||||
* Configures the documentation snippets that will be produced by default.
|
||||
*
|
||||
* @param defaultSnippets the default snippets
|
||||
* @return {@code this}
|
||||
* @see #withAdditionalDefaults(Snippet...)
|
||||
@@ -111,7 +108,6 @@ public abstract class SnippetConfigurer<PARENT, TYPE>
|
||||
|
||||
/**
|
||||
* Configures additional documentation snippets that will be produced by default.
|
||||
*
|
||||
* @param additionalDefaultSnippets the additional default snippets
|
||||
* @return {@code this}
|
||||
* @see #withDefaults(Snippet...)
|
||||
@@ -124,7 +120,6 @@ public abstract class SnippetConfigurer<PARENT, TYPE>
|
||||
|
||||
/**
|
||||
* Configures the format of the documentation snippet templates.
|
||||
*
|
||||
* @param format the snippet template format
|
||||
* @return {@code this}
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,6 @@ public class Constraint {
|
||||
/**
|
||||
* Creates a new {@code Constraint} with the given {@code name} and
|
||||
* {@code configuration}.
|
||||
*
|
||||
* @param name the name
|
||||
* @param configuration the configuration
|
||||
*/
|
||||
@@ -43,7 +42,6 @@ public class Constraint {
|
||||
|
||||
/**
|
||||
* Returns the name of the constraint.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
@@ -52,7 +50,6 @@ public class Constraint {
|
||||
|
||||
/**
|
||||
* Returns the configuration of the constraint.
|
||||
*
|
||||
* @return the configuration
|
||||
*/
|
||||
public Map<String, Object> getConfiguration() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -25,7 +25,6 @@ public interface ConstraintDescriptionResolver {
|
||||
|
||||
/**
|
||||
* Resolves the description for the given {@code constraint}.
|
||||
*
|
||||
* @param constraint the constraint
|
||||
* @return the description
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,6 @@ public class ConstraintDescriptions {
|
||||
* Constraints will be resolved using a {@link ValidatorConstraintResolver} and
|
||||
* descriptions will be resolved using a
|
||||
* {@link ResourceBundleConstraintDescriptionResolver}.
|
||||
*
|
||||
* @param clazz the class
|
||||
*/
|
||||
public ConstraintDescriptions(Class<?> clazz) {
|
||||
@@ -51,7 +50,6 @@ public class ConstraintDescriptions {
|
||||
* Constraints will be resolved using the given {@code constraintResolver} and
|
||||
* descriptions will be resolved using a
|
||||
* {@link ResourceBundleConstraintDescriptionResolver}.
|
||||
*
|
||||
* @param clazz the class
|
||||
* @param constraintResolver the constraint resolver
|
||||
*/
|
||||
@@ -64,7 +62,6 @@ public class ConstraintDescriptions {
|
||||
* Create a new {@code ConstraintDescriptions} for the given {@code clazz}.
|
||||
* Constraints will be resolved using a {@link ValidatorConstraintResolver} and
|
||||
* descriptions will be resolved using the given {@code descriptionResolver}.
|
||||
*
|
||||
* @param clazz the class
|
||||
* @param descriptionResolver the description resolver
|
||||
*/
|
||||
@@ -77,7 +74,6 @@ public class ConstraintDescriptions {
|
||||
* Create a new {@code ConstraintDescriptions} for the given {@code clazz}.
|
||||
* Constraints will be resolved using the given {@code constraintResolver} and
|
||||
* descriptions will be resolved using the given {@code descriptionResolver}.
|
||||
*
|
||||
* @param clazz the class
|
||||
* @param constraintResolver the constraint resolver
|
||||
* @param descriptionResolver the description resolver
|
||||
@@ -91,7 +87,6 @@ public class ConstraintDescriptions {
|
||||
|
||||
/**
|
||||
* Returns a list of the descriptions for the constraints on the given property.
|
||||
*
|
||||
* @param property the property
|
||||
* @return the list of constraint descriptions
|
||||
*/
|
||||
@@ -105,4 +100,5 @@ public class ConstraintDescriptions {
|
||||
Collections.sort(descriptions);
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ public interface ConstraintResolver {
|
||||
/**
|
||||
* Resolves and returns the constraints for the given {@code property} on the given
|
||||
* {@code clazz}. If there are no constraints, an empty list is returned.
|
||||
*
|
||||
* @param property the property
|
||||
* @param clazz the class
|
||||
* @return the list of constraints, never {@code null}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -138,7 +138,6 @@ public class ResourceBundleConstraintDescriptionResolver
|
||||
/**
|
||||
* Creates a new {@code ResourceBundleConstraintDescriptionResolver} that will resolve
|
||||
* descriptions by looking them up in the given {@code resourceBundle}.
|
||||
*
|
||||
* @param resourceBundle the resource bundle
|
||||
*/
|
||||
public ResourceBundleConstraintDescriptionResolver(ResourceBundle resourceBundle) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -54,7 +54,6 @@ public class ValidatorConstraintResolver implements ConstraintResolver {
|
||||
/**
|
||||
* Creates a new {@code ValidatorConstraintResolver} that will use the given
|
||||
* {@code Validator} to resolve constraints.
|
||||
*
|
||||
* @param validator the validator
|
||||
*/
|
||||
public ValidatorConstraintResolver(Validator validator) {
|
||||
|
||||
@@ -27,7 +27,6 @@ public class RestDocumentationGenerationException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Creates a new {@code RestDocumentationException} with the given {@code cause}.
|
||||
*
|
||||
* @param cause the cause
|
||||
*/
|
||||
public RestDocumentationGenerationException(Throwable cause) {
|
||||
@@ -37,7 +36,6 @@ public class RestDocumentationGenerationException extends RuntimeException {
|
||||
/**
|
||||
* Creates a new {@code RestDocumentationException} with the given {@code message} and
|
||||
* {@code cause}.
|
||||
*
|
||||
* @param message the message
|
||||
* @param cause the cause
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -87,7 +87,6 @@ public final class RestDocumentationGenerator<REQ, RESP> {
|
||||
* {@code responseConverter} are used to convert the operation's request and response
|
||||
* into generic {@code OperationRequest} and {@code OperationResponse} instances that
|
||||
* can then be documented. The given documentation {@code snippets} will be produced.
|
||||
*
|
||||
* @param identifier the identifier for the operation
|
||||
* @param requestConverter the request converter
|
||||
* @param responseConverter the response converter
|
||||
@@ -109,7 +108,6 @@ public final class RestDocumentationGenerator<REQ, RESP> {
|
||||
* can then be documented. The given {@code requestPreprocessor} is applied to the
|
||||
* request before it is documented. The given documentation {@code snippets} will be
|
||||
* produced.
|
||||
*
|
||||
* @param identifier the identifier for the operation
|
||||
* @param requestConverter the request converter
|
||||
* @param responseConverter the response converter
|
||||
@@ -132,7 +130,6 @@ public final class RestDocumentationGenerator<REQ, RESP> {
|
||||
* can then be documented. The given {@code responsePreprocessor} is applied to the
|
||||
* response before it is documented. The given documentation {@code snippets} will be
|
||||
* produced.
|
||||
*
|
||||
* @param identifier the identifier for the operation
|
||||
* @param requestConverter the request converter
|
||||
* @param responseConverter the response converter
|
||||
@@ -156,7 +153,6 @@ public final class RestDocumentationGenerator<REQ, RESP> {
|
||||
* can then be documented. The given {@code requestPreprocessor} and
|
||||
* {@code responsePreprocessor} are applied to the request and response before they
|
||||
* are documented. The given documentation {@code snippets} will be produced.
|
||||
*
|
||||
* @param identifier the identifier for the operation
|
||||
* @param requestConverter the request converter
|
||||
* @param responseConverter the response converter
|
||||
@@ -187,7 +183,6 @@ public final class RestDocumentationGenerator<REQ, RESP> {
|
||||
/**
|
||||
* Handles the given {@code request} and {@code response}, producing documentation
|
||||
* snippets for them using the given {@code configuration}.
|
||||
*
|
||||
* @param request the request
|
||||
* @param response the request
|
||||
* @param configuration the configuration
|
||||
@@ -215,7 +210,6 @@ public final class RestDocumentationGenerator<REQ, RESP> {
|
||||
* Creates a new {@link RestDocumentationGenerator} with the same configuration as
|
||||
* this one other than its snippets. The new generator will use the given
|
||||
* {@code snippets}.
|
||||
*
|
||||
* @param snippets the snippets
|
||||
* @return the new generator
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,6 @@ public abstract class AbstractHeadersSnippet extends TemplatedSnippet {
|
||||
* {@code <type>-headers}. The headers will be documented using the given
|
||||
* {@code descriptors} and the given {@code attributes} will be included in the model
|
||||
* during template rendering.
|
||||
*
|
||||
* @param type the type of the headers
|
||||
* @param descriptors the header descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -91,7 +90,6 @@ public abstract class AbstractHeadersSnippet extends TemplatedSnippet {
|
||||
* Finds the headers that are missing from the operation. A header is missing if it is
|
||||
* described by one of the {@code headerDescriptors} but is not present in the
|
||||
* operation.
|
||||
*
|
||||
* @param operation the operation
|
||||
* @return descriptors for the headers that are missing from the operation
|
||||
*/
|
||||
@@ -111,7 +109,6 @@ public abstract class AbstractHeadersSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Extracts the names of the headers from the request or response of the given
|
||||
* {@code operation}.
|
||||
*
|
||||
* @param operation the operation
|
||||
* @return the header names
|
||||
*/
|
||||
@@ -120,7 +117,6 @@ public abstract class AbstractHeadersSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Returns the list of {@link HeaderDescriptor HeaderDescriptors} that will be used to
|
||||
* generate the documentation.
|
||||
*
|
||||
* @return the header descriptors
|
||||
*/
|
||||
protected final List<HeaderDescriptor> getHeaderDescriptors() {
|
||||
@@ -129,7 +125,6 @@ public abstract class AbstractHeadersSnippet extends TemplatedSnippet {
|
||||
|
||||
/**
|
||||
* Returns a model for the given {@code descriptor}.
|
||||
*
|
||||
* @param descriptor the descriptor
|
||||
* @return the model
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,6 @@ public class HeaderDescriptor extends AbstractDescriptor<HeaderDescriptor> {
|
||||
|
||||
/**
|
||||
* Marks the header as optional.
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public final HeaderDescriptor optional() {
|
||||
@@ -53,7 +52,6 @@ public class HeaderDescriptor extends AbstractDescriptor<HeaderDescriptor> {
|
||||
|
||||
/**
|
||||
* Returns the name for the header.
|
||||
*
|
||||
* @return the header name
|
||||
*/
|
||||
public final String getName() {
|
||||
@@ -62,7 +60,6 @@ public class HeaderDescriptor extends AbstractDescriptor<HeaderDescriptor> {
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the described header is optional, otherwise {@code false}.
|
||||
*
|
||||
* @return {@code true} if the described header is optional, otherwise {@code false}
|
||||
*/
|
||||
public final boolean isOptional() {
|
||||
|
||||
@@ -38,8 +38,7 @@ public abstract class HeaderDocumentation {
|
||||
/**
|
||||
* Creates a {@code HeaderDescriptor} that describes a header with the given
|
||||
* {@code name}.
|
||||
*
|
||||
* @param name The name of the header
|
||||
* @param name the name of the header
|
||||
* @return a {@code HeaderDescriptor} ready for further configuration
|
||||
*/
|
||||
public static HeaderDescriptor headerWithName(String name) {
|
||||
@@ -52,7 +51,6 @@ public abstract class HeaderDocumentation {
|
||||
* <p>
|
||||
* If a header is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the request's headers
|
||||
* @return the snippet that will document the request headers
|
||||
* @see #headerWithName(String)
|
||||
@@ -67,7 +65,6 @@ public abstract class HeaderDocumentation {
|
||||
* <p>
|
||||
* If a header is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the request's headers
|
||||
* @return the snippet that will document the request headers
|
||||
* @see #headerWithName(String)
|
||||
@@ -84,7 +81,6 @@ public abstract class HeaderDocumentation {
|
||||
* <p>
|
||||
* If a header is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's headers
|
||||
* @return the snippet that will document the request headers
|
||||
@@ -102,7 +98,6 @@ public abstract class HeaderDocumentation {
|
||||
* <p>
|
||||
* If a header is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's headers
|
||||
* @return the snippet that will document the request headers
|
||||
@@ -119,7 +114,6 @@ public abstract class HeaderDocumentation {
|
||||
* <p>
|
||||
* If a header is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the response's headers
|
||||
* @return the snippet that will document the response headers
|
||||
* @see #headerWithName(String)
|
||||
@@ -135,7 +129,6 @@ public abstract class HeaderDocumentation {
|
||||
* <p>
|
||||
* If a header is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the response's headers
|
||||
* @return the snippet that will document the response headers
|
||||
* @see #headerWithName(String)
|
||||
@@ -153,7 +146,6 @@ public abstract class HeaderDocumentation {
|
||||
* <p>
|
||||
* If a header is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response's headers
|
||||
* @return the snippet that will document the response headers
|
||||
@@ -172,7 +164,6 @@ public abstract class HeaderDocumentation {
|
||||
* <p>
|
||||
* If a header is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response's headers
|
||||
* @return the snippet that will document the response headers
|
||||
|
||||
@@ -38,7 +38,6 @@ public class RequestHeadersSnippet extends AbstractHeadersSnippet {
|
||||
/**
|
||||
* Creates a new {@code RequestHeadersSnippet} that will document the headers in the
|
||||
* request using the given {@code descriptors}.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
*/
|
||||
protected RequestHeadersSnippet(List<HeaderDescriptor> descriptors) {
|
||||
@@ -49,7 +48,6 @@ public class RequestHeadersSnippet extends AbstractHeadersSnippet {
|
||||
* Creates a new {@code RequestHeadersSnippet} that will document the headers in the
|
||||
* request using the given {@code descriptors}. The given {@code attributes} will be
|
||||
* included in the model during template rendering.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,6 @@ public class ResponseHeadersSnippet extends AbstractHeadersSnippet {
|
||||
/**
|
||||
* Creates a new {@code ResponseHeadersSnippet} that will document the headers in the
|
||||
* response using the given {@code descriptors}.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
*/
|
||||
protected ResponseHeadersSnippet(List<HeaderDescriptor> descriptors) {
|
||||
@@ -49,7 +48,6 @@ public class ResponseHeadersSnippet extends AbstractHeadersSnippet {
|
||||
* Creates a new {@code ResponseHeadersSnippet} that will document the headers in the
|
||||
* response using the given {@code descriptors}. The given {@code attributes} will be
|
||||
* included in the model during template rendering.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,6 @@ public abstract class HttpDocumentation {
|
||||
/**
|
||||
* Returns a new {@code Snippet} that will document the HTTP request for the API
|
||||
* operation.
|
||||
*
|
||||
* @return the snippet that will document the HTTP request
|
||||
*/
|
||||
public static HttpRequestSnippet httpRequest() {
|
||||
@@ -44,7 +43,6 @@ public abstract class HttpDocumentation {
|
||||
* Returns a new {@code Snippet} that will document the HTTP request for the API
|
||||
* operation. The given {@code attributes} will be available during snippet
|
||||
* generation.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the HTTP request
|
||||
*/
|
||||
@@ -55,7 +53,6 @@ public abstract class HttpDocumentation {
|
||||
/**
|
||||
* Returns a {@code Snippet} that will document the HTTP response for the API
|
||||
* operation.
|
||||
*
|
||||
* @return the snippet that will document the HTTP response
|
||||
*/
|
||||
public static HttpResponseSnippet httpResponse() {
|
||||
@@ -66,7 +63,6 @@ public abstract class HttpDocumentation {
|
||||
* Returns a {@code Snippet} that will document the HTTP response for the API
|
||||
* operation. The given {@code attributes} will be available during snippet
|
||||
* generation.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the HTTP response
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -57,8 +57,7 @@ public class HttpRequestSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Creates a new {@code HttpRequestSnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
*
|
||||
* @param attributes The additional attributes
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
protected HttpRequestSnippet(Map<String, Object> attributes) {
|
||||
super("http-request", attributes);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -47,8 +47,7 @@ public class HttpResponseSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Creates a new {@code HttpResponseSnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
*
|
||||
* @param attributes The additional attributes
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
protected HttpResponseSnippet(Map<String, Object> attributes) {
|
||||
super("http-response", attributes);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -53,7 +53,7 @@ class AtomLinkExtractor extends AbstractJsonLinkExtractor {
|
||||
if (relObject instanceof String && hrefObject instanceof String) {
|
||||
Object titleObject = linkMap.get("title");
|
||||
return new Link((String) relObject, (String) hrefObject,
|
||||
titleObject instanceof String ? (String) titleObject : null);
|
||||
(titleObject instanceof String) ? (String) titleObject : null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class HalLinkExtractor extends AbstractJsonLinkExtractor {
|
||||
if (hrefObject instanceof String) {
|
||||
Object titleObject = possibleLinkMap.get("title");
|
||||
return new Link(rel, (String) hrefObject,
|
||||
titleObject instanceof String ? (String) titleObject : null);
|
||||
(titleObject instanceof String) ? (String) titleObject : null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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,8 +34,7 @@ public abstract class HypermediaDocumentation {
|
||||
|
||||
/**
|
||||
* Creates a {@code LinkDescriptor} that describes a link with the given {@code rel}.
|
||||
*
|
||||
* @param rel The rel of the link
|
||||
* @param rel the rel of the link
|
||||
* @return a {@code LinkDescriptor} ready for further configuration
|
||||
*/
|
||||
public static LinkDescriptor linkWithRel(String rel) {
|
||||
@@ -59,7 +58,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
*/
|
||||
@@ -84,7 +82,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
*/
|
||||
@@ -103,7 +100,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
*/
|
||||
@@ -122,7 +118,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
*/
|
||||
@@ -148,7 +143,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
@@ -176,7 +170,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
@@ -198,7 +191,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
@@ -220,7 +212,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
@@ -248,7 +239,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param linkExtractor used to extract the links from the response
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
@@ -275,7 +265,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param linkExtractor used to extract the links from the response
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
@@ -296,7 +285,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param linkExtractor used to extract the links from the response
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
@@ -317,7 +305,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param linkExtractor used to extract the links from the response
|
||||
* @param descriptors the descriptions of the response's links
|
||||
* @return the snippet that will document the links
|
||||
@@ -345,7 +332,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param linkExtractor used to extract the links from the response
|
||||
* @param descriptors the descriptions of the response's links
|
||||
@@ -374,7 +360,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param linkExtractor used to extract the links from the response
|
||||
* @param descriptors the descriptions of the response's links
|
||||
@@ -397,7 +382,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param linkExtractor used to extract the links from the response
|
||||
* @param descriptors the descriptions of the response's links
|
||||
@@ -420,7 +404,6 @@ public abstract class HypermediaDocumentation {
|
||||
* If a descriptor does not have a {@link LinkDescriptor#description(Object)
|
||||
* description}, the {@link Link#getTitle() title} of the link will be used. If the
|
||||
* link does not have a title a failure will occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param linkExtractor used to extract the links from the response
|
||||
* @param descriptors the descriptions of the response's links
|
||||
@@ -445,8 +428,7 @@ public abstract class HypermediaDocumentation {
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @return The extractor for HAL-style links
|
||||
* @return the extractor for HAL-style links
|
||||
*/
|
||||
public static LinkExtractor halLinks() {
|
||||
return new HalLinkExtractor();
|
||||
@@ -466,8 +448,7 @@ public abstract class HypermediaDocumentation {
|
||||
* ]
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @return The extractor for Atom-style links
|
||||
* @return the extractor for Atom-style links
|
||||
*/
|
||||
public static LinkExtractor atomLinks() {
|
||||
return new AtomLinkExtractor();
|
||||
|
||||
@@ -33,9 +33,8 @@ public class Link {
|
||||
|
||||
/**
|
||||
* Creates a new {@code Link} with the given {@code rel} and {@code href}.
|
||||
*
|
||||
* @param rel The link's rel
|
||||
* @param href The link's href
|
||||
* @param rel the link's rel
|
||||
* @param href the link's href
|
||||
*/
|
||||
public Link(String rel, String href) {
|
||||
this(rel, href, null);
|
||||
@@ -44,10 +43,9 @@ public class Link {
|
||||
/**
|
||||
* Creates a new {@code Link} with the given {@code rel}, {@code href}, and
|
||||
* {@code title}.
|
||||
*
|
||||
* @param rel The link's rel
|
||||
* @param href The link's href
|
||||
* @param title The link's title
|
||||
* @param rel the link's rel
|
||||
* @param href the link's href
|
||||
* @param title the link's title
|
||||
*/
|
||||
public Link(String rel, String href, String title) {
|
||||
this.rel = rel;
|
||||
@@ -79,16 +77,6 @@ public class Link {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + this.href.hashCode();
|
||||
result = prime * result + this.rel.hashCode();
|
||||
result = prime * result + ((this.title == null) ? 0 : this.title.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
@@ -118,6 +106,16 @@ public class Link {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + this.href.hashCode();
|
||||
result = prime * result + this.rel.hashCode();
|
||||
result = prime * result + ((this.title == null) ? 0 : this.title.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringCreator(this).append("rel", this.rel).append("href", this.href)
|
||||
|
||||
@@ -32,7 +32,6 @@ public class LinkDescriptor extends IgnorableDescriptor<LinkDescriptor> {
|
||||
|
||||
/**
|
||||
* Creates a new {@code LinkDescriptor} describing a link with the given {@code rel}.
|
||||
*
|
||||
* @param rel the rel of the link
|
||||
*/
|
||||
protected LinkDescriptor(String rel) {
|
||||
@@ -41,7 +40,6 @@ public class LinkDescriptor extends IgnorableDescriptor<LinkDescriptor> {
|
||||
|
||||
/**
|
||||
* Marks the link as optional.
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public final LinkDescriptor optional() {
|
||||
@@ -51,7 +49,6 @@ public class LinkDescriptor extends IgnorableDescriptor<LinkDescriptor> {
|
||||
|
||||
/**
|
||||
* Returns the rel of the link described by this descriptor.
|
||||
*
|
||||
* @return the rel
|
||||
*/
|
||||
public final String getRel() {
|
||||
@@ -60,7 +57,6 @@ public class LinkDescriptor extends IgnorableDescriptor<LinkDescriptor> {
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the described link is optional, otherwise {@code false}.
|
||||
*
|
||||
* @return {@code true} if the described link is optional, otherwise {@code false}
|
||||
*/
|
||||
public final boolean isOptional() {
|
||||
|
||||
@@ -34,9 +34,8 @@ public interface LinkExtractor {
|
||||
/**
|
||||
* Extract the links from the given {@code response}, returning a {@code Map} of links
|
||||
* where the keys are the link rels.
|
||||
*
|
||||
* @param response The response from which the links are to be extracted
|
||||
* @return The extracted links, keyed by rel
|
||||
* @param response the response from which the links are to be extracted
|
||||
* @return the extracted links, keyed by rel
|
||||
* @throws IOException if link extraction fails
|
||||
*/
|
||||
Map<String, List<Link>> extractLinks(OperationResponse response) throws IOException;
|
||||
|
||||
@@ -57,7 +57,6 @@ public class LinksSnippet extends TemplatedSnippet {
|
||||
* Creates a new {@code LinksSnippet} that will extract links using the given
|
||||
* {@code linkExtractor} and document them using the given {@code descriptors}.
|
||||
* Undocumented links will trigger a failure.
|
||||
*
|
||||
* @param linkExtractor the link extractor
|
||||
* @param descriptors the link descriptors
|
||||
*/
|
||||
@@ -71,7 +70,6 @@ public class LinksSnippet extends TemplatedSnippet {
|
||||
* {@code linkExtractor} and document them using the given {@code descriptors}. If
|
||||
* {@code ignoreUndocumentedLinks} is {@code true}, undocumented links will be ignored
|
||||
* and will not trigger a failure.
|
||||
*
|
||||
* @param linkExtractor the link extractor
|
||||
* @param descriptors the link descriptors
|
||||
* @param ignoreUndocumentedLinks whether undocumented links should be ignored
|
||||
@@ -86,7 +84,6 @@ public class LinksSnippet extends TemplatedSnippet {
|
||||
* {@code linkExtractor} and document them using the given {@code descriptors}. The
|
||||
* given {@code attributes} will be included in the model during template rendering.
|
||||
* Undocumented links will trigger a failure.
|
||||
*
|
||||
* @param linkExtractor the link extractor
|
||||
* @param descriptors the link descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -102,7 +99,6 @@ public class LinksSnippet extends TemplatedSnippet {
|
||||
* given {@code attributes} will be included in the model during template rendering.
|
||||
* If {@code ignoreUndocumentedLinks} is {@code true}, undocumented links will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param linkExtractor the link extractor
|
||||
* @param descriptors the link descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -220,7 +216,6 @@ public class LinksSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Returns a {@code Map} of {@link LinkDescriptor LinkDescriptors} keyed by their
|
||||
* {@link LinkDescriptor#getRel() rels}.
|
||||
*
|
||||
* @return the link descriptors
|
||||
*/
|
||||
protected final Map<String, LinkDescriptor> getDescriptorsByRel() {
|
||||
@@ -229,7 +224,6 @@ public class LinksSnippet extends TemplatedSnippet {
|
||||
|
||||
/**
|
||||
* Returns a model for the given {@code descriptor}.
|
||||
*
|
||||
* @param descriptor the descriptor
|
||||
* @return the model
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2018 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,7 +34,7 @@ abstract class AbstractOperationMessage {
|
||||
private final HttpHeaders headers;
|
||||
|
||||
AbstractOperationMessage(byte[] content, HttpHeaders headers) {
|
||||
this.content = content == null ? new byte[0] : content;
|
||||
this.content = (content != null) ? content : new byte[0];
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ abstract class AbstractOperationMessage {
|
||||
public String getContentAsString() {
|
||||
if (this.content.length > 0) {
|
||||
Charset charset = extractCharsetFromContentTypeHeader();
|
||||
return charset != null ? new String(this.content, charset)
|
||||
return (charset != null) ? new String(this.content, charset)
|
||||
: new String(this.content);
|
||||
}
|
||||
return "";
|
||||
|
||||
@@ -30,7 +30,6 @@ public class ConversionException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Creates a new {@code ConversionException} with the given {@code cause}.
|
||||
*
|
||||
* @param cause the cause
|
||||
*/
|
||||
public ConversionException(Throwable cause) {
|
||||
@@ -40,7 +39,6 @@ public class ConversionException extends RuntimeException {
|
||||
/**
|
||||
* Creates a new {@code ConversionException} with the given {@code message} and
|
||||
* {@code cause}.
|
||||
*
|
||||
* @param message the message
|
||||
* @param cause the cause
|
||||
*/
|
||||
|
||||
@@ -27,28 +27,24 @@ public interface Operation {
|
||||
|
||||
/**
|
||||
* Returns a {@code Map} of attributes associated with the operation.
|
||||
*
|
||||
* @return the attributes
|
||||
*/
|
||||
Map<String, Object> getAttributes();
|
||||
|
||||
/**
|
||||
* Returns the name of the operation.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Returns the request that was sent.
|
||||
*
|
||||
* @return the request
|
||||
*/
|
||||
OperationRequest getRequest();
|
||||
|
||||
/**
|
||||
* Returns the response that was received.
|
||||
*
|
||||
* @return the response
|
||||
*/
|
||||
OperationResponse getResponse();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -33,7 +33,6 @@ public interface OperationRequest {
|
||||
/**
|
||||
* Returns the content of the request. If the request has no content an empty array is
|
||||
* returned.
|
||||
*
|
||||
* @return the contents, never {@code null}
|
||||
*/
|
||||
byte[] getContent();
|
||||
@@ -43,21 +42,18 @@ public interface OperationRequest {
|
||||
* content an empty string is returned. If the request has a {@code Content-Type}
|
||||
* header that specifies a charset then that charset will be used when converting the
|
||||
* contents to a {@code String}.
|
||||
*
|
||||
* @return the contents as string, never {@code null}
|
||||
*/
|
||||
String getContentAsString();
|
||||
|
||||
/**
|
||||
* Returns the headers that were included in the request.
|
||||
*
|
||||
* @return the headers
|
||||
*/
|
||||
HttpHeaders getHeaders();
|
||||
|
||||
/**
|
||||
* Returns the HTTP method of the request.
|
||||
*
|
||||
* @return the HTTP method
|
||||
*/
|
||||
HttpMethod getMethod();
|
||||
@@ -66,7 +62,6 @@ public interface OperationRequest {
|
||||
* Returns the request's parameters. For a {@code GET} request, the parameters are
|
||||
* derived from the query string. For a {@code POST} request, the parameters are
|
||||
* derived form the request's body.
|
||||
*
|
||||
* @return the parameters
|
||||
*/
|
||||
Parameters getParameters();
|
||||
@@ -74,14 +69,12 @@ public interface OperationRequest {
|
||||
/**
|
||||
* Returns the request's parts, provided that it is a multipart request. If not, then
|
||||
* an empty {@link Collection} is returned.
|
||||
*
|
||||
* @return the parts
|
||||
*/
|
||||
Collection<OperationRequestPart> getParts();
|
||||
|
||||
/**
|
||||
* Returns the request's URI.
|
||||
*
|
||||
* @return the URI
|
||||
*/
|
||||
URI getUri();
|
||||
@@ -89,7 +82,6 @@ public interface OperationRequest {
|
||||
/**
|
||||
* Returns the {@link RequestCookie cookies} sent with the request. If no cookies were
|
||||
* sent an empty collection is returned.
|
||||
*
|
||||
* @return the cookies, never {@code null}
|
||||
* @since 1.2.0
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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,7 +34,6 @@ public class OperationRequestFactory {
|
||||
* Creates a new {@link OperationRequest}. The given {@code headers} will be augmented
|
||||
* to ensure that they always include a {@code Content-Length} header if the request
|
||||
* has any content and a {@code Host} header.
|
||||
*
|
||||
* @param uri the request's uri
|
||||
* @param method the request method
|
||||
* @param content the content of the request
|
||||
@@ -55,7 +54,6 @@ public class OperationRequestFactory {
|
||||
* Creates a new {@link OperationRequest}. The given {@code headers} will be augmented
|
||||
* to ensure that they always include a {@code Content-Length} header if the request
|
||||
* has any content and a {@code Host} header.
|
||||
*
|
||||
* @param uri the request's uri
|
||||
* @param method the request method
|
||||
* @param content the content of the request
|
||||
@@ -75,11 +73,9 @@ public class OperationRequestFactory {
|
||||
* Creates a new {@code OperationRequest} based on the given {@code original} but with
|
||||
* the given {@code newContent}. If the original request had a {@code Content-Length}
|
||||
* header it will be modified to match the length of the new content.
|
||||
*
|
||||
* @param original The original request
|
||||
* @param newContent The new content
|
||||
*
|
||||
* @return The new request with the new content
|
||||
* @param original the original request
|
||||
* @param newContent the new content
|
||||
* @return the new request with the new content
|
||||
*/
|
||||
public OperationRequest createFrom(OperationRequest original, byte[] newContent) {
|
||||
return new StandardOperationRequest(original.getUri(), original.getMethod(),
|
||||
@@ -90,11 +86,9 @@ public class OperationRequestFactory {
|
||||
/**
|
||||
* Creates a new {@code OperationRequest} based on the given {@code original} but with
|
||||
* the given {@code newHeaders}.
|
||||
*
|
||||
* @param original The original request
|
||||
* @param newHeaders The new headers
|
||||
*
|
||||
* @return The new request with the new headers
|
||||
* @param original the original request
|
||||
* @param newHeaders the new headers
|
||||
* @return the new request with the new headers
|
||||
*/
|
||||
public OperationRequest createFrom(OperationRequest original,
|
||||
HttpHeaders newHeaders) {
|
||||
@@ -106,11 +100,9 @@ public class OperationRequestFactory {
|
||||
/**
|
||||
* Creates a new {@code OperationRequest} based on the given {@code original} but with
|
||||
* the given {@code newParameters}.
|
||||
*
|
||||
* @param original The original request
|
||||
* @param newParameters The new parameters
|
||||
*
|
||||
* @return The new request with the new parameters
|
||||
* @param original the original request
|
||||
* @param newParameters the new parameters
|
||||
* @return the new request with the new parameters
|
||||
*/
|
||||
public OperationRequest createFrom(OperationRequest original,
|
||||
Parameters newParameters) {
|
||||
|
||||
@@ -28,21 +28,18 @@ public interface OperationRequestPart {
|
||||
|
||||
/**
|
||||
* Returns the name of the part.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Returns the name of the file that is being uploaded in this part.
|
||||
*
|
||||
* @return the name of the file
|
||||
*/
|
||||
String getSubmittedFileName();
|
||||
|
||||
/**
|
||||
* Returns the contents of the part.
|
||||
*
|
||||
* @return the contents
|
||||
*/
|
||||
byte[] getContent();
|
||||
@@ -52,14 +49,12 @@ public interface OperationRequestPart {
|
||||
* empty string is returned. If the part has a {@code Content-Type} header that
|
||||
* specifies a charset then that charset will be used when converting the contents to
|
||||
* a {@code String}.
|
||||
*
|
||||
* @return the contents as string, never {@code null}
|
||||
*/
|
||||
String getContentAsString();
|
||||
|
||||
/**
|
||||
* Returns the part's headers.
|
||||
*
|
||||
* @return the headers
|
||||
*/
|
||||
HttpHeaders getHeaders();
|
||||
|
||||
@@ -29,7 +29,6 @@ public class OperationRequestPartFactory {
|
||||
* Creates a new {@link OperationRequestPart}. The given {@code headers} will be
|
||||
* augmented to ensure that they always include a {@code Content-Length} header if the
|
||||
* part has any content.
|
||||
*
|
||||
* @param name the name of the part
|
||||
* @param submittedFileName the name of the file being submitted by the part
|
||||
* @param content the content of the part
|
||||
|
||||
@@ -30,14 +30,12 @@ public interface OperationResponse {
|
||||
|
||||
/**
|
||||
* Returns the status of the response.
|
||||
*
|
||||
* @return the status
|
||||
*/
|
||||
HttpStatus getStatus();
|
||||
|
||||
/**
|
||||
* Returns the headers in the response.
|
||||
*
|
||||
* @return the headers
|
||||
*/
|
||||
HttpHeaders getHeaders();
|
||||
@@ -45,7 +43,6 @@ public interface OperationResponse {
|
||||
/**
|
||||
* Returns the content of the response. If the response has no content an empty array
|
||||
* is returned.
|
||||
*
|
||||
* @return the contents, never {@code null}
|
||||
*/
|
||||
byte[] getContent();
|
||||
@@ -55,7 +52,6 @@ public interface OperationResponse {
|
||||
* content an empty string is returned. If the response has a {@code Content-Type}
|
||||
* header that specifies a charset then that charset will be used when converting the
|
||||
* contents to a {@code String}.
|
||||
*
|
||||
* @return the contents as string, never {@code null}
|
||||
*/
|
||||
String getContentAsString();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -30,7 +30,6 @@ public class OperationResponseFactory {
|
||||
* Creates a new {@link OperationResponse}. If the response has any content, the given
|
||||
* {@code headers} will be augmented to ensure that they include a
|
||||
* {@code Content-Length} header.
|
||||
*
|
||||
* @param status the status of the response
|
||||
* @param headers the request's headers
|
||||
* @param content the content of the request
|
||||
@@ -47,11 +46,9 @@ public class OperationResponseFactory {
|
||||
* with the given {@code newContent}. If the original response had a
|
||||
* {@code Content-Length} header it will be modified to match the length of the new
|
||||
* content.
|
||||
*
|
||||
* @param original The original response
|
||||
* @param newContent The new content
|
||||
*
|
||||
* @return The new response with the new content
|
||||
* @param original the original response
|
||||
* @param newContent the new content
|
||||
* @return the new response with the new content
|
||||
*/
|
||||
public OperationResponse createFrom(OperationResponse original, byte[] newContent) {
|
||||
return new StandardOperationResponse(original.getStatus(),
|
||||
@@ -61,11 +58,9 @@ public class OperationResponseFactory {
|
||||
/**
|
||||
* Creates a new {@code OperationResponse} based on the given {@code original} but
|
||||
* with the given {@code newHeaders}.
|
||||
*
|
||||
* @param original The original response
|
||||
* @param newHeaders The new headers
|
||||
*
|
||||
* @return The new response with the new headers
|
||||
* @param original the original response
|
||||
* @param newHeaders the new headers
|
||||
* @return the new response with the new headers
|
||||
*/
|
||||
public OperationResponse createFrom(OperationResponse original,
|
||||
HttpHeaders newHeaders) {
|
||||
|
||||
@@ -36,7 +36,6 @@ public class Parameters extends LinkedMultiValueMap<String, String> {
|
||||
/**
|
||||
* Converts the parameters to a query string suitable for use in a URI or the body of
|
||||
* a form-encoded request.
|
||||
*
|
||||
* @return the query string
|
||||
*/
|
||||
public String toQueryString() {
|
||||
@@ -57,7 +56,6 @@ public class Parameters extends LinkedMultiValueMap<String, String> {
|
||||
/**
|
||||
* Returns a new {@code Parameters} containing only the parameters that do no appear
|
||||
* in the query string of the given {@code uri}.
|
||||
*
|
||||
* @param uri the uri
|
||||
* @return the unique parameters
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,6 @@ public class QueryStringParser {
|
||||
/**
|
||||
* Parses the query string of the given {@code uri} and returns the resulting
|
||||
* {@link Parameters}.
|
||||
*
|
||||
* @param uri the uri to parse
|
||||
* @return the parameters parsed from the query string
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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,7 @@ package org.springframework.restdocs.operation;
|
||||
* A {@code RequestConverter} is used to convert an implementation-specific request into
|
||||
* an {@link OperationRequest}.
|
||||
*
|
||||
* @param <R> The implementation-specific request type
|
||||
* @param <R> the implementation-specific request type
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@@ -28,7 +28,6 @@ public interface RequestConverter<R> {
|
||||
|
||||
/**
|
||||
* Converts the given {@code request} into an {@code OperationRequest}.
|
||||
*
|
||||
* @param request the request
|
||||
* @return the operation request
|
||||
* @throws ConversionException if the conversion fails
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -30,7 +30,6 @@ public final class RequestCookie {
|
||||
|
||||
/**
|
||||
* Creates a new {@code RequestCookie} with the given {@code name} and {@code value}.
|
||||
*
|
||||
* @param name the name of the cookie
|
||||
* @param value the value of the cookie
|
||||
*/
|
||||
@@ -41,7 +40,6 @@ public final class RequestCookie {
|
||||
|
||||
/**
|
||||
* Returns the name of the cookie.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
@@ -50,7 +48,6 @@ public final class RequestCookie {
|
||||
|
||||
/**
|
||||
* Returns the value of the cookie.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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,7 @@ package org.springframework.restdocs.operation;
|
||||
* A {@code ResponseConverter} is used to convert an implementation-specific response into
|
||||
* an {@link OperationResponse}.
|
||||
*
|
||||
* @param <R> The implementation-specific response type
|
||||
* @param <R> the implementation-specific response type
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@@ -28,7 +28,6 @@ public interface ResponseConverter<R> {
|
||||
|
||||
/**
|
||||
* Converts the given {@code response} into an {@code OperationResponse}.
|
||||
*
|
||||
* @param response the response
|
||||
* @return the operation response
|
||||
* @throws ConversionException if the conversion fails
|
||||
|
||||
@@ -35,7 +35,6 @@ public class StandardOperation implements Operation {
|
||||
|
||||
/**
|
||||
* Creates a new {@code StandardOperation}.
|
||||
*
|
||||
* @param name the name of the operation
|
||||
* @param request the request that was sent
|
||||
* @param response the response that was received
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -45,7 +45,6 @@ class StandardOperationRequest extends AbstractOperationMessage
|
||||
* Creates a new request with the given {@code uri} and {@code method}. The request
|
||||
* will have the given {@code headers}, {@code parameters}, {@code parts}, and
|
||||
* {@code cookies}.
|
||||
*
|
||||
* @param uri the uri
|
||||
* @param method the method
|
||||
* @param content the content
|
||||
|
||||
@@ -32,7 +32,6 @@ class StandardOperationRequestPart extends AbstractOperationMessage
|
||||
|
||||
/**
|
||||
* Creates a new {@code StandardOperationRequestPart} with the given {@code name}.
|
||||
*
|
||||
* @param name the name of the part
|
||||
* @param submittedFileName the name of the file being uploaded by this part
|
||||
* @param content the contents of the part
|
||||
|
||||
@@ -32,7 +32,6 @@ class StandardOperationResponse extends AbstractOperationMessage
|
||||
/**
|
||||
* Creates a new response with the given {@code status}, {@code headers}, and
|
||||
* {@code content}.
|
||||
*
|
||||
* @param status the status of the response
|
||||
* @param headers the headers of the response
|
||||
* @param content the content of the response
|
||||
|
||||
@@ -32,7 +32,6 @@ public interface ContentModifier {
|
||||
|
||||
/**
|
||||
* Returns modified content based on the given {@code originalContent}.
|
||||
*
|
||||
* @param originalContent the original content
|
||||
* @param contentType the type of the original content, may be {@code null}
|
||||
* @return the modified content
|
||||
|
||||
@@ -38,7 +38,6 @@ public class ContentModifyingOperationPreprocessor implements OperationPreproces
|
||||
/**
|
||||
* Create a new {@code ContentModifyingOperationPreprocessor} that will apply the
|
||||
* given {@code contentModifier} to the operation's request or response.
|
||||
*
|
||||
* @param contentModifier the contentModifier
|
||||
*/
|
||||
public ContentModifyingOperationPreprocessor(ContentModifier contentModifier) {
|
||||
|
||||
@@ -37,7 +37,6 @@ class DelegatingOperationRequestPreprocessor implements OperationRequestPreproce
|
||||
* Creates a new {@code DelegatingOperationRequestPreprocessor} that will delegate to
|
||||
* the given {@code delegates} by calling
|
||||
* {@link OperationPreprocessor#preprocess(OperationRequest)}.
|
||||
*
|
||||
* @param delegates the delegates
|
||||
*/
|
||||
DelegatingOperationRequestPreprocessor(List<OperationPreprocessor> delegates) {
|
||||
|
||||
@@ -36,7 +36,6 @@ class DelegatingOperationResponsePreprocessor implements OperationResponsePrepro
|
||||
* Creates a new {@code DelegatingOperationResponsePreprocessor} that will delegate to
|
||||
* the given {@code delegates} by calling
|
||||
* {@link OperationPreprocessor#preprocess(OperationResponse)}.
|
||||
*
|
||||
* @param delegates the delegates
|
||||
*/
|
||||
DelegatingOperationResponsePreprocessor(List<OperationPreprocessor> delegates) {
|
||||
|
||||
@@ -26,7 +26,6 @@ interface HeaderFilter {
|
||||
/**
|
||||
* Called to determine whether a header should be excluded. Return {@code true} to
|
||||
* exclude a header, otherwise {@code false}.
|
||||
*
|
||||
* @param name the name of the header
|
||||
* @return {@code true} to exclude the header, otherwise {@code false}
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,6 @@ public interface OperationPreprocessor {
|
||||
|
||||
/**
|
||||
* Processes the given {@code request}.
|
||||
*
|
||||
* @param request the request to process
|
||||
* @return the processed request
|
||||
*/
|
||||
@@ -38,7 +37,6 @@ public interface OperationPreprocessor {
|
||||
|
||||
/**
|
||||
* Processes the given {@code response}.
|
||||
*
|
||||
* @param response the response to process
|
||||
* @return the processed response
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,6 @@ public abstract class OperationPreprocessorAdapter implements OperationPreproces
|
||||
|
||||
/**
|
||||
* Returns the given {@code request} as-is.
|
||||
*
|
||||
* @param request the request
|
||||
* @return the unmodified request
|
||||
*/
|
||||
@@ -42,7 +41,6 @@ public abstract class OperationPreprocessorAdapter implements OperationPreproces
|
||||
|
||||
/**
|
||||
* Returns the given {@code response} as-is.
|
||||
*
|
||||
* @param response the response
|
||||
* @return the unmodified response
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,6 @@ public interface OperationRequestPreprocessor {
|
||||
/**
|
||||
* Processes and potentially modifies the given {@code request} before it is
|
||||
* documented.
|
||||
*
|
||||
* @param request the request
|
||||
* @return the modified request
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,6 @@ public interface OperationResponsePreprocessor {
|
||||
/**
|
||||
* Processes and potentially modifies the given {@code response} before it is
|
||||
* documented.
|
||||
*
|
||||
* @param response the response
|
||||
* @return the modified response
|
||||
*/
|
||||
|
||||
@@ -51,7 +51,6 @@ public final class ParametersModifyingOperationPreprocessor
|
||||
|
||||
/**
|
||||
* Adds a parameter with the given {@code name} and {@code value}.
|
||||
*
|
||||
* @param name the name
|
||||
* @param value the value
|
||||
* @return {@code this}
|
||||
@@ -63,7 +62,6 @@ public final class ParametersModifyingOperationPreprocessor
|
||||
|
||||
/**
|
||||
* Sets the parameter with the given {@code name} to have the given {@code values}.
|
||||
*
|
||||
* @param name the name
|
||||
* @param values the values
|
||||
* @return {@code this}
|
||||
@@ -76,7 +74,6 @@ public final class ParametersModifyingOperationPreprocessor
|
||||
|
||||
/**
|
||||
* Removes the parameter with the given {@code name}.
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -87,7 +84,6 @@ public final class ParametersModifyingOperationPreprocessor
|
||||
|
||||
/**
|
||||
* Removes the given {@code value} from the parameter with the given {@code name}.
|
||||
*
|
||||
* @param name the name
|
||||
* @param value the value
|
||||
* @return {@code this}
|
||||
|
||||
@@ -37,7 +37,6 @@ class PatternReplacingContentModifier implements ContentModifier {
|
||||
/**
|
||||
* Creates a new {@link PatternReplacingContentModifier} that will replace occurrences
|
||||
* of the given {@code pattern} with the given {@code replacement}.
|
||||
*
|
||||
* @param pattern the pattern
|
||||
* @param replacement the replacement
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,6 @@ public final class Preprocessors {
|
||||
/**
|
||||
* Returns an {@link OperationRequestPreprocessor} that will preprocess the request by
|
||||
* applying the given {@code preprocessors} to it.
|
||||
*
|
||||
* @param preprocessors the preprocessors
|
||||
* @return the request preprocessor
|
||||
*/
|
||||
@@ -53,7 +52,6 @@ public final class Preprocessors {
|
||||
/**
|
||||
* Returns an {@link OperationResponsePreprocessor} that will preprocess the response
|
||||
* by applying the given {@code preprocessors} to it.
|
||||
*
|
||||
* @param preprocessors the preprocessors
|
||||
* @return the response preprocessor
|
||||
*/
|
||||
@@ -65,7 +63,6 @@ public final class Preprocessors {
|
||||
/**
|
||||
* Returns an {@code OperationPreprocessor} that will pretty print the content of the
|
||||
* request or response.
|
||||
*
|
||||
* @return the preprocessor
|
||||
*/
|
||||
public static OperationPreprocessor prettyPrint() {
|
||||
@@ -77,7 +74,6 @@ public final class Preprocessors {
|
||||
* Returns an {@code OperationPreprocessor} that will remove any header from the
|
||||
* request or response with a name that is equal to one of the given
|
||||
* {@code headersToRemove}.
|
||||
*
|
||||
* @param headerNames the header names
|
||||
* @return the preprocessor
|
||||
* @see String#equals(Object)
|
||||
@@ -91,7 +87,6 @@ public final class Preprocessors {
|
||||
* Returns an {@code OperationPreprocessor} that will remove any headers from the
|
||||
* request or response with a name that matches one of the given
|
||||
* {@code headerNamePatterns} regular expressions.
|
||||
*
|
||||
* @param headerNamePatterns the header name patterns
|
||||
* @return the preprocessor
|
||||
* @see java.util.regex.Matcher#matches()
|
||||
@@ -105,7 +100,6 @@ public final class Preprocessors {
|
||||
/**
|
||||
* Returns an {@code OperationPreprocessor} that will mask the href of hypermedia
|
||||
* links in the request or response.
|
||||
*
|
||||
* @return the preprocessor
|
||||
*/
|
||||
public static OperationPreprocessor maskLinks() {
|
||||
@@ -116,7 +110,6 @@ public final class Preprocessors {
|
||||
/**
|
||||
* Returns an {@code OperationPreprocessor} that will mask the href of hypermedia
|
||||
* links in the request or response.
|
||||
*
|
||||
* @param mask the link mask
|
||||
* @return the preprocessor
|
||||
*/
|
||||
@@ -129,7 +122,6 @@ public final class Preprocessors {
|
||||
* Returns an {@code OperationPreprocessor} that will modify the content of the
|
||||
* request or response by replacing occurrences of the given {@code pattern} with the
|
||||
* given {@code replacement}.
|
||||
*
|
||||
* @param pattern the pattern
|
||||
* @param replacement the replacement
|
||||
* @return the preprocessor
|
||||
@@ -143,7 +135,6 @@ public final class Preprocessors {
|
||||
/**
|
||||
* Returns a {@code ParametersModifyingOperationPreprocessor} that can then be
|
||||
* configured to modify the parameters of the request.
|
||||
*
|
||||
* @return the preprocessor
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@@ -154,7 +145,6 @@ public final class Preprocessors {
|
||||
/**
|
||||
* Returns a {@code UriModifyingOperationPreprocessor} that will modify URIs in the
|
||||
* request or response by changing one or more of their host, scheme, and port.
|
||||
*
|
||||
* @return the preprocessor
|
||||
* @since 2.0.1
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,6 @@ public class UriModifyingOperationPreprocessor implements OperationPreprocessor
|
||||
/**
|
||||
* Modifies the URI to use the given {@code scheme}. {@code null}, the default, will
|
||||
* leave the scheme unchanged.
|
||||
*
|
||||
* @param scheme the scheme
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -82,7 +81,6 @@ public class UriModifyingOperationPreprocessor implements OperationPreprocessor
|
||||
/**
|
||||
* Modifies the URI to use the given {@code host}. {@code null}, the default, will
|
||||
* leave the host unchanged.
|
||||
*
|
||||
* @param host the host
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -94,7 +92,6 @@ public class UriModifyingOperationPreprocessor implements OperationPreprocessor
|
||||
|
||||
/**
|
||||
* Modifies the URI to use the given {@code port}.
|
||||
*
|
||||
* @param port the port
|
||||
* @return {@code this}
|
||||
*/
|
||||
@@ -104,7 +101,6 @@ public class UriModifyingOperationPreprocessor implements OperationPreprocessor
|
||||
|
||||
/**
|
||||
* Removes the port from the URI.
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public UriModifyingOperationPreprocessor removePort() {
|
||||
@@ -137,7 +133,7 @@ public class UriModifyingOperationPreprocessor implements OperationPreprocessor
|
||||
URI modifiedUri = uriBuilder.build(true).toUri();
|
||||
HttpHeaders modifiedHeaders = modify(request.getHeaders());
|
||||
modifiedHeaders.set(HttpHeaders.HOST, modifiedUri.getHost()
|
||||
+ (modifiedUri.getPort() == -1 ? "" : ":" + modifiedUri.getPort()));
|
||||
+ ((modifiedUri.getPort() != -1) ? ":" + modifiedUri.getPort() : ""));
|
||||
return this.contentModifyingDelegate.preprocess(new OperationRequestFactory()
|
||||
.create(uriBuilder.build(true).toUri(), request.getMethod(),
|
||||
request.getContent(), modifiedHeaders, request.getParameters(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -42,7 +42,6 @@ public abstract class AbstractBodySnippet extends TemplatedSnippet {
|
||||
* contain the subsection of the body extracted by the given
|
||||
* {@code subsectionExtractor}. The given {@code attributes} will be included in the
|
||||
* model during template rendering
|
||||
*
|
||||
* @param type the type of the body
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
@@ -59,7 +58,6 @@ public abstract class AbstractBodySnippet extends TemplatedSnippet {
|
||||
* contain the subsection of the body extracted by the given
|
||||
* {@code subsectionExtractor}. The given {@code attributes} will be included in the
|
||||
* model during template rendering
|
||||
*
|
||||
* @param name the name of the snippet
|
||||
* @param type the type of the body
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
@@ -69,7 +67,7 @@ public abstract class AbstractBodySnippet extends TemplatedSnippet {
|
||||
PayloadSubsectionExtractor<?> subsectionExtractor,
|
||||
Map<String, Object> attributes) {
|
||||
super(name + "-body"
|
||||
+ (subsectionExtractor != null
|
||||
+ ((subsectionExtractor != null)
|
||||
? "-" + subsectionExtractor.getSubsectionId() : ""),
|
||||
type + "-body", attributes);
|
||||
this.subsectionExtractor = subsectionExtractor;
|
||||
@@ -85,7 +83,7 @@ public abstract class AbstractBodySnippet extends TemplatedSnippet {
|
||||
contentType);
|
||||
}
|
||||
Charset charset = extractCharset(contentType);
|
||||
String body = charset != null ? new String(content, charset)
|
||||
String body = (charset != null) ? new String(content, charset)
|
||||
: new String(content);
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("body", body);
|
||||
@@ -106,9 +104,8 @@ public abstract class AbstractBodySnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Returns the content of the request or response extracted from the given
|
||||
* {@code operation}.
|
||||
*
|
||||
* @param operation The operation
|
||||
* @return The content
|
||||
* @param operation the operation
|
||||
* @return the content
|
||||
* @throws IOException if the content cannot be extracted
|
||||
*/
|
||||
protected abstract byte[] getContent(Operation operation) throws IOException;
|
||||
@@ -116,9 +113,8 @@ public abstract class AbstractBodySnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Returns the content type of the request or response extracted from the given
|
||||
* {@code operation}.
|
||||
*
|
||||
* @param operation The operation
|
||||
* @return The content type
|
||||
* @param operation the operation
|
||||
* @return the content type
|
||||
*/
|
||||
protected abstract MediaType getContentType(Operation operation);
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
* will be included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param type the type of the fields
|
||||
* @param descriptors the field descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -75,7 +74,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
* {@code attributes} will be included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param type the type of the fields
|
||||
* @param descriptors the field descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -97,7 +95,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
* will be included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param name the name of the snippet
|
||||
* @param type the type of the fields
|
||||
* @param descriptors the field descriptors
|
||||
@@ -118,7 +115,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
* will be included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param name the name of the snippet
|
||||
* @param type the type of the fields
|
||||
* @param descriptors the field descriptors
|
||||
@@ -133,7 +129,7 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
boolean ignoreUndocumentedFields,
|
||||
PayloadSubsectionExtractor<?> subsectionExtractor) {
|
||||
super(name + "-fields"
|
||||
+ (subsectionExtractor != null
|
||||
+ ((subsectionExtractor != null)
|
||||
? "-" + subsectionExtractor.getSubsectionId() : ""),
|
||||
type + "-fields", attributes);
|
||||
for (FieldDescriptor descriptor : descriptors) {
|
||||
@@ -265,18 +261,16 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Returns the content type of the request or response extracted from the given
|
||||
* {@code operation}.
|
||||
*
|
||||
* @param operation The operation
|
||||
* @return The content type
|
||||
* @param operation the operation
|
||||
* @return the content type
|
||||
*/
|
||||
protected abstract MediaType getContentType(Operation operation);
|
||||
|
||||
/**
|
||||
* Returns the content of the request or response extracted form the given
|
||||
* {@code operation}.
|
||||
*
|
||||
* @param operation The operation
|
||||
* @return The content
|
||||
* @param operation the operation
|
||||
* @return the content
|
||||
* @throws IOException if the content cannot be extracted
|
||||
*/
|
||||
protected abstract byte[] getContent(Operation operation) throws IOException;
|
||||
@@ -284,7 +278,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Returns the list of {@link FieldDescriptor FieldDescriptors} that will be used to
|
||||
* generate the documentation.
|
||||
*
|
||||
* @return the field descriptors
|
||||
*/
|
||||
protected final List<FieldDescriptor> getFieldDescriptors() {
|
||||
@@ -293,7 +286,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
|
||||
/**
|
||||
* Returns whether or not this snippet ignores undocumented fields.
|
||||
*
|
||||
* @return {@code true} if undocumented fields are ignored, otherwise {@code false}
|
||||
*/
|
||||
protected final boolean isIgnoredUndocumentedFields() {
|
||||
@@ -302,7 +294,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
|
||||
/**
|
||||
* Returns the {@link PayloadSubsectionExtractor}, if any, used by this snippet.
|
||||
*
|
||||
* @return the subsection extractor or {@code null}
|
||||
* @since 1.2.4
|
||||
*/
|
||||
@@ -312,7 +303,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
|
||||
/**
|
||||
* Returns a model for the given {@code descriptor}.
|
||||
*
|
||||
* @param descriptor the descriptor
|
||||
* @return the model
|
||||
*/
|
||||
@@ -327,7 +317,7 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
}
|
||||
|
||||
private FieldDescriptor copyWithType(FieldDescriptor source, Object type) {
|
||||
FieldDescriptor result = source instanceof SubsectionDescriptor
|
||||
FieldDescriptor result = (source instanceof SubsectionDescriptor)
|
||||
? new SubsectionDescriptor(source.getPath())
|
||||
: new FieldDescriptor(source.getPath());
|
||||
result.description(source.getDescription()).type(type)
|
||||
|
||||
@@ -29,7 +29,6 @@ interface ContentHandler {
|
||||
* Finds the fields that are missing from the handler's payload. A field is missing if
|
||||
* it is described by one of the {@code fieldDescriptors} but is not present in the
|
||||
* payload.
|
||||
*
|
||||
* @param fieldDescriptors the descriptors
|
||||
* @return descriptors for the fields that are missing from the payload
|
||||
* @throws PayloadHandlingException if a failure occurs
|
||||
@@ -41,7 +40,6 @@ interface ContentHandler {
|
||||
* are undocumented. A field is undocumented if it is present in the handler's content
|
||||
* but is not described by the given {@code fieldDescriptors}. If the content is
|
||||
* completely documented, {@code null} is returned
|
||||
*
|
||||
* @param fieldDescriptors the descriptors
|
||||
* @return the undocumented content, or {@code null} if all of the content is
|
||||
* documented
|
||||
@@ -52,7 +50,6 @@ interface ContentHandler {
|
||||
/**
|
||||
* Returns the type of the field that is described by the given
|
||||
* {@code fieldDescriptor} based on the content of the payload.
|
||||
*
|
||||
* @param fieldDescriptor the field descriptor
|
||||
* @return the type of the field
|
||||
*/
|
||||
|
||||
@@ -45,8 +45,7 @@ public class FieldDescriptor extends IgnorableDescriptor<FieldDescriptor> {
|
||||
/**
|
||||
* Specifies the type of the field. When documenting a JSON payload, the
|
||||
* {@link JsonFieldType} enumeration will typically be used.
|
||||
*
|
||||
* @param type The type of the field
|
||||
* @param type the type of the field
|
||||
* @return {@code this}
|
||||
* @see JsonFieldType
|
||||
*/
|
||||
@@ -57,7 +56,6 @@ public class FieldDescriptor extends IgnorableDescriptor<FieldDescriptor> {
|
||||
|
||||
/**
|
||||
* Marks the field as optional.
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public final FieldDescriptor optional() {
|
||||
@@ -67,7 +65,6 @@ public class FieldDescriptor extends IgnorableDescriptor<FieldDescriptor> {
|
||||
|
||||
/**
|
||||
* Returns the path of the field described by this descriptor.
|
||||
*
|
||||
* @return the path
|
||||
*/
|
||||
public final String getPath() {
|
||||
@@ -76,7 +73,6 @@ public class FieldDescriptor extends IgnorableDescriptor<FieldDescriptor> {
|
||||
|
||||
/**
|
||||
* Returns the type of the field described by this descriptor.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
public final Object getType() {
|
||||
@@ -85,7 +81,6 @@ public class FieldDescriptor extends IgnorableDescriptor<FieldDescriptor> {
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the described field is optional, otherwise {@code false}.
|
||||
*
|
||||
* @return {@code true} if the described field is optional, otherwise {@code false}
|
||||
*/
|
||||
public final boolean isOptional() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -28,7 +28,6 @@ public class FieldDoesNotExistException extends RuntimeException {
|
||||
/**
|
||||
* Creates a new {@code FieldDoesNotExistException} that indicates that the field with
|
||||
* the given {@code fieldPath} does not exist.
|
||||
*
|
||||
* @param fieldPath the path of the field that does not exist
|
||||
*/
|
||||
public FieldDoesNotExistException(String fieldPath) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -46,7 +46,6 @@ public class FieldPathPayloadSubsectionExtractor
|
||||
* Creates a new {@code FieldPathPayloadSubsectionExtractor} that will extract the
|
||||
* subsection of the JSON payload found at the given {@code fieldPath}. The
|
||||
* {@code fieldPath} prefixed with {@code beneath-} with be used as the subsection ID.
|
||||
*
|
||||
* @param fieldPath the path of the field
|
||||
*/
|
||||
protected FieldPathPayloadSubsectionExtractor(String fieldPath) {
|
||||
@@ -57,7 +56,6 @@ public class FieldPathPayloadSubsectionExtractor
|
||||
* Creates a new {@code FieldPathPayloadSubsectionExtractor} that will extract the
|
||||
* subsection of the JSON payload found at the given {@code fieldPath} and that will
|
||||
* us the given {@code subsectionId} to identify the subsection.
|
||||
*
|
||||
* @param fieldPath the path of the field
|
||||
* @param subsectionId the ID of the subsection
|
||||
*/
|
||||
@@ -96,7 +94,6 @@ public class FieldPathPayloadSubsectionExtractor
|
||||
|
||||
/**
|
||||
* Returns the path of the field that will be extracted.
|
||||
*
|
||||
* @return the path of the field
|
||||
*/
|
||||
protected String getFieldPath() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -28,7 +28,6 @@ public class FieldTypeRequiredException extends RuntimeException {
|
||||
/**
|
||||
* Creates a new {@code FieldTypeRequiredException} indicating that a type is required
|
||||
* for the reason described in the given {@code message}.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
public FieldTypeRequiredException(String message) {
|
||||
|
||||
@@ -27,7 +27,6 @@ class FieldTypesDoNotMatchException extends RuntimeException {
|
||||
/**
|
||||
* Creates a new {@code FieldTypesDoNotMatchException} for the field described by the
|
||||
* given {@code fieldDescriptor} that has the given {@code actualType}.
|
||||
*
|
||||
* @param fieldDescriptor the field
|
||||
* @param actualType the actual type of the field
|
||||
*/
|
||||
|
||||
@@ -54,7 +54,7 @@ final class JsonFieldProcessor {
|
||||
throw new FieldDoesNotExistException(path);
|
||||
}
|
||||
return new ExtractedField(
|
||||
compiledPath.getType() == PathType.SINGLE ? matches.get(0) : matches,
|
||||
(compiledPath.getType() != PathType.SINGLE) ? matches : matches.get(0),
|
||||
compiledPath.getType());
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ final class JsonFieldProcessor {
|
||||
@Override
|
||||
public void foundMatch(Match match) {
|
||||
this.matchType = this.matchType.combinedWith(
|
||||
match.getValue() == null ? MatchType.NULL : MatchType.NON_NULL);
|
||||
(match.getValue() != null) ? MatchType.NON_NULL : MatchType.NULL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -394,7 +394,7 @@ final class JsonFieldProcessor {
|
||||
List<String> segments, Match parent) {
|
||||
this.payload = payload;
|
||||
this.path = path;
|
||||
this.segments = segments == null ? path.getSegments() : segments;
|
||||
this.segments = (segments != null) ? segments : path.getSegments();
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -94,8 +94,7 @@ public abstract class PayloadDocumentation {
|
||||
* <td>The string "three"</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* @param path The path of the field
|
||||
* @param path the path of the field
|
||||
* @return a {@code FieldDescriptor} ready for further configuration
|
||||
*/
|
||||
public static FieldDescriptor fieldWithPath(String path) {
|
||||
@@ -162,8 +161,7 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* A subsection descriptor for the array with the path {@code a.b[]} will also
|
||||
* describe its descendants {@code a.b[].c} and {@code a.b[].d}.
|
||||
*
|
||||
* @param path The path of the subsection
|
||||
* @param path the path of the subsection
|
||||
* @return a {@code SubsectionDescriptor} ready for further configuration
|
||||
*/
|
||||
public static SubsectionDescriptor subsectionWithPath(String path) {
|
||||
@@ -185,7 +183,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
* @see #fieldWithPath(String)
|
||||
@@ -211,7 +208,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
* @see #fieldWithPath(String)
|
||||
@@ -227,7 +223,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
* @see #fieldWithPath(String)
|
||||
@@ -244,7 +239,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
* @see #fieldWithPath(String)
|
||||
@@ -271,7 +265,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -299,7 +292,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -318,7 +310,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -337,7 +328,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -366,7 +356,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -398,7 +387,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -420,7 +408,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -442,7 +429,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -475,7 +461,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
@@ -509,7 +494,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
@@ -533,7 +517,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
@@ -558,7 +541,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request payload's fields
|
||||
@@ -592,7 +574,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -622,7 +603,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -641,7 +621,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -660,7 +639,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -690,7 +668,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
@@ -721,7 +698,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
@@ -742,7 +718,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
@@ -763,7 +738,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
@@ -794,7 +768,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the subsection's fields
|
||||
@@ -828,7 +801,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the subsection's fields
|
||||
@@ -852,7 +824,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
@@ -877,7 +848,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the request part's fields
|
||||
@@ -912,7 +882,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
@@ -949,7 +918,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
@@ -976,7 +944,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
@@ -1003,7 +970,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param part the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
@@ -1037,7 +1003,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
* @see #fieldWithPath(String)
|
||||
@@ -1063,7 +1028,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
* @since 1.2.0
|
||||
@@ -1083,7 +1047,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
* @since 1.2.0
|
||||
@@ -1103,7 +1066,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
* @see #fieldWithPath(String)
|
||||
@@ -1130,7 +1092,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -1158,7 +1119,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -1177,7 +1137,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -1196,7 +1155,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -1226,7 +1184,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -1259,7 +1216,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -1282,7 +1238,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -1305,7 +1260,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
* @return the snippet that will document the fields
|
||||
@@ -1339,7 +1293,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
@@ -1375,7 +1328,6 @@ public abstract class PayloadDocumentation {
|
||||
* {@link FieldDescriptor#ignored configured to ignore it}. The ignored field or
|
||||
* subsection will not appear in the generated snippet and the failure described above
|
||||
* will not occur.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
@@ -1400,7 +1352,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
@@ -1426,7 +1377,6 @@ public abstract class PayloadDocumentation {
|
||||
* <p>
|
||||
* If a field is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented fields will be ignored.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the response payload's fields
|
||||
@@ -1446,7 +1396,6 @@ public abstract class PayloadDocumentation {
|
||||
/**
|
||||
* Returns a {@code Snippet} that will document the body of the API operation's
|
||||
* request payload.
|
||||
*
|
||||
* @return the snippet that will document the request body
|
||||
*/
|
||||
public static RequestBodySnippet requestBody() {
|
||||
@@ -1457,7 +1406,6 @@ public abstract class PayloadDocumentation {
|
||||
* Returns a {@code Snippet} that will document the body of the API operation's
|
||||
* request payload. The given attributes will be made available during snippet
|
||||
* generation.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the request body
|
||||
*/
|
||||
@@ -1469,7 +1417,6 @@ public abstract class PayloadDocumentation {
|
||||
* Returns a {@code Snippet} that will document a subsection of the body of the API
|
||||
* operation's request payload. The subsection will be extracted using the given
|
||||
* {@code subsectionExtractor}.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @return the snippet that will document the request body subsection
|
||||
*/
|
||||
@@ -1483,7 +1430,6 @@ public abstract class PayloadDocumentation {
|
||||
* operation's request payload. The subsection will be extracted using the given
|
||||
* {@code subsectionExtractor}. The given attributes will be made available during
|
||||
* snippet generation.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the request body subsection
|
||||
@@ -1497,7 +1443,6 @@ public abstract class PayloadDocumentation {
|
||||
/**
|
||||
* Returns a {@code Snippet} that will document the body of the API operation's
|
||||
* response payload.
|
||||
*
|
||||
* @return the snippet that will document the response body
|
||||
*/
|
||||
public static ResponseBodySnippet responseBody() {
|
||||
@@ -1508,7 +1453,6 @@ public abstract class PayloadDocumentation {
|
||||
* Returns a {@code Snippet} that will document the body of the API operation's
|
||||
* response payload. The given attributes will be made available during snippet
|
||||
* generation.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the response body
|
||||
*/
|
||||
@@ -1520,7 +1464,6 @@ public abstract class PayloadDocumentation {
|
||||
* Returns a {@code Snippet} that will document a subsection of the body of the API
|
||||
* operation's response payload. The subsection will be extracted using the given
|
||||
* {@code subsectionExtractor}.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @return the snippet that will document the response body subsection
|
||||
*/
|
||||
@@ -1534,7 +1477,6 @@ public abstract class PayloadDocumentation {
|
||||
* operation's response payload. The subsection will be extracted using the given
|
||||
* {@code subsectionExtractor}. The given attributes will be made available during
|
||||
* snippet generation.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the response body subsection
|
||||
@@ -1548,7 +1490,6 @@ public abstract class PayloadDocumentation {
|
||||
/**
|
||||
* Returns a {@code Snippet} that will document the body of specified part of the API
|
||||
* operation's request payload.
|
||||
*
|
||||
* @param partName the name of the request part
|
||||
* @return the snippet that will document the response body
|
||||
*/
|
||||
@@ -1560,7 +1501,6 @@ public abstract class PayloadDocumentation {
|
||||
* Returns a {@code Snippet} that will document the body of specified part of the API
|
||||
* operation's request payload. The given attributes will be made available during
|
||||
* snippet generation.
|
||||
*
|
||||
* @param partName the name of the request part
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the response body
|
||||
@@ -1574,7 +1514,6 @@ public abstract class PayloadDocumentation {
|
||||
* Returns a {@code Snippet} that will document a subsection of the body of specified
|
||||
* part of the API operation's request payload. The subsection will be extracted using
|
||||
* the given {@code subsectionExtractor}.
|
||||
*
|
||||
* @param partName the name of the request part
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @return the snippet that will document the response body
|
||||
@@ -1589,7 +1528,6 @@ public abstract class PayloadDocumentation {
|
||||
* part of the API operation's request payload. The subsection will be extracted using
|
||||
* the given {@code subsectionExtractor}. The given attributes will be made available
|
||||
* during snippet generation.
|
||||
*
|
||||
* @param partName the name of the request part
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes the attributes
|
||||
@@ -1604,7 +1542,6 @@ public abstract class PayloadDocumentation {
|
||||
/**
|
||||
* Creates a copy of the given {@code descriptors} with the given {@code pathPrefix}
|
||||
* applied to their paths.
|
||||
*
|
||||
* @param pathPrefix the path prefix
|
||||
* @param descriptors the descriptors to copy
|
||||
* @return the copied descriptors with the prefix applied
|
||||
@@ -1614,7 +1551,7 @@ public abstract class PayloadDocumentation {
|
||||
List<FieldDescriptor> prefixedDescriptors = new ArrayList<>();
|
||||
for (FieldDescriptor descriptor : descriptors) {
|
||||
String prefixedPath = pathPrefix + descriptor.getPath();
|
||||
FieldDescriptor prefixedDescriptor = descriptor instanceof SubsectionDescriptor
|
||||
FieldDescriptor prefixedDescriptor = (descriptor instanceof SubsectionDescriptor)
|
||||
? new SubsectionDescriptor(prefixedPath)
|
||||
: new FieldDescriptor(prefixedPath);
|
||||
prefixedDescriptor.description(descriptor.getDescription())
|
||||
@@ -1634,7 +1571,6 @@ public abstract class PayloadDocumentation {
|
||||
/**
|
||||
* Returns a {@link PayloadSubsectionExtractor} that will extract the subsection of
|
||||
* the JSON payload found beneath the given {@code path}.
|
||||
*
|
||||
* @param path the path
|
||||
* @return the subsection extractor
|
||||
* @since 1.2.0
|
||||
|
||||
@@ -27,7 +27,6 @@ class PayloadHandlingException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Creates a new {@code PayloadHandlingException} with the given {@code message}.
|
||||
*
|
||||
* @param message the message
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -37,7 +36,6 @@ class PayloadHandlingException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Creates a new {@code PayloadHandlingException} with the given {@code cause}.
|
||||
*
|
||||
* @param cause the cause of the failure
|
||||
*/
|
||||
PayloadHandlingException(Throwable cause) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -21,7 +21,7 @@ import org.springframework.http.MediaType;
|
||||
/**
|
||||
* Strategy interface for extracting a subsection of a payload.
|
||||
*
|
||||
* @param <T> The subsection extractor subclass
|
||||
* @param <T> the subsection extractor subclass
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@@ -30,7 +30,6 @@ public interface PayloadSubsectionExtractor<T extends PayloadSubsectionExtractor
|
||||
/**
|
||||
* Extracts a subsection of the given {@code payload} that has the given
|
||||
* {@code contentType}.
|
||||
*
|
||||
* @param payload the payload
|
||||
* @param contentType the content type of the payload
|
||||
* @return the subsection of the payload
|
||||
@@ -39,14 +38,12 @@ public interface PayloadSubsectionExtractor<T extends PayloadSubsectionExtractor
|
||||
|
||||
/**
|
||||
* Returns an identifier for the subsection that this extractor will extract.
|
||||
*
|
||||
* @return the identifier
|
||||
*/
|
||||
String getSubsectionId();
|
||||
|
||||
/**
|
||||
* Returns an extractor with the given {@code subsectionId}.
|
||||
*
|
||||
* @param subsectionId the subsection ID
|
||||
* @return the customized extractor
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -40,7 +40,6 @@ public class RequestBodySnippet extends AbstractBodySnippet {
|
||||
/**
|
||||
* Creates a new {@code RequestBodySnippet} that will document the subsection of the
|
||||
* request body extracted by the given {@code subsectionExtractor}.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
*/
|
||||
public RequestBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor) {
|
||||
@@ -50,8 +49,7 @@ public class RequestBodySnippet extends AbstractBodySnippet {
|
||||
/**
|
||||
* Creates a new {@code RequestBodySnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
*
|
||||
* @param attributes The additional attributes
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
public RequestBodySnippet(Map<String, Object> attributes) {
|
||||
this(null, attributes);
|
||||
@@ -62,9 +60,8 @@ public class RequestBodySnippet extends AbstractBodySnippet {
|
||||
* request body extracted by the given {@code subsectionExtractor}. The given
|
||||
* additional {@code attributes} that will be included in the model during template
|
||||
* rendering.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes The additional attributes
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
public RequestBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor,
|
||||
Map<String, Object> attributes) {
|
||||
|
||||
@@ -39,7 +39,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Creates a new {@code RequestFieldsSnippet} that will document the fields in the
|
||||
* request using the given {@code descriptors}. Undocumented fields will trigger a
|
||||
* failure.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
*/
|
||||
protected RequestFieldsSnippet(List<FieldDescriptor> descriptors) {
|
||||
@@ -50,7 +49,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Creates a new {@code RequestFieldsSnippet} that will document the fields in the
|
||||
* request using the given {@code descriptors}. If {@code ignoreUndocumentedFields} is
|
||||
* {@code true}, undocumented fields will be ignored and will not trigger a failure.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
* @param ignoreUndocumentedFields whether undocumented fields should be ignored
|
||||
*/
|
||||
@@ -64,7 +62,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* request using the given {@code descriptors}. The given {@code attributes} will be
|
||||
* included in the model during template rendering. Undocumented fields will trigger a
|
||||
* failure.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
@@ -79,7 +76,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
* @param ignoreUndocumentedFields whether undocumented fields should be ignored
|
||||
@@ -93,7 +89,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Creates a new {@code RequestFieldsSnippet} that will document the fields in the
|
||||
* subsection of the request extracted by the given {@code subsectionExtractor} using
|
||||
* the given {@code descriptors}. Undocumented fields will trigger a failure.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
* @since 1.2.0
|
||||
@@ -108,7 +103,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* subsection of the request extracted by the given {@code subsectionExtractor} using
|
||||
* the given {@code descriptors}. If {@code ignoreUndocumentedFields} is {@code true},
|
||||
* undocumented fields will be ignored and will not trigger a failure.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor document
|
||||
* @param descriptors the descriptors
|
||||
* @param ignoreUndocumentedFields whether undocumented fields should be ignored
|
||||
@@ -124,7 +118,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* subsection of the request extracted by the given {@code subsectionExtractor} using
|
||||
* the given {@code descriptors}. The given {@code attributes} will be included in the
|
||||
* model during template rendering. Undocumented fields will trigger a failure.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -141,7 +134,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* the given {@code descriptors}. The given {@code attributes} will be included in the
|
||||
* model during template rendering. If {@code ignoreUndocumentedFields} is
|
||||
* {@code true}, undocumented fields will be ignored and will not trigger a failure.
|
||||
*
|
||||
* @param subsectionExtractor the path identifying the subsection of the payload to
|
||||
* document
|
||||
* @param descriptors the descriptors
|
||||
@@ -170,7 +162,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Returns a new {@code RequestFieldsSnippet} configured with this snippet's
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}.
|
||||
*
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
*/
|
||||
@@ -182,7 +173,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Returns a new {@code RequestFieldsSnippet} configured with this snippet's
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}.
|
||||
*
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
*/
|
||||
@@ -195,7 +185,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}. The given {@code pathPrefix} is applied to the path
|
||||
* of each additional descriptor.
|
||||
*
|
||||
* @param pathPrefix the prefix to apply to the additional descriptors
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
@@ -215,7 +204,6 @@ public class RequestFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}. The given {@code pathPrefix} is applied to the path
|
||||
* of each additional descriptor.
|
||||
*
|
||||
* @param pathPrefix the prefix to apply to the additional descriptors
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -37,7 +37,6 @@ public class RequestPartBodySnippet extends AbstractBodySnippet {
|
||||
/**
|
||||
* Creates a new {@code RequestPartBodySnippet} that will document the body of the
|
||||
* request part with the given {@code partName}.
|
||||
*
|
||||
* @param partName the name of the request part
|
||||
*/
|
||||
public RequestPartBodySnippet(String partName) {
|
||||
@@ -48,7 +47,6 @@ public class RequestPartBodySnippet extends AbstractBodySnippet {
|
||||
* Creates a new {@code RequestPartBodySnippet} that will document the subsection of
|
||||
* the body of the request part with the given {@code partName} extracted by the given
|
||||
* {@code subsectionExtractor}.
|
||||
*
|
||||
* @param partName the name of the request part
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
*/
|
||||
@@ -61,7 +59,6 @@ public class RequestPartBodySnippet extends AbstractBodySnippet {
|
||||
* Creates a new {@code RequestPartBodySnippet} that will document the body of the
|
||||
* request part with the given {@code partName}. The given additional
|
||||
* {@code attributes} will be included in the model during template rendering.
|
||||
*
|
||||
* @param partName the name of the request part
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
@@ -75,10 +72,9 @@ public class RequestPartBodySnippet extends AbstractBodySnippet {
|
||||
* by the given {@code subsectionExtractor} will be documented and the given
|
||||
* additional {@code attributes} that will be included in the model during template
|
||||
* rendering.
|
||||
*
|
||||
* @param partName the name of the request part
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes The additional attributes
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
public RequestPartBodySnippet(String partName,
|
||||
PayloadSubsectionExtractor<?> subsectionExtractor,
|
||||
|
||||
@@ -45,7 +45,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Creates a new {@code RequestPartFieldsSnippet} that will document the fields in the
|
||||
* request part using the given {@code descriptors}. Undocumented fields will trigger
|
||||
* a failure.
|
||||
*
|
||||
* @param partName the part name
|
||||
* @param descriptors the descriptors
|
||||
*/
|
||||
@@ -59,7 +58,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* request part using the given {@code descriptors}. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param partName the part name
|
||||
* @param descriptors the descriptors
|
||||
* @param ignoreUndocumentedFields whether undocumented fields should be ignored
|
||||
@@ -74,7 +72,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* request using the given {@code descriptors}. The given {@code attributes} will be
|
||||
* included in the model during template rendering. Undocumented fields will trigger a
|
||||
* failure.
|
||||
*
|
||||
* @param partName the part name
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -90,7 +87,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param partName the part name
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -106,7 +102,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* subsection of the request part using the given {@code descriptors}. The subsection
|
||||
* will be extracted using the given {@code subsectionExtractor}. Undocumented fields
|
||||
* will trigger a failure.
|
||||
*
|
||||
* @param partName the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
@@ -123,7 +118,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* will be extracted using the given {@code subsectionExtractor}. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param partName the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
@@ -141,7 +135,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* will be extracted using the given {@code subsectionExtractor}. The given
|
||||
* {@code attributes} will be included in the model during template rendering.
|
||||
* Undocumented fields will trigger a failure.
|
||||
*
|
||||
* @param partName the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
@@ -160,7 +153,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* {@code attributes} will be included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param partName the part name
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
@@ -200,7 +192,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Returns a new {@code RequestPartFieldsSnippet} configured with this snippet's
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}.
|
||||
*
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
*/
|
||||
@@ -212,7 +203,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Returns a new {@code RequestPartFieldsSnippet} configured with this snippet's
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}.
|
||||
*
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
*/
|
||||
@@ -226,7 +216,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}. The given {@code pathPrefix} is applied to the path
|
||||
* of each additional descriptor.
|
||||
*
|
||||
* @param pathPrefix the prefix to apply to the additional descriptors
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
@@ -246,7 +235,6 @@ public class RequestPartFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}. The given {@code pathPrefix} is applied to the path
|
||||
* of each additional descriptor.
|
||||
*
|
||||
* @param pathPrefix the prefix to apply to the additional descriptors
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -40,7 +40,6 @@ public class ResponseBodySnippet extends AbstractBodySnippet {
|
||||
/**
|
||||
* Creates a new {@code ResponseBodySnippet} that will document the subsection of the
|
||||
* response body extracted by the given {@code subsectionExtractor}.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
*/
|
||||
public ResponseBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor) {
|
||||
@@ -50,8 +49,7 @@ public class ResponseBodySnippet extends AbstractBodySnippet {
|
||||
/**
|
||||
* Creates a new {@code ResponseBodySnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
*
|
||||
* @param attributes The additional attributes
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
public ResponseBodySnippet(Map<String, Object> attributes) {
|
||||
this(null, attributes);
|
||||
@@ -62,9 +60,8 @@ public class ResponseBodySnippet extends AbstractBodySnippet {
|
||||
* response body extracted by the given {@code subsectionExtractor}. The given
|
||||
* additional {@code attributes} that will be included in the model during template
|
||||
* rendering.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param attributes The additional attributes
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
public ResponseBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor,
|
||||
Map<String, Object> attributes) {
|
||||
|
||||
@@ -39,7 +39,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Creates a new {@code ResponseFieldsSnippet} that will document the fields in the
|
||||
* response using the given {@code descriptors}. Undocumented fields will trigger a
|
||||
* failure.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
*/
|
||||
protected ResponseFieldsSnippet(List<FieldDescriptor> descriptors) {
|
||||
@@ -51,7 +50,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* response using the given {@code descriptors}. If {@code ignoreUndocumentedFields}
|
||||
* is {@code true}, undocumented fields will be ignored and will not trigger a
|
||||
* failure.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
* @param ignoreUndocumentedFields whether undocumented fields should be ignored
|
||||
*/
|
||||
@@ -65,7 +63,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* response using the given {@code descriptors}. The given {@code attributes} will be
|
||||
* included in the model during template rendering. Undocumented fields will trigger a
|
||||
* failure.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
@@ -80,7 +77,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
* @param ignoreUndocumentedFields whether undocumented fields should be ignored
|
||||
@@ -95,7 +91,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* subsection of the response using the given {@code descriptors}. The subsection will
|
||||
* be extracted using the given {@code subsectionExtractor}. Undocumented fields will
|
||||
* trigger a failure.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
* @since 1.2.0
|
||||
@@ -111,7 +106,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* be extracted using the given {@code subsectionExtractor}. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
* @param ignoreUndocumentedFields whether undocumented fields should be ignored
|
||||
@@ -128,7 +122,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* be extracted using the given {@code subsectionExtractor}. The given
|
||||
* {@code attributes} will be included in the model during template rendering.
|
||||
* Undocumented fields will trigger a failure.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -146,7 +139,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* {@code attributes} will be included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedFields} is {@code true}, undocumented fields will be
|
||||
* ignored and will not trigger a failure.
|
||||
*
|
||||
* @param subsectionExtractor the subsection extractor
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
@@ -174,7 +166,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Returns a new {@code ResponseFieldsSnippet} configured with this snippet's
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}.
|
||||
*
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
*/
|
||||
@@ -186,7 +177,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* Returns a new {@code ResponseFieldsSnippet} configured with this snippet's
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}.
|
||||
*
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
*/
|
||||
@@ -199,7 +189,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}. The given {@code pathPrefix} is applied to the path
|
||||
* of each additional descriptor.
|
||||
*
|
||||
* @param pathPrefix the prefix to apply to the additional descriptors
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
@@ -219,7 +208,6 @@ public class ResponseFieldsSnippet extends AbstractFieldsSnippet {
|
||||
* attributes and its descriptors combined with the given
|
||||
* {@code additionalDescriptors}. The given {@code pathPrefix} is applied to the path
|
||||
* of each additional descriptor.
|
||||
*
|
||||
* @param pathPrefix the prefix to apply to the additional descriptors
|
||||
* @param additionalDescriptors the additional descriptors
|
||||
* @return the new snippet
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -49,10 +49,9 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
|
||||
* {@code descriptors}. The given {@code attributes} will be included in the model
|
||||
* during template rendering. If {@code ignoreUndocumentedParameters} is {@code true},
|
||||
* undocumented parameters will be ignored and will not trigger a failure.
|
||||
*
|
||||
* @param snippetName The snippet name
|
||||
* @param descriptors The descriptors
|
||||
* @param attributes The additional attributes
|
||||
* @param snippetName the snippet name
|
||||
* @param descriptors the descriptors
|
||||
* @param attributes the additional attributes
|
||||
* @param ignoreUndocumentedParameters whether undocumented parameters should be
|
||||
* ignored
|
||||
*/
|
||||
@@ -119,7 +118,6 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
|
||||
/**
|
||||
* Extracts the names of the parameters that were present in the given
|
||||
* {@code operation}.
|
||||
*
|
||||
* @param operation the operation
|
||||
* @return the parameters
|
||||
*/
|
||||
@@ -127,7 +125,6 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
|
||||
|
||||
/**
|
||||
* Called when the documented parameters do not match the actual parameters.
|
||||
*
|
||||
* @param undocumentedParameters the parameters that were found in the operation but
|
||||
* were not documented
|
||||
* @param missingParameters the parameters that were documented but were not found in
|
||||
@@ -140,7 +137,18 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
|
||||
* Returns a {@code Map} of {@link ParameterDescriptor ParameterDescriptors} that will
|
||||
* be used to generate the documentation key by their
|
||||
* {@link ParameterDescriptor#getName()}.
|
||||
*
|
||||
* @return the map of path descriptors
|
||||
* @deprecated since 1.1.0 in favor of {@link #getParameterDescriptors()}
|
||||
*/
|
||||
@Deprecated
|
||||
protected final Map<String, ParameterDescriptor> getFieldDescriptors() {
|
||||
return this.descriptorsByName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code Map} of {@link ParameterDescriptor ParameterDescriptors} that will
|
||||
* be used to generate the documentation key by their
|
||||
* {@link ParameterDescriptor#getName()}.
|
||||
* @return the map of path descriptors
|
||||
*/
|
||||
protected final Map<String, ParameterDescriptor> getParameterDescriptors() {
|
||||
@@ -149,7 +157,6 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
|
||||
|
||||
/**
|
||||
* Returns a model for the given {@code descriptor}.
|
||||
*
|
||||
* @param descriptor the descriptor
|
||||
* @return the model
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,6 @@ public class ParameterDescriptor extends IgnorableDescriptor<ParameterDescriptor
|
||||
/**
|
||||
* Creates a new {@code ParameterDescriptor} describing the parameter with the given
|
||||
* {@code name}.
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
*/
|
||||
protected ParameterDescriptor(String name) {
|
||||
@@ -43,7 +42,6 @@ public class ParameterDescriptor extends IgnorableDescriptor<ParameterDescriptor
|
||||
|
||||
/**
|
||||
* Marks the parameter as optional.
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public final ParameterDescriptor optional() {
|
||||
@@ -53,7 +51,6 @@ public class ParameterDescriptor extends IgnorableDescriptor<ParameterDescriptor
|
||||
|
||||
/**
|
||||
* Returns the name of the parameter being described by this descriptor.
|
||||
*
|
||||
* @return the name of the parameter
|
||||
*/
|
||||
public final String getName() {
|
||||
@@ -63,7 +60,6 @@ public class ParameterDescriptor extends IgnorableDescriptor<ParameterDescriptor
|
||||
/**
|
||||
* Returns {@code true} if the described parameter is optional, otherwise
|
||||
* {@code false}.
|
||||
*
|
||||
* @return {@code true} if the described parameter is optional, otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2018 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.
|
||||
@@ -46,7 +46,6 @@ public class PathParametersSnippet extends AbstractParametersSnippet {
|
||||
* Creates a new {@code PathParametersSnippet} that will document the request's path
|
||||
* parameters using the given {@code descriptors}. Undocumented parameters will
|
||||
* trigger a failure.
|
||||
*
|
||||
* @param descriptors the parameter descriptors
|
||||
*/
|
||||
protected PathParametersSnippet(List<ParameterDescriptor> descriptors) {
|
||||
@@ -58,7 +57,6 @@ public class PathParametersSnippet extends AbstractParametersSnippet {
|
||||
* parameters using the given {@code descriptors}. If
|
||||
* {@code ignoreUndocumentedParameters} is {@code true}, undocumented parameters will
|
||||
* be ignored and will not trigger a failure.
|
||||
*
|
||||
* @param descriptors the parameter descriptors
|
||||
* @param ignoreUndocumentedParameters whether undocumented parameters should be
|
||||
* ignored
|
||||
@@ -73,7 +71,6 @@ public class PathParametersSnippet extends AbstractParametersSnippet {
|
||||
* parameters using the given {@code descriptors}. The given {@code attributes} will
|
||||
* be included in the model during template rendering. Undocumented parameters will
|
||||
* trigger a failure.
|
||||
*
|
||||
* @param descriptors the parameter descriptors
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
@@ -88,7 +85,6 @@ public class PathParametersSnippet extends AbstractParametersSnippet {
|
||||
* be included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedParameters} is {@code true}, undocumented parameters will
|
||||
* be ignored and will not trigger a failure.
|
||||
*
|
||||
* @param descriptors the parameter descriptors
|
||||
* @param attributes the additional attributes
|
||||
* @param ignoreUndocumentedParameters whether undocumented parameters should be
|
||||
@@ -136,7 +132,7 @@ public class PathParametersSnippet extends AbstractParametersSnippet {
|
||||
|
||||
private static String getParameterName(String match) {
|
||||
int colonIndex = match.indexOf(':');
|
||||
return colonIndex != -1 ? match.substring(0, colonIndex) : match;
|
||||
return (colonIndex != -1) ? match.substring(0, colonIndex) : match;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,8 +37,7 @@ public abstract class RequestDocumentation {
|
||||
/**
|
||||
* Creates a {@link ParameterDescriptor} that describes a request or path parameter
|
||||
* with the given {@code name}.
|
||||
*
|
||||
* @param name The name of the parameter
|
||||
* @param name the name of the parameter
|
||||
* @return a {@link ParameterDescriptor} ready for further configuration
|
||||
*/
|
||||
public static ParameterDescriptor parameterWithName(String name) {
|
||||
@@ -48,8 +47,7 @@ public abstract class RequestDocumentation {
|
||||
/**
|
||||
* Creates a {@link RequestPartDescriptor} that describes a request part with the
|
||||
* given {@code name}.
|
||||
*
|
||||
* @param name The name of the request part
|
||||
* @param name the name of the request part
|
||||
* @return a {@link RequestPartDescriptor} ready for further configuration
|
||||
*/
|
||||
public static RequestPartDescriptor partWithName(String name) {
|
||||
@@ -69,7 +67,6 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a path parameter, a parameter descriptor can be
|
||||
* marked as {@link ParameterDescriptor#ignored}. This will prevent it from appearing
|
||||
* in the generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param descriptors the descriptions of the parameters in the request's path
|
||||
* @return the snippet that will document the parameters
|
||||
*/
|
||||
@@ -91,7 +88,6 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a path parameter, a parameter descriptor can be
|
||||
* marked as {@link ParameterDescriptor#ignored}. This will prevent it from appearing
|
||||
* in the generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param descriptors the descriptions of the parameters in the request's path
|
||||
* @return the snippet that will document the parameters
|
||||
*/
|
||||
@@ -107,7 +103,6 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a parameter is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur. Any undocumented parameters will be ignored.
|
||||
*
|
||||
* @param descriptors the descriptions of the parameters in the request's path
|
||||
* @return the snippet that will document the parameters
|
||||
*/
|
||||
@@ -123,7 +118,6 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a parameter is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur. Any undocumented parameters will be ignored.
|
||||
*
|
||||
* @param descriptors the descriptions of the parameters in the request's path
|
||||
* @return the snippet that will document the parameters
|
||||
*/
|
||||
@@ -146,7 +140,6 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a path parameter, a parameter descriptor can be
|
||||
* marked as {@link ParameterDescriptor#ignored}. This will prevent it from appearing
|
||||
* in the generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the parameters in the request's path
|
||||
* @return the snippet that will document the parameters
|
||||
@@ -170,7 +163,6 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a path parameter, a parameter descriptor can be
|
||||
* marked as {@link ParameterDescriptor#ignored}. This will prevent it from appearing
|
||||
* in the generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the parameters in the request's path
|
||||
* @return the snippet that will document the parameters
|
||||
@@ -188,7 +180,6 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a parameter is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur. Any undocumented parameters will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the parameters in the request's path
|
||||
* @return the snippet that will document the parameters
|
||||
@@ -206,7 +197,6 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a parameter is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur. Any undocumented parameters will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the parameters in the request's path
|
||||
* @return the snippet that will document the parameters
|
||||
@@ -229,8 +219,7 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a request parameter, a parameter descriptor can be
|
||||
* marked as {@link ParameterDescriptor#ignored}. This will prevent it from appearing
|
||||
* in the generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param descriptors The descriptions of the request's parameters
|
||||
* @param descriptors the descriptions of the request's parameters
|
||||
* @return the snippet
|
||||
* @see OperationRequest#getParameters()
|
||||
*/
|
||||
@@ -252,8 +241,7 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a request parameter, a parameter descriptor can be
|
||||
* marked as {@link ParameterDescriptor#ignored}. This will prevent it from appearing
|
||||
* in the generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param descriptors The descriptions of the request's parameters
|
||||
* @param descriptors the descriptions of the request's parameters
|
||||
* @return the snippet
|
||||
* @see OperationRequest#getParameters()
|
||||
*/
|
||||
@@ -269,8 +257,7 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a parameter is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur. Any undocumented parameters will be ignored.
|
||||
*
|
||||
* @param descriptors The descriptions of the request's parameters
|
||||
* @param descriptors the descriptions of the request's parameters
|
||||
* @return the snippet
|
||||
* @see OperationRequest#getParameters()
|
||||
*/
|
||||
@@ -286,8 +273,7 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a parameter is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur. Any undocumented parameters will be ignored.
|
||||
*
|
||||
* @param descriptors The descriptions of the request's parameters
|
||||
* @param descriptors the descriptions of the request's parameters
|
||||
* @return the snippet
|
||||
* @see OperationRequest#getParameters()
|
||||
*/
|
||||
@@ -310,7 +296,6 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a request parameter, a parameter descriptor can be
|
||||
* marked as {@link ParameterDescriptor#ignored}. This will prevent it from appearing
|
||||
* in the generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's parameters
|
||||
* @return the snippet that will document the parameters
|
||||
@@ -335,7 +320,6 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a request parameter, a parameter descriptor can be
|
||||
* marked as {@link ParameterDescriptor#ignored}. This will prevent it from appearing
|
||||
* in the generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's parameters
|
||||
* @return the snippet that will document the parameters
|
||||
@@ -354,7 +338,6 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a parameter is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur. Any undocumented parameters will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's parameters
|
||||
* @return the snippet that will document the parameters
|
||||
@@ -373,7 +356,6 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a parameter is documented, is not marked as optional, and is not present in the
|
||||
* response, a failure will occur. Any undocumented parameters will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's parameters
|
||||
* @return the snippet that will document the parameters
|
||||
@@ -396,8 +378,7 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a part, a part descriptor can be marked as
|
||||
* {@link RequestPartDescriptor#ignored}. This will prevent it from appearing in the
|
||||
* generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param descriptors The descriptions of the request's parts
|
||||
* @param descriptors the descriptions of the request's parts
|
||||
* @return the snippet
|
||||
* @see OperationRequest#getParts()
|
||||
*/
|
||||
@@ -417,8 +398,7 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a part, a part descriptor can be marked as
|
||||
* {@link RequestPartDescriptor#ignored}. This will prevent it from appearing in the
|
||||
* generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param descriptors The descriptions of the request's parts
|
||||
* @param descriptors the descriptions of the request's parts
|
||||
* @return the snippet
|
||||
* @see OperationRequest#getParts()
|
||||
*/
|
||||
@@ -433,8 +413,7 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a part is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented parts will be ignored.
|
||||
*
|
||||
* @param descriptors The descriptions of the request's parts
|
||||
* @param descriptors the descriptions of the request's parts
|
||||
* @return the snippet
|
||||
* @see OperationRequest#getParts()
|
||||
*/
|
||||
@@ -449,8 +428,7 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a part is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented parts will be ignored.
|
||||
*
|
||||
* @param descriptors The descriptions of the request's parts
|
||||
* @param descriptors the descriptions of the request's parts
|
||||
* @return the snippet
|
||||
* @see OperationRequest#getParts()
|
||||
*/
|
||||
@@ -472,7 +450,6 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a part, a part descriptor can be marked as
|
||||
* {@link RequestPartDescriptor#ignored}. This will prevent it from appearing in the
|
||||
* generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's parts
|
||||
* @return the snippet
|
||||
@@ -496,7 +473,6 @@ public abstract class RequestDocumentation {
|
||||
* If you do not want to document a part, a part descriptor can be marked as
|
||||
* {@link RequestPartDescriptor#ignored}. This will prevent it from appearing in the
|
||||
* generated snippet while avoiding the failure described above.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's parts
|
||||
* @return the snippet
|
||||
@@ -514,7 +490,6 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a part is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented parts will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's parts
|
||||
* @return the snippet
|
||||
@@ -532,7 +507,6 @@ public abstract class RequestDocumentation {
|
||||
* <p>
|
||||
* If a part is documented, is not marked as optional, and is not present in the
|
||||
* request, a failure will occur. Any undocumented parts will be ignored.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @param descriptors the descriptions of the request's parts
|
||||
* @return the snippet
|
||||
|
||||
@@ -44,7 +44,6 @@ public class RequestParametersSnippet extends AbstractParametersSnippet {
|
||||
* Creates a new {@code RequestParametersSnippet} that will document the request's
|
||||
* parameters using the given {@code descriptors}. Undocumented parameters will
|
||||
* trigger a failure.
|
||||
*
|
||||
* @param descriptors the parameter descriptors
|
||||
*/
|
||||
protected RequestParametersSnippet(List<ParameterDescriptor> descriptors) {
|
||||
@@ -56,7 +55,6 @@ public class RequestParametersSnippet extends AbstractParametersSnippet {
|
||||
* parameters using the given {@code descriptors}. If
|
||||
* {@code ignoreUndocumentedParameters} is {@code true}, undocumented parameters will
|
||||
* be ignored and will not trigger a failure.
|
||||
*
|
||||
* @param descriptors the parameter descriptors
|
||||
* @param ignoreUndocumentedParameters whether undocumented parameters should be
|
||||
* ignored
|
||||
@@ -71,7 +69,6 @@ public class RequestParametersSnippet extends AbstractParametersSnippet {
|
||||
* parameters using the given {@code descriptors}. The given {@code attributes} will
|
||||
* be included in the model during template rendering. Undocumented parameters will
|
||||
* trigger a failure.
|
||||
*
|
||||
* @param descriptors the parameter descriptors
|
||||
* @param attributes the additional attributes
|
||||
*/
|
||||
@@ -86,7 +83,6 @@ public class RequestParametersSnippet extends AbstractParametersSnippet {
|
||||
* be included in the model during template rendering. If
|
||||
* {@code ignoreUndocumentedParameters} is {@code true}, undocumented parameters will
|
||||
* be ignored and will not trigger a failure.
|
||||
*
|
||||
* @param descriptors the parameter descriptors
|
||||
* @param attributes the additional attributes
|
||||
* @param ignoreUndocumentedParameters whether undocumented parameters should be
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user