Skip to content

WebTestClient support #54

Description

@okosiuta

Hello!

Did you support WebTestClient?
Because I received an empty openapi-2.0.json:

{
  "swagger" : "2.0",
  "info" : {
    "description" : "Description",
    "version" : "0.0.1-SNAPSHOT",
    "title" : "title"
  },
  "host" : "localhost:8080",
  "tags" : [ ],
  "schemes" : [ "http" ],
  "paths" : { },
  "definitions" : { }
}

With this test:

@Test
    public void getEmployeeByName() throws Exception {
        when(edManager.searchEmployees("John")).thenReturn(getEmployees(2));
        webTestClient.get().uri("/api/employees?query={query}", "John")
                .exchange()
                .expectStatus().isOk()
                .expectBodyList(Employee.class)
                .consumeWith(document("employee/{method-name}",
                        requestParameters(parameterWithName("query").description("Employee name")),
                        responseFields(
                                fieldWithPath("[].aNumber").description("Employee's unique number"),
                                fieldWithPath("[].firstName").description("Employee's first name"),
                                fieldWithPath("[].lastName").description("Employee's lastName name"),
                                fieldWithPath("[].display").description("Employee's display"),
                                fieldWithPath("[].businessPhone").description("Employee's business phone"),
                                fieldWithPath("[].email").description("Employee's email"),
                                fieldWithPath("[].title").description("Employee's title"),
                                fieldWithPath("[].subscribedTo").description("Employee's subscriptions"),
                                fieldWithPath("[].groups").description("Employee's groups")
                        )));
    }

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions