Improve readability by using monospaced font in various snippets

This commit updates a number of the snippets to use a monospaced font
for parts of their output. The changes are:

- Links snippet: rel
- Path parameters: name
- Request fields: path and type
- Request headers: name
- Request parameters: name
- Response fields: path and type
- Response headers: name

Closes gh-230
This commit is contained in:
Andy Wilkinson
2016-05-11 14:50:39 +01:00
parent d362f3f41f
commit 63a6ad2c91
21 changed files with 112 additions and 106 deletions

View File

@@ -2,7 +2,7 @@
|Relation|Description
{{#links}}
|{{rel}}
|`{{rel}}`
|{{description}}
{{/links}}

View File

@@ -3,7 +3,7 @@
|Parameter|Description
{{#parameters}}
|{{name}}
|`{{name}}`
|{{description}}
{{/parameters}}

View File

@@ -2,8 +2,8 @@
|Path|Type|Description
{{#fields}}
|{{path}}
|{{type}}
|`{{path}}`
|`{{type}}`
|{{description}}
{{/fields}}

View File

@@ -2,7 +2,7 @@
|Name|Description
{{#headers}}
|{{name}}
|`{{name}}`
|{{description}}
{{/headers}}

View File

@@ -2,7 +2,7 @@
|Parameter|Description
{{#parameters}}
|{{name}}
|`{{name}}`
|{{description}}
{{/parameters}}

View File

@@ -2,8 +2,8 @@
|Path|Type|Description
{{#fields}}
|{{path}}
|{{type}}
|`{{path}}`
|`{{type}}`
|{{description}}
{{/fields}}

View File

@@ -2,7 +2,7 @@
|Name|Description
{{#headers}}
|{{name}}
|`{{name}}`
|{{description}}
{{/headers}}

View File

@@ -1,5 +1,5 @@
Relation | Description
-------- | -----------
{{#links}}
{{rel}} | {{description}}
`{{rel}}` | {{description}}
{{/links}}

View File

@@ -3,5 +3,5 @@
Parameter | Description
--------- | -----------
{{#parameters}}
{{name}} | {{description}}
`{{name}}` | {{description}}
{{/parameters}}

View File

@@ -1,5 +1,5 @@
Path | Type | Description
---- | ---- | -----------
{{#fields}}
{{path}} | {{type}} | {{description}}
`{{path}}` | `{{type}}` | {{description}}
{{/fields}}

View File

@@ -1,5 +1,5 @@
Name | Description
---- | -----------
{{#headers}}
{{name}} | {{description}}
`{{name}}` | {{description}}
{{/headers}}

View File

@@ -1,5 +1,5 @@
Parameter | Description
--------- | -----------
{{#parameters}}
{{name}} | {{description}}
`{{name}}` | {{description}}
{{/parameters}}

View File

@@ -1,5 +1,5 @@
Path | Type | Description
---- | ---- | -----------
{{#fields}}
{{path}} | {{type}} | {{description}}
`{{path}}` | `{{type}}` | {{description}}
{{/fields}}

View File

@@ -1,5 +1,5 @@
Name | Description
---- | -----------
{{#headers}}
{{name}} | {{description}}
`{{name}}` | {{description}}
{{/headers}}

View File

@@ -50,10 +50,11 @@ public class RequestHeadersSnippetTests extends AbstractSnippetTests {
@Test
public void requestWithHeaders() throws IOException {
this.snippet.expectRequestHeaders("request-with-headers")
.withContents(tableWithHeader("Name", "Description").row("X-Test", "one")
.row("Accept", "two").row("Accept-Encoding", "three")
.row("Accept-Language", "four").row("Cache-Control", "five")
.row("Connection", "six"));
.withContents(tableWithHeader("Name", "Description")
.row("`X-Test`", "one").row("`Accept`", "two")
.row("`Accept-Encoding`", "three")
.row("`Accept-Language`", "four").row("`Cache-Control`", "five")
.row("`Connection`", "six"));
new RequestHeadersSnippet(
Arrays.asList(headerWithName("X-Test").description("one"),
headerWithName("Accept").description("two"),
@@ -74,7 +75,7 @@ public class RequestHeadersSnippetTests extends AbstractSnippetTests {
public void caseInsensitiveRequestHeaders() throws IOException {
this.snippet.expectRequestHeaders("case-insensitive-request-headers")
.withContents(
tableWithHeader("Name", "Description").row("X-Test", "one"));
tableWithHeader("Name", "Description").row("`X-Test`", "one"));
new RequestHeadersSnippet(
Arrays.asList(headerWithName("X-Test").description("one")))
.document(operationBuilder("case-insensitive-request-headers")
@@ -143,10 +144,11 @@ public class RequestHeadersSnippetTests extends AbstractSnippetTests {
@Test
public void additionalDescriptors() throws IOException {
this.snippet.expectRequestHeaders("additional-descriptors")
.withContents(tableWithHeader("Name", "Description").row("X-Test", "one")
.row("Accept", "two").row("Accept-Encoding", "three")
.row("Accept-Language", "four").row("Cache-Control", "five")
.row("Connection", "six"));
.withContents(tableWithHeader("Name", "Description")
.row("`X-Test`", "one").row("`Accept`", "two")
.row("`Accept-Encoding`", "three")
.row("`Accept-Language`", "four").row("`Cache-Control`", "five")
.row("`Connection`", "six"));
HeaderDocumentation
.requestHeaders(headerWithName("X-Test").description("one"),
headerWithName("Accept").description("two"),

View File

@@ -49,10 +49,10 @@ public class ResponseHeadersSnippetTests extends AbstractSnippetTests {
@Test
public void responseWithHeaders() throws IOException {
this.snippet.expectResponseHeaders("response-headers")
.withContents(tableWithHeader("Name", "Description").row("X-Test", "one")
.row("Content-Type", "two").row("Etag", "three")
.row("Cache-Control", "five").row("Vary", "six"));
this.snippet.expectResponseHeaders("response-headers").withContents(
tableWithHeader("Name", "Description").row("`X-Test`", "one")
.row("`Content-Type`", "two").row("`Etag`", "three")
.row("`Cache-Control`", "five").row("`Vary`", "six"));
new ResponseHeadersSnippet(
Arrays.asList(headerWithName("X-Test").description("one"),
headerWithName("Content-Type").description("two"),
@@ -73,7 +73,7 @@ public class ResponseHeadersSnippetTests extends AbstractSnippetTests {
public void caseInsensitiveResponseHeaders() throws IOException {
this.snippet.expectResponseHeaders("case-insensitive-response-headers")
.withContents(
tableWithHeader("Name", "Description").row("X-Test", "one"));
tableWithHeader("Name", "Description").row("`X-Test`", "one"));
new ResponseHeadersSnippet(
Arrays.asList(headerWithName("X-Test").description("one")))
.document(operationBuilder("case-insensitive-response-headers")
@@ -136,10 +136,10 @@ public class ResponseHeadersSnippetTests extends AbstractSnippetTests {
@Test
public void additionalDescriptors() throws IOException {
this.snippet.expectResponseHeaders("additional-descriptors")
.withContents(tableWithHeader("Name", "Description").row("X-Test", "one")
.row("Content-Type", "two").row("Etag", "three")
.row("Cache-Control", "five").row("Vary", "six"));
this.snippet.expectResponseHeaders("additional-descriptors").withContents(
tableWithHeader("Name", "Description").row("`X-Test`", "one")
.row("`Content-Type`", "two").row("`Etag`", "three")
.row("`Cache-Control`", "five").row("`Vary`", "six"));
HeaderDocumentation
.responseHeaders(headerWithName("X-Test").description("one"),
headerWithName("Content-Type").description("two"),

View File

@@ -47,7 +47,7 @@ public class LinksSnippetTests extends AbstractSnippetTests {
@Test
public void ignoredLink() throws IOException {
this.snippet.expectLinks("ignored-link").withContents(
tableWithHeader("Relation", "Description").row("b", "Link b"));
tableWithHeader("Relation", "Description").row("`b`", "Link b"));
new LinksSnippet(
new StubLinkExtractor().withLinks(new Link("a", "alpha"),
new Link("b", "bravo")),
@@ -59,7 +59,7 @@ public class LinksSnippetTests extends AbstractSnippetTests {
@Test
public void allUndocumentedLinksCanBeIgnored() throws IOException {
this.snippet.expectLinks("ignore-all-undocumented").withContents(
tableWithHeader("Relation", "Description").row("b", "Link b"));
tableWithHeader("Relation", "Description").row("`b`", "Link b"));
new LinksSnippet(
new StubLinkExtractor().withLinks(new Link("a", "alpha"),
new Link("b", "bravo")),
@@ -70,7 +70,7 @@ public class LinksSnippetTests extends AbstractSnippetTests {
@Test
public void presentOptionalLink() throws IOException {
this.snippet.expectLinks("present-optional-link").withContents(
tableWithHeader("Relation", "Description").row("foo", "bar"));
tableWithHeader("Relation", "Description").row("`foo`", "bar"));
new LinksSnippet(new StubLinkExtractor().withLinks(new Link("foo", "blah")),
Arrays.asList(new LinkDescriptor("foo").description("bar").optional()))
.document(operationBuilder("present-optional-link").build());
@@ -79,7 +79,7 @@ public class LinksSnippetTests extends AbstractSnippetTests {
@Test
public void missingOptionalLink() throws IOException {
this.snippet.expectLinks("missing-optional-link").withContents(
tableWithHeader("Relation", "Description").row("foo", "bar"));
tableWithHeader("Relation", "Description").row("`foo`", "bar"));
new LinksSnippet(new StubLinkExtractor(),
Arrays.asList(new LinkDescriptor("foo").description("bar").optional()))
.document(operationBuilder("missing-optional-link").build());
@@ -88,8 +88,8 @@ public class LinksSnippetTests extends AbstractSnippetTests {
@Test
public void documentedLinks() throws IOException {
this.snippet.expectLinks("documented-links")
.withContents(tableWithHeader("Relation", "Description").row("a", "one")
.row("b", "two"));
.withContents(tableWithHeader("Relation", "Description").row("`a`", "one")
.row("`b`", "two"));
new LinksSnippet(
new StubLinkExtractor().withLinks(new Link("a", "alpha"),
new Link("b", "bravo")),
@@ -101,8 +101,8 @@ public class LinksSnippetTests extends AbstractSnippetTests {
@Test
public void linkDescriptionFromTitleInPayload() throws IOException {
this.snippet.expectLinks("link-description-from-title-in-payload")
.withContents(tableWithHeader("Relation", "Description").row("a", "one")
.row("b", "Link b"));
.withContents(tableWithHeader("Relation", "Description").row("`a`", "one")
.row("`b`", "Link b"));
new LinksSnippet(
new StubLinkExtractor().withLinks(new Link("a", "alpha", "Link a"),
new Link("b", "bravo", "Link b")),
@@ -162,8 +162,8 @@ public class LinksSnippetTests extends AbstractSnippetTests {
@Test
public void additionalDescriptors() throws IOException {
this.snippet.expectLinks("additional-descriptors")
.withContents(tableWithHeader("Relation", "Description").row("a", "one")
.row("b", "two"));
.withContents(tableWithHeader("Relation", "Description").row("`a`", "one")
.row("`b`", "two"));
HypermediaDocumentation
.links(new StubLinkExtractor().withLinks(new Link("a", "alpha"),
new Link("b", "bravo")),

View File

@@ -51,8 +51,8 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
public void mapRequestWithFields() throws IOException {
this.snippet.expectRequestFields("map-request-with-fields")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("a.b", "Number", "one").row("a.c", "String", "two").row("a",
"Object", "three"));
.row("`a.b`", "`Number`", "one").row("`a.c`", "`String`", "two")
.row("`a`", "`Object`", "three"));
new RequestFieldsSnippet(Arrays.asList(fieldWithPath("a.b").description("one"),
fieldWithPath("a.c").description("two"),
@@ -67,8 +67,9 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
public void arrayRequestWithFields() throws IOException {
this.snippet.expectRequestFields("array-request-with-fields")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("[]a.b", "Number", "one").row("[]a.c", "String", "two")
.row("[]a", "Object", "three"));
.row("`[]a.b`", "`Number`", "one")
.row("`[]a.c`", "`String`", "two")
.row("`[]a`", "`Object`", "three"));
new RequestFieldsSnippet(Arrays.asList(fieldWithPath("[]a.b").description("one"),
fieldWithPath("[]a.c").description("two"),
@@ -83,8 +84,8 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void ignoredRequestField() throws IOException {
this.snippet.expectRequestFields("ignored-request-field")
.withContents(tableWithHeader("Path", "Type", "Description").row("b",
"Number", "Field b"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`b`",
"`Number`", "Field b"));
new RequestFieldsSnippet(Arrays.asList(fieldWithPath("a").ignored(),
fieldWithPath("b").description("Field b")))
@@ -96,8 +97,8 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void allUndocumentedRequestFieldsCanBeIgnored() throws IOException {
this.snippet.expectRequestFields("ignore-all-undocumented")
.withContents(tableWithHeader("Path", "Type", "Description").row("b",
"Number", "Field b"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`b`",
"`Number`", "Field b"));
new RequestFieldsSnippet(Arrays.asList(fieldWithPath("b").description("Field b")),
true).document(
operationBuilder("ignore-all-undocumented")
@@ -108,8 +109,8 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void missingOptionalRequestField() throws IOException {
this.snippet.expectRequestFields("missing-optional-request-field")
.withContents(tableWithHeader("Path", "Type", "Description").row("a.b",
"String", "one"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`a.b`",
"`String`", "one"));
new RequestFieldsSnippet(Arrays.asList(fieldWithPath("a.b").description("one")
.type(JsonFieldType.STRING).optional()))
.document(operationBuilder("missing-optional-request-field")
@@ -119,8 +120,8 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void presentOptionalRequestField() throws IOException {
this.snippet.expectRequestFields("present-optional-request-field")
.withContents(tableWithHeader("Path", "Type", "Description").row("a.b",
"String", "one"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`a.b`",
"`String`", "one"));
new RequestFieldsSnippet(Arrays.asList(fieldWithPath("a.b").description("one")
.type(JsonFieldType.STRING).optional()))
.document(operationBuilder("present-optional-request-field")
@@ -179,8 +180,8 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
public void xmlRequestFields() throws IOException {
this.snippet.expectRequestFields("xml-request")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("a/b", "b", "one").row("a/c", "c", "two").row("a", "a",
"three"));
.row("`a/b`", "`b`", "one").row("`a/c`", "`c`", "two").row("`a`",
"`a`", "three"));
new RequestFieldsSnippet(
Arrays.asList(fieldWithPath("a/b").description("one").type("b"),
@@ -199,8 +200,8 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
public void additionalDescriptors() throws IOException {
this.snippet.expectRequestFields("additional-descriptors")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("a.b", "Number", "one").row("a.c", "String", "two").row("a",
"Object", "three"));
.row("`a.b`", "`Number`", "one").row("`a.c`", "`String`", "two")
.row("`a`", "`Object`", "three"));
PayloadDocumentation
.requestFields(fieldWithPath("a.b").description("one"),
@@ -215,8 +216,8 @@ public class RequestFieldsSnippetTests extends AbstractSnippetTests {
public void prefixedAdditionalDescriptors() throws IOException {
this.snippet.expectRequestFields("prefixed-additional-descriptors")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("a", "Object", "one").row("a.b", "Number", "two").row("a.c",
"String", "three"));
.row("`a`", "`Object`", "one").row("`a.b`", "`Number`", "two")
.row("`a.c`", "`String`", "three"));
PayloadDocumentation.requestFields(fieldWithPath("a").description("one"))
.andWithPrefix("a.", fieldWithPath("b").description("two"),

View File

@@ -51,10 +51,11 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
public void mapResponseWithFields() throws IOException {
this.snippet.expectResponseFields("map-response-with-fields")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("id", "Number", "one").row("date", "String", "two")
.row("assets", "Array", "three").row("assets[]", "Object", "four")
.row("assets[].id", "Number", "five")
.row("assets[].name", "String", "six"));
.row("`id`", "`Number`", "one").row("`date`", "`String`", "two")
.row("`assets`", "`Array`", "three")
.row("`assets[]`", "`Object`", "four")
.row("`assets[].id`", "`Number`", "five")
.row("`assets[].name`", "`String`", "six"));
new ResponseFieldsSnippet(Arrays.asList(fieldWithPath("id").description("one"),
fieldWithPath("date").description("two"),
fieldWithPath("assets").description("three"),
@@ -72,8 +73,9 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
public void arrayResponseWithFields() throws IOException {
this.snippet.expectResponseFields("array-response-with-fields")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("[]a.b", "Number", "one").row("[]a.c", "String", "two")
.row("[]a", "Object", "three"));
.row("`[]a.b`", "`Number`", "one")
.row("`[]a.c`", "`String`", "two")
.row("`[]a`", "`Object`", "three"));
new ResponseFieldsSnippet(Arrays.asList(fieldWithPath("[]a.b").description("one"),
fieldWithPath("[]a.c").description("two"),
fieldWithPath("[]a").description("three"))).document(
@@ -86,8 +88,8 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void arrayResponse() throws IOException {
this.snippet.expectResponseFields("array-response")
.withContents(tableWithHeader("Path", "Type", "Description").row("[]",
"String", "one"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`[]`",
"`String`", "one"));
new ResponseFieldsSnippet(Arrays.asList(fieldWithPath("[]").description("one")))
.document(operationBuilder("array-response").response()
.content("[\"a\", \"b\", \"c\"]").build());
@@ -96,8 +98,8 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void ignoredResponseField() throws IOException {
this.snippet.expectResponseFields("ignored-response-field")
.withContents(tableWithHeader("Path", "Type", "Description").row("b",
"Number", "Field b"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`b`",
"`Number`", "Field b"));
new ResponseFieldsSnippet(Arrays.asList(fieldWithPath("a").ignored(),
fieldWithPath("b").description("Field b")))
@@ -108,8 +110,8 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void allUndocumentedFieldsCanBeIgnored() throws IOException {
this.snippet.expectResponseFields("ignore-all-undocumented")
.withContents(tableWithHeader("Path", "Type", "Description").row("b",
"Number", "Field b"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`b`",
"`Number`", "Field b"));
new ResponseFieldsSnippet(
Arrays.asList(fieldWithPath("b").description("Field b")), true)
@@ -136,8 +138,8 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void missingOptionalResponseField() throws IOException {
this.snippet.expectResponseFields("missing-optional-response-field")
.withContents(tableWithHeader("Path", "Type", "Description").row("a.b",
"String", "one"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`a.b`",
"`String`", "one"));
new ResponseFieldsSnippet(Arrays.asList(fieldWithPath("a.b").description("one")
.type(JsonFieldType.STRING).optional()))
.document(operationBuilder("missing-optional-response-field")
@@ -147,8 +149,8 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void presentOptionalResponseField() throws IOException {
this.snippet.expectResponseFields("present-optional-response-field")
.withContents(tableWithHeader("Path", "Type", "Description").row("a.b",
"String", "one"));
.withContents(tableWithHeader("Path", "Type", "Description").row("`a.b`",
"`String`", "one"));
new ResponseFieldsSnippet(Arrays.asList(fieldWithPath("a.b").description("one")
.type(JsonFieldType.STRING).optional())).document(
operationBuilder("present-optional-response-field").response()
@@ -186,8 +188,8 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
public void xmlResponseFields() throws IOException {
this.snippet.expectResponseFields("xml-response")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("a/b", "b", "one").row("a/c", "c", "two").row("a", "a",
"three"));
.row("`a/b`", "`b`", "one").row("`a/c`", "`c`", "two").row("`a`",
"`a`", "three"));
new ResponseFieldsSnippet(
Arrays.asList(fieldWithPath("a/b").description("one").type("b"),
fieldWithPath("a/c").description("two").type("c"),
@@ -204,7 +206,7 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
public void xmlAttribute() throws IOException {
this.snippet.expectResponseFields("xml-attribute")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("a", "b", "one").row("a/@id", "c", "two"));
.row("`a`", "`b`", "one").row("`a/@id`", "`c`", "two"));
new ResponseFieldsSnippet(
Arrays.asList(fieldWithPath("a").description("one").type("b"),
fieldWithPath("a/@id").description("two").type("c")))
@@ -220,7 +222,7 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
public void missingOptionalXmlAttribute() throws IOException {
this.snippet.expectResponseFields("missing-optional-xml-attribute")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("a", "b", "one").row("a/@id", "c", "two"));
.row("`a`", "`b`", "one").row("`a/@id`", "`c`", "two"));
new ResponseFieldsSnippet(
Arrays.asList(fieldWithPath("a").description("one").type("b"),
fieldWithPath("a/@id").description("two").type("c").optional()))
@@ -235,7 +237,7 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
@Test
public void undocumentedAttributeDoesNotCauseFailure() throws IOException {
this.snippet.expectResponseFields("undocumented-attribute").withContents(
tableWithHeader("Path", "Type", "Description").row("a", "a", "one"));
tableWithHeader("Path", "Type", "Description").row("`a`", "`a`", "one"));
new ResponseFieldsSnippet(
Arrays.asList(fieldWithPath("a").description("one").type("a")))
.document(operationBuilder("undocumented-attribute").response()
@@ -249,10 +251,11 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
public void additionalDescriptors() throws IOException {
this.snippet.expectResponseFields("additional-descriptors")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("id", "Number", "one").row("date", "String", "two")
.row("assets", "Array", "three").row("assets[]", "Object", "four")
.row("assets[].id", "Number", "five")
.row("assets[].name", "String", "six"));
.row("`id`", "`Number`", "one").row("`date`", "`String`", "two")
.row("`assets`", "`Array`", "three")
.row("`assets[]`", "`Object`", "four")
.row("`assets[].id`", "`Number`", "five")
.row("`assets[].name`", "`String`", "six"));
PayloadDocumentation
.responseFields(fieldWithPath("id").description("one"),
fieldWithPath("date").description("two"),
@@ -270,8 +273,8 @@ public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
public void prefixedAdditionalDescriptors() throws IOException {
this.snippet.expectResponseFields("prefixed-additional-descriptors")
.withContents(tableWithHeader("Path", "Type", "Description")
.row("a", "Object", "one").row("a.b", "Number", "two").row("a.c",
"String", "three"));
.row("`a`", "`Object`", "one").row("`a.b`", "`Number`", "two")
.row("`a.c`", "`String`", "three"));
PayloadDocumentation.responseFields(fieldWithPath("a").description("one"))
.andWithPrefix("a.", fieldWithPath("b").description("two"),

View File

@@ -51,7 +51,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests {
public void pathParameters() throws IOException {
this.snippet.expectPathParameters("path-parameters").withContents(
tableWithTitleAndHeader(getTitle(), "Parameter", "Description")
.row("a", "one").row("b", "two"));
.row("`a`", "one").row("`b`", "two"));
new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"),
parameterWithName("b").description("two")))
.document(operationBuilder("path-parameters").attribute(
@@ -62,7 +62,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests {
@Test
public void ignoredPathParameter() throws IOException {
this.snippet.expectPathParameters("ignored-path-parameter").withContents(
tableWithTitleAndHeader(getTitle(), "Parameter", "Description").row("b",
tableWithTitleAndHeader(getTitle(), "Parameter", "Description").row("`b`",
"two"));
new PathParametersSnippet(Arrays.asList(parameterWithName("a").ignored(),
parameterWithName("b").description("two")))
@@ -74,7 +74,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests {
@Test
public void allUndocumentedPathParametersCanBeIgnored() throws IOException {
this.snippet.expectPathParameters("ignore-all-undocumented").withContents(
tableWithTitleAndHeader(getTitle(), "Parameter", "Description").row("b",
tableWithTitleAndHeader(getTitle(), "Parameter", "Description").row("`b`",
"two"));
new PathParametersSnippet(
Arrays.asList(parameterWithName("b").description("two")), true)
@@ -91,7 +91,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests {
.withContents(tableWithTitleAndHeader(
this.templateFormat == TemplateFormats.asciidoctor() ? "/{a}"
: "`/{a}`",
"Parameter", "Description").row("a", "one").row("b", "two"));
"Parameter", "Description").row("`a`", "one").row("`b`", "two"));
new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"),
parameterWithName("b").description("two").optional())).document(
operationBuilder("missing-optional-path-parameter").attribute(
@@ -107,7 +107,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests {
.withContents(tableWithTitleAndHeader(
this.templateFormat == TemplateFormats.asciidoctor() ? "/{a}"
: "`/{a}`",
"Parameter", "Description").row("a", "one"));
"Parameter", "Description").row("`a`", "one"));
new PathParametersSnippet(
Arrays.asList(parameterWithName("a").description("one").optional()))
.document(operationBuilder("present-optional-path-parameter")
@@ -122,7 +122,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests {
this.snippet.expectPathParameters("path-parameters-with-query-string")
.withContents(
tableWithTitleAndHeader(getTitle(), "Parameter", "Description")
.row("a", "one").row("b", "two"));
.row("`a`", "one").row("`b`", "two"));
new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"),
parameterWithName("b").description("two"))).document(
operationBuilder("path-parameters-with-query-string").attribute(
@@ -183,7 +183,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests {
public void additionalDescriptors() throws IOException {
this.snippet.expectPathParameters("additional-descriptors").withContents(
tableWithTitleAndHeader(getTitle(), "Parameter", "Description")
.row("a", "one").row("b", "two"));
.row("`a`", "one").row("`b`", "two"));
RequestDocumentation.pathParameters(parameterWithName("a").description("one"))
.and(parameterWithName("b").description("two"))
.document(operationBuilder("additional-descriptors")

View File

@@ -48,8 +48,8 @@ public class RequestParametersSnippetTests extends AbstractSnippetTests {
@Test
public void requestParameters() throws IOException {
this.snippet.expectRequestParameters("request-parameters")
.withContents(tableWithHeader("Parameter", "Description").row("a", "one")
.row("b", "two"));
.withContents(tableWithHeader("Parameter", "Description")
.row("`a`", "one").row("`b`", "two"));
new RequestParametersSnippet(
Arrays.asList(parameterWithName("a").description("one"),
parameterWithName("b").description("two")))
@@ -62,7 +62,7 @@ public class RequestParametersSnippetTests extends AbstractSnippetTests {
public void requestParameterWithNoValue() throws IOException {
this.snippet.expectRequestParameters("request-parameter-with-no-value")
.withContents(
tableWithHeader("Parameter", "Description").row("a", "one"));
tableWithHeader("Parameter", "Description").row("`a`", "one"));
new RequestParametersSnippet(
Arrays.asList(parameterWithName("a").description("one")))
.document(operationBuilder("request-parameter-with-no-value")
@@ -72,7 +72,7 @@ public class RequestParametersSnippetTests extends AbstractSnippetTests {
@Test
public void ignoredRequestParameter() throws IOException {
this.snippet.expectRequestParameters("ignored-request-parameter").withContents(
tableWithHeader("Parameter", "Description").row("b", "two"));
tableWithHeader("Parameter", "Description").row("`b`", "two"));
new RequestParametersSnippet(Arrays.asList(parameterWithName("a").ignored(),
parameterWithName("b").description("two")))
.document(operationBuilder("ignored-request-parameter")
@@ -83,7 +83,7 @@ public class RequestParametersSnippetTests extends AbstractSnippetTests {
@Test
public void allUndocumentedRequestParametersCanBeIgnored() throws IOException {
this.snippet.expectRequestParameters("ignore-all-undocumented").withContents(
tableWithHeader("Parameter", "Description").row("b", "two"));
tableWithHeader("Parameter", "Description").row("`b`", "two"));
new RequestParametersSnippet(
Arrays.asList(parameterWithName("b").description("two")), true)
.document(operationBuilder("ignore-all-undocumented")
@@ -94,8 +94,8 @@ public class RequestParametersSnippetTests extends AbstractSnippetTests {
@Test
public void missingOptionalRequestParameter() throws IOException {
this.snippet.expectRequestParameters("missing-optional-request-parameter")
.withContents(tableWithHeader("Parameter", "Description").row("a", "one")
.row("b", "two"));
.withContents(tableWithHeader("Parameter", "Description")
.row("`a`", "one").row("`b`", "two"));
new RequestParametersSnippet(
Arrays.asList(parameterWithName("a").description("one").optional(),
parameterWithName("b").description("two"))).document(
@@ -108,7 +108,7 @@ public class RequestParametersSnippetTests extends AbstractSnippetTests {
public void presentOptionalRequestParameter() throws IOException {
this.snippet.expectRequestParameters("present-optional-request-parameter")
.withContents(
tableWithHeader("Parameter", "Description").row("a", "one"));
tableWithHeader("Parameter", "Description").row("`a`", "one"));
new RequestParametersSnippet(
Arrays.asList(parameterWithName("a").description("one").optional()))
.document(operationBuilder("present-optional-request-parameter")
@@ -185,8 +185,8 @@ public class RequestParametersSnippetTests extends AbstractSnippetTests {
@Test
public void additionalDescriptors() throws IOException {
this.snippet.expectRequestParameters("additional-descriptors")
.withContents(tableWithHeader("Parameter", "Description").row("a", "one")
.row("b", "two"));
.withContents(tableWithHeader("Parameter", "Description")
.row("`a`", "one").row("`b`", "two"));
RequestDocumentation.requestParameters(parameterWithName("a").description("one"))
.and(parameterWithName("b").description("two"))
.document(operationBuilder("additional-descriptors")