org.springframework.restdocs.snippet.Snippet Java Examples

The following examples show how to use org.springframework.restdocs.snippet.Snippet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TargetFilterQueriesResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private Snippet getResponseFieldTargetFilterQuery(final boolean isArray) {
    final String arrayPrefix = getArrayPrefix(isArray);
    return responseFields(fieldWithPath(arrayPrefix + "id").description(ApiModelPropertiesGeneric.ITEM_ID),
            fieldWithPath(arrayPrefix + "name").description(ApiModelPropertiesGeneric.NAME),
            fieldWithPath(arrayPrefix + "query").description(MgmtApiModelProperties.TARGET_FILTER_QUERY),
            fieldWithPath(arrayPrefix + "autoAssignDistributionSet")
                    .description(MgmtApiModelProperties.TARGET_FILTER_QUERY_AUTO_ASSIGN_DS_ID)
                    .type(JsonFieldType.NUMBER.toString()),
            fieldWithPath(arrayPrefix + "autoAssignActionType")
                    .description(MgmtApiModelProperties.ACTION_FORCE_TYPE).type(JsonFieldType.STRING.toString())
                    .attributes(key("value").value("['forced', 'soft', 'downloadonly']")),
            fieldWithPath(arrayPrefix + "autoAssignWeight")
                    .description(MgmtApiModelProperties.RESULTING_ACTIONS_WEIGHT)
                    .type(JsonFieldType.NUMBER.toString()),
            fieldWithPath(arrayPrefix + "createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
            fieldWithPath(arrayPrefix + "createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
            fieldWithPath(arrayPrefix + "lastModifiedAt").description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT),
            fieldWithPath(arrayPrefix + "lastModifiedBy").description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY),
            fieldWithPath(arrayPrefix + "_links.self").ignored(), fieldWithPath(arrayPrefix + "_links.autoAssignDS")
                    .description(MgmtApiModelProperties.TARGET_FILTER_QUERY_LINK_AUTO_ASSIGN_DS));
}
 
Example #2
Source File: RamlDocumentation.java    From restdocs-raml with MIT License 6 votes vote down vote up
public static RestDocumentationResultHandler document(String identifier,
                                                      String description,
                                                      boolean privateResource,
                                                      OperationRequestPreprocessor requestPreprocessor,
                                                      OperationResponsePreprocessor responsePreprocessor,
                                                      Function<List<Snippet>, List<Snippet>> snippetFilter,
                                                      Snippet... snippets) {

    Snippet[] enhancedSnippets = enhanceSnippetsWithRaml(description, privateResource, snippetFilter, snippets);

    if (requestPreprocessor != null && responsePreprocessor != null) {
        return MockMvcRestDocumentation.document(identifier, requestPreprocessor, responsePreprocessor, enhancedSnippets);
    } else if (requestPreprocessor != null) {
        return MockMvcRestDocumentation.document(identifier, requestPreprocessor, enhancedSnippets);
    } else if (responsePreprocessor != null) {
        return MockMvcRestDocumentation.document(identifier, responsePreprocessor, enhancedSnippets);
    }

    return MockMvcRestDocumentation.document(identifier, enhancedSnippets);
}
 
Example #3
Source File: DistributionSetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Snippet getRequestFieldsTag(final boolean isArray) {
    final String arrayPrefix = getArrayPrefix(isArray);

    return requestFields(requestFieldWithPath(arrayPrefix + "name").description(ApiModelPropertiesGeneric.NAME),
            requestFieldWithPath(arrayPrefix + "description").description(ApiModelPropertiesGeneric.DESCRPTION),
            optionalRequestFieldWithPath(arrayPrefix + "colour").description(ApiModelPropertiesGeneric.COLOUR));
}
 
Example #4
Source File: ControllerTestTemplate.java    From coderadar with MIT License 5 votes vote down vote up
/**
 * Wraps the static document() method of RestDocs and configures it to pretty print request and
 * response JSON structures.
 */
protected RestDocumentationResultHandler document(String identifier, Snippet... snippets) {
  return MockMvcRestDocumentation.document(
      identifier,
      Preprocessors.preprocessRequest(Preprocessors.prettyPrint()),
      Preprocessors.preprocessResponse(Preprocessors.prettyPrint()),
      snippets);
}
 
Example #5
Source File: WebTestClientInitializerTest.java    From spring-auto-restdocs with Apache License 2.0 5 votes vote down vote up
/**
 * Test for method
 * {@link WebTestClientInitializer#prepareSnippets(ApplicationContext)}.
 *
 * @throws IOException See {@link Snippet#document(Operation)}.
 */
@Test
public void prepareSnippets() throws IOException {

    // prepare:
    ConfigurableApplicationContext contextMock = mock(
            ConfigurableApplicationContext.class);
    ConfigurableListableBeanFactory registryMock = mock(
            ConfigurableListableBeanFactory.class);
    when(contextMock.getBeanFactory()).thenReturn(registryMock);
    DispatcherHandler dispatcherHandlerMock = mock(DispatcherHandler.class);
    when(contextMock.getBean(eq(DispatcherHandler.class)))
            .thenReturn(dispatcherHandlerMock);
    WebTestClientInitializer webTestClientInitializer = new WebTestClientInitializer();
    HandlerMethod handlerMethodMock = mock(HandlerMethod.class);
    webTestClientInitializer.supports(handlerMethodMock);
    when(contextMock.getBean(eq(WebTestClientInitializer.class)))
            .thenReturn(webTestClientInitializer);
    when(contextMock.getBean(eq(ObjectMapper.class)))
            .thenReturn(mock(ObjectMapper.class));
    when(contextMock.getBean(eq(JavadocReader.class)))
            .thenReturn(mock(JavadocReader.class));
    when(contextMock.getBean(eq(ConstraintReader.class)))
            .thenReturn(mock(ConstraintReader.class));
    Operation operationMock = mock(Operation.class);
    Map<String, Object> attributes = new HashMap<>();
    when(operationMock.getAttributes()).thenReturn(attributes);

    // perform:
    Snippet snippet = WebTestClientInitializer.prepareSnippets(contextMock);
    snippet.document(operationMock);

    // verify:
    assertNotNull(attributes.get(HandlerMethod.class.getName()));
    assertEquals(handlerMethodMock, attributes.get(HandlerMethod.class.getName()));
    assertNotNull(attributes.get(ObjectMapper.class.getName()));
    assertNotNull(attributes.get(JavadocReader.class.getName()));
    assertNotNull(attributes.get(ConstraintReader.class.getName()));
    assertNotNull(attributes.get(TypeMapping.class.getName()));
}
 
Example #6
Source File: TargetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Snippet getResponseAssignmentResult(final Target assignTarget, final Target unAssignTarget)
        throws JsonProcessingException {
    return responseFields(
            fieldWithPath("assignedTargets").description(MgmtApiModelProperties.ASSIGNED_TARGETS)
                    .type("Array[Object]"),

            fieldWithPath("unassignedTargets").description(MgmtApiModelProperties.UN_ASSIGNED_TARGETS)
                    .type("Array[Object]"));
}
 
Example #7
Source File: TargetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Snippet getResponseFieldTargetTag(final boolean isArray, final FieldDescriptor... descriptors)
        throws JsonProcessingException {
    final String arrayPrefix = getArrayPrefix(isArray);
    final List<FieldDescriptor> allFieldDescriptor = new ArrayList<>();
    allFieldDescriptor.addAll(Arrays.asList(descriptors));

    allFieldDescriptor.add(fieldWithPath(arrayPrefix + "id").description(ApiModelPropertiesGeneric.ITEM_ID));
    allFieldDescriptor.add(fieldWithPath(arrayPrefix + "name").description(ApiModelPropertiesGeneric.NAME));
    allFieldDescriptor
            .add(fieldWithPath(arrayPrefix + "description").description(ApiModelPropertiesGeneric.DESCRPTION));
    allFieldDescriptor
            .add(fieldWithPath(arrayPrefix + "createdBy").description(ApiModelPropertiesGeneric.CREATED_BY));
    allFieldDescriptor
            .add(fieldWithPath(arrayPrefix + "createdAt").description(ApiModelPropertiesGeneric.CREATED_AT));
    allFieldDescriptor.add(
            fieldWithPath(arrayPrefix + "lastModifiedBy").description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY));
    allFieldDescriptor.add(
            fieldWithPath(arrayPrefix + "lastModifiedAt").description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT));
    allFieldDescriptor.add(fieldWithPath(arrayPrefix + "colour").description(ApiModelPropertiesGeneric.COLOUR));
    allFieldDescriptor.add(fieldWithPath(arrayPrefix + "_links.self").ignored());

    if (!isArray) {
        allFieldDescriptor.add(fieldWithPath(arrayPrefix + "_links.assignedTargets")
                .description(MgmtApiModelProperties.LINKS_ASSIGNED_TARGETS));
    }

    return new DocumenationResponseFieldsSnippet(allFieldDescriptor);
}
 
Example #8
Source File: TargetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Snippet getRequestFieldsTargetTag(final boolean isArray) {
    final String arrayPrefix = getArrayPrefix(isArray);

    return requestFields(requestFieldWithPath(arrayPrefix + "name").description(ApiModelPropertiesGeneric.NAME),
            requestFieldWithPath(arrayPrefix + "description").description(ApiModelPropertiesGeneric.DESCRPTION),
            optionalRequestFieldWithPath(arrayPrefix + "colour").description(ApiModelPropertiesGeneric.COLOUR));
}
 
Example #9
Source File: DistributionSetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Snippet getResponseAssignmentResult(final DistributionSet assignment, final DistributionSet unassignment)
        throws JsonProcessingException {
    return responseFields(
            fieldWithPath("assignedDistributionSets").description(MgmtApiModelProperties.ASSIGNED_DISTRIBUTION_SETS)
                    .type("Array[Object]"),

            fieldWithPath("unassignedDistributionSets")
                    .description(MgmtApiModelProperties.UN_ASSIGNED_DISTRIBUTION_SETS).type("Array[Object]"));
}
 
Example #10
Source File: DistributionSetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Snippet getResponseFieldsTag(final boolean isArray, final FieldDescriptor... descriptors)
        throws JsonProcessingException {
    final String arrayPrefix = getArrayPrefix(isArray);
    final List<FieldDescriptor> allFieldDescriptor = new ArrayList<>();
    allFieldDescriptor.addAll(Arrays.asList(descriptors));

    allFieldDescriptor.add(fieldWithPath(arrayPrefix + "id").description(ApiModelPropertiesGeneric.ITEM_ID));
    allFieldDescriptor.add(fieldWithPath(arrayPrefix + "name").description(ApiModelPropertiesGeneric.NAME));
    allFieldDescriptor
            .add(fieldWithPath(arrayPrefix + "description").description(ApiModelPropertiesGeneric.DESCRPTION));
    allFieldDescriptor
            .add(fieldWithPath(arrayPrefix + "createdBy").description(ApiModelPropertiesGeneric.CREATED_BY));
    allFieldDescriptor
            .add(fieldWithPath(arrayPrefix + "createdAt").description(ApiModelPropertiesGeneric.CREATED_AT));
    allFieldDescriptor.add(
            fieldWithPath(arrayPrefix + "lastModifiedBy").description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY));
    allFieldDescriptor.add(
            fieldWithPath(arrayPrefix + "lastModifiedAt").description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT));
    allFieldDescriptor.add(fieldWithPath(arrayPrefix + "colour").description(ApiModelPropertiesGeneric.COLOUR));
    allFieldDescriptor.add(fieldWithPath(arrayPrefix + "_links.self").ignored());

    if (!isArray) {
        allFieldDescriptor.add(fieldWithPath(arrayPrefix + "_links.assignedDistributionSets")
                .description(MgmtApiModelProperties.LINKS_ASSIGNED_DISTRIBUTION_SETS));
    }

    return new DocumenationResponseFieldsSnippet(allFieldDescriptor);
}
 
Example #11
Source File: AbstractApiRestDocumentation.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected Snippet getFilterRequestParamter() {
    return requestParameters(
            parameterWithName("limit").attributes(key("type").value("query"))
                    .description(ApiModelPropertiesGeneric.LIMIT),
            parameterWithName("sort").description(ApiModelPropertiesGeneric.SORT),
            parameterWithName("offset").description(ApiModelPropertiesGeneric.OFFSET),
            parameterWithName("q").description(ApiModelPropertiesGeneric.FIQL));
}
 
Example #12
Source File: AbstractApiRestDocumentation.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected Snippet getResponseFieldsDistributionSet(final boolean isArray, final FieldDescriptor... descriptors) {
    final String arrayPrefix = getArrayPrefix(isArray);
    final List<FieldDescriptor> fields = Lists.newArrayList(
            fieldWithPath(arrayPrefix + "id").description(ApiModelPropertiesGeneric.ITEM_ID),
            fieldWithPath(arrayPrefix + "name").description(ApiModelPropertiesGeneric.NAME),
            fieldWithPath(arrayPrefix + "description").description(ApiModelPropertiesGeneric.DESCRPTION),
            fieldWithPath(arrayPrefix + "createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
            fieldWithPath(arrayPrefix + "createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
            fieldWithPath(arrayPrefix + "lastModifiedBy").description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY),
            fieldWithPath(arrayPrefix + "lastModifiedAt").description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT),
            fieldWithPath(arrayPrefix + "type").description(MgmtApiModelProperties.DS_TYPE),
            fieldWithPath(arrayPrefix + "requiredMigrationStep")
                    .description(MgmtApiModelProperties.DS_REQUIRED_STEP),
            fieldWithPath(arrayPrefix + "complete").description(MgmtApiModelProperties.DS_COMPLETE),
            fieldWithPath(arrayPrefix + "deleted").description(ApiModelPropertiesGeneric.DELETED),
            fieldWithPath(arrayPrefix + "version").description(MgmtApiModelProperties.VERSION),
            fieldWithPath(arrayPrefix + "_links.self").ignored(), fieldWithPath(arrayPrefix + "modules").ignored());

    fields.addAll(Arrays.asList(descriptors));

    if (!isArray) {
        fields.add(fieldWithPath(arrayPrefix + "_links.type").description(MgmtApiModelProperties.DS_TYPE));
        fields.add(fieldWithPath(arrayPrefix + "_links.metadata").description(MgmtApiModelProperties.META_DATA));
        fields.add(fieldWithPath(arrayPrefix + "_links.modules").description(MgmtApiModelProperties.SM_LIST));
    }

    return responseFields(fields);
}
 
Example #13
Source File: WireMockJsonSnippetTest.java    From restdocs-wiremock with Apache License 2.0 5 votes vote down vote up
private void verifySnippetInvocation(Snippet snippet, Map<String, Object> attributes, int times)
		throws IOException {
	ArgumentCaptor<Operation> operation = ArgumentCaptor.forClass(Operation.class);
	verify(snippet, Mockito.times(times)).document(operation.capture());
	assertThat(this.operationRequest, is(equalTo(operation.getValue().getRequest())));
	assertThat(this.operationResponse, is(equalTo(operation.getValue().getResponse())));
	assertThat(attributes, is(equalTo(operation.getValue().getAttributes())));
}
 
Example #14
Source File: RamlDocumentation.java    From restdocs-raml with MIT License 5 votes vote down vote up
public static RestDocumentationResultHandler document(String identifier,
                                                      String description,
                                                      boolean privateResource,
                                                      OperationRequestPreprocessor requestPreprocessor,
                                                      OperationResponsePreprocessor responsePreprocessor,
                                                      Snippet... snippets) {
    return document(identifier, description, privateResource, requestPreprocessor, responsePreprocessor, Function.identity(), snippets);
}
 
Example #15
Source File: TargetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private Snippet getRequestFieldsTargetAssignment(final boolean isArray) {
    final String arrayPrefix = getArrayPrefix(isArray);

    return requestFields(
            requestFieldWithPath(arrayPrefix + "controllerId").description(ApiModelPropertiesGeneric.ITEM_ID));
}
 
Example #16
Source File: RamlDocumentation.java    From restdocs-raml with MIT License 4 votes vote down vote up
public static RestDocumentationResultHandler document(String identifier,
                                                      OperationRequestPreprocessor requestPreprocessor,
                                                      Snippet... snippets) {
    return document(identifier, "", false, requestPreprocessor, null, Function.identity(), snippets);
}
 
Example #17
Source File: MockMvcBase.java    From spring-auto-restdocs with Apache License 2.0 4 votes vote down vote up
protected RestDocumentationResultHandler commonDocumentation(Snippet... snippets) {
    return document("{class-name}/{method-name}", commonResponsePreprocessor(), snippets);
}
 
Example #18
Source File: WebTestClientTestBase.java    From spring-auto-restdocs with Apache License 2.0 4 votes vote down vote up
protected <T extends ExchangeResult> Consumer<T> commonDocumentation(
        Snippet... snippets) {
    return document("{class-name}/{method-name}", preprocessRequest(),
            commonResponsePreprocessor(), snippets);
}
 
Example #19
Source File: WebTestClientInitializerTest.java    From spring-auto-restdocs with Apache License 2.0 4 votes vote down vote up
/**
 * Test for method
 * {@link WebTestClientInitializer#prepareSnippets(ApplicationContext)} in case of
 * multiple invokes.
 *
 * @throws IOException See {@link Snippet#document(Operation)}.
 */
@Test
public void prepareSnippets_multipleInvokes_singleInstance() throws IOException {

    // prepare:
    ConfigurableApplicationContext contextMock = mock(
            ConfigurableApplicationContext.class);
    ConfigurableListableBeanFactory registryMock = mock(
            ConfigurableListableBeanFactory.class);
    Map<String, WebTestClientInitializer> webTestClientInitializerBeans = new HashMap<>();
    Mockito.doAnswer(invocation -> {
        webTestClientInitializerBeans.put(invocation.getArgumentAt(0, String.class),
                invocation.getArgumentAt(1, WebTestClientInitializer.class));
        return null;
    }).when(registryMock).registerSingleton(any(), any());
    when(contextMock.getBeansOfType(eq(WebTestClientInitializer.class)))
            .then(invocation -> webTestClientInitializerBeans);
    when(contextMock.getBeanFactory()).thenReturn(registryMock);
    DispatcherHandler dispatcherHandlerMock = mock(DispatcherHandler.class);
    when(contextMock.getBean(eq(DispatcherHandler.class)))
            .thenReturn(dispatcherHandlerMock);
    Operation operationMock = mock(Operation.class);
    WebTestClientInitializer webTestClientInitializer = new WebTestClientInitializer();
    HandlerResult handlerResultMock = mock(HandlerResult.class);
    HandlerMethod handlerMethodMock = mock(HandlerMethod.class);
    Mockito.when(handlerResultMock.getHandler()).thenReturn(handlerMethodMock);
    webTestClientInitializer.supports(handlerResultMock);
    when(contextMock.getBean(eq(WebTestClientInitializer.class)))
            .thenReturn(webTestClientInitializer);

    // perform:
    Snippet snippet1 = WebTestClientInitializer.prepareSnippets(contextMock);
    snippet1.document(operationMock);
    Snippet snippet2 = WebTestClientInitializer.prepareSnippets(contextMock);
    snippet2.document(operationMock);

    // verify:
    assertNotNull(snippet1);
    assertNotNull(snippet2);
    verify(registryMock).registerSingleton(any(), any());
}
 
Example #20
Source File: RamlDocumentation.java    From restdocs-raml with MIT License 4 votes vote down vote up
public static RestDocumentationResultHandler document(String identifier,
                                                      OperationResponsePreprocessor responsePreprocessor,
                                                      Snippet... snippets) {
    return document(identifier, "", false, null, responsePreprocessor, Function.identity(), snippets);
}
 
Example #21
Source File: WebTestClientInitializer.java    From spring-auto-restdocs with Apache License 2.0 4 votes vote down vote up
/**
 * Prepare Snippets for use with the WebTestClient.
 *
 * @param context     The Spring {@link ApplicationContext}.
 * @param typeMapping custom type mappings
 * @return The Snippet. (Just a dummy, but the WebTestClient gets initialized by this
 * method)
 */
public static Snippet prepareSnippets(ApplicationContext context, TypeMapping typeMapping) {

    // Register an instance of this class as spring bean:
    if (context.getBeansOfType(WebTestClientInitializer.class).isEmpty()) {
        ((ConfigurableApplicationContext) context).getBeanFactory().registerSingleton(
                WebTestClientInitializer.class.getName(),
                new WebTestClientInitializer());

        // refresh DispatcherHandler to take this new Handler:
        context.getBean(DispatcherHandler.class).setApplicationContext(context);
    }

    // create dummy snippet:
    return operation -> {
        // put HandlerMethod in operation attributes:
        HandlerMethod handlerMethod = context
                .getBean(WebTestClientInitializer.class).handlerMethod;
        operation.getAttributes().put(HandlerMethod.class.getName(), handlerMethod);

        // put ObjectMapper in operation attributes:
        ObjectMapper objectMapper = context.getBean(ObjectMapper.class);
        operation.getAttributes().put(ObjectMapper.class.getName(), objectMapper);

        // create JavadocReader and put it in operation attributes:
        operation.getAttributes().put(JavadocReader.class.getName(),
                JavadocReaderImpl.createWithSystemProperty());

        // create ConstraintReader and put it in operation attributes:
        operation.getAttributes().put(ConstraintReader.class.getName(),
                ConstraintReaderImpl.create(objectMapper, SnippetTranslationManager.getDefaultResolver(),
                        new DynamicResourceBundleConstraintDescriptionResolver()));

        // create TypeMapping and put it in operation attributes:
        operation.getAttributes().put(TypeMapping.class.getName(),
                typeMapping);

        // copy attribute to be compatible wit MockMvc:
        String requestPattern = (String) operation.getAttributes()
                .get("org.springframework.restdocs.urlTemplate");
        if (StringUtils.isNotEmpty(requestPattern)) {
            operation.getAttributes().put("REQUEST_PATTERN", requestPattern);
        } else if (operation.getRequest() != null) {
            String path = operation.getRequest().getUri().getPath();
            String query = operation.getRequest().getUri().getQuery();
            operation.getAttributes().put("REQUEST_PATTERN",
                    path + (StringUtils.isNotEmpty(query) ? "?" + query : ""));
        }
    };
}
 
Example #22
Source File: AutoDocumentation.java    From spring-auto-restdocs with Apache License 2.0 4 votes vote down vote up
public static Snippet authorization(String defaultAuthorization) {
    return new AuthorizationSnippet(defaultAuthorization);
}
 
Example #23
Source File: AutoDocumentation.java    From spring-auto-restdocs with Apache License 2.0 4 votes vote down vote up
public static Snippet section() {
    return new SectionBuilder().build();
}
 
Example #24
Source File: OperationAttributeHelper.java    From spring-auto-restdocs with Apache License 2.0 4 votes vote down vote up
public static List<Snippet> getDefaultSnippets(Operation operation) {
    return (List<Snippet>) operation.getAttributes().get(ATTRIBUTE_NAME_DEFAULT_SNIPPETS);
}
 
Example #25
Source File: RamlDocumentation.java    From restdocs-raml with MIT License 4 votes vote down vote up
public static RestDocumentationResultHandler document(String identifier,
                                                      OperationRequestPreprocessor requestPreprocessor,
                                                      OperationResponsePreprocessor responsePreprocessor,
                                                      Snippet... snippets) {
    return document(identifier, "", false, requestPreprocessor, responsePreprocessor, Function.identity(), snippets);
}
 
Example #26
Source File: RamlDocumentation.java    From restdocs-raml with MIT License 4 votes vote down vote up
public static RestDocumentationResultHandler document(String identifier,
                                                      boolean privateResource,
                                                      OperationRequestPreprocessor requestPreprocessor,
                                                      Snippet... snippets) {
    return document(identifier, "", privateResource, requestPreprocessor, null, Function.identity(), snippets);
}
 
Example #27
Source File: RamlDocumentation.java    From restdocs-raml with MIT License 4 votes vote down vote up
public static RestDocumentationResultHandler document(String identifier,
                                                      boolean privateResource,
                                                      OperationResponsePreprocessor responsePreprocessor,
                                                      Snippet... snippets) {
    return document(identifier, "", privateResource, null, responsePreprocessor, Function.identity(), snippets);
}
 
Example #28
Source File: TargetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private Snippet getResponseFieldTargetTag(final boolean isArray) throws JsonProcessingException {
    return getResponseFieldTargetTag(isArray, new FieldDescriptor[0]);
}
 
Example #29
Source File: RamlDocumentation.java    From restdocs-raml with MIT License 4 votes vote down vote up
public static RestDocumentationResultHandler document(String identifier,
                                                      String description,
                                                      boolean privateResource,
                                                      Snippet... snippets) {
    return document(identifier, description, privateResource, null, null, Function.identity(), snippets);
}
 
Example #30
Source File: DistributionSetTagResourceDocumentationTest.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private Snippet getResponseFieldsTag(final boolean isArray) throws JsonProcessingException {
    return getResponseFieldsTag(isArray, new FieldDescriptor[0]);
}