Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ protected AbstractFieldsSnippet(String name, String type, List<FieldDescriptor>
for (FieldDescriptor descriptor : descriptors) {
Assert.notNull(descriptor.getPath(), "Field descriptors must have a path");
if (!descriptor.isIgnored()) {
Assert.notNull(descriptor.getDescription() != null, "The descriptor for '" + descriptor.getPath()
+ "' must have a" + " description or it must be marked as ignored");
Assert.notNull(descriptor.getDescription(), "The descriptor for '" + descriptor.getPath()
+ "' must have a description or it must be marked as ignored");
}
}
this.fieldDescriptors = descriptors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,15 @@ void typeDeterminationDoesNotSetTypeOnDescriptor(OperationBuilder operationBuild
.isTable((table) -> table.withHeader("Path", "Type", "Description").row("`id`", "`Number`", "one"));
}

@SnippetTest
void undocumentedResponseFieldDescriptorMustHaveADescription() {
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> new ResponseFieldsSnippet(
Arrays.asList(fieldWithPath("input_data_type").type(JsonFieldType.STRING))))
.withMessage(
"The descriptor for 'input_data_type' must have a description or it must be marked as ignored");
}

@SnippetTest
void attemptToDocumentFieldsWithNoResponseBody(OperationBuilder operationBuilder) {
assertThatExceptionOfType(SnippetException.class)
Expand Down