public void configure()

in generic-examples/pojo-jar/src/main/java/org/apache/camel/OpenApiRoute.java [18:52]


    public void configure() {
        getContext().getRegistry().bind("userService", new UserService());

        restConfiguration()
                .component("platform-http")
                .bindingMode(RestBindingMode.json)
                .dataFormatProperty("prettyPrint", "true")
                .apiContextPath("/api-doc")
                .apiProperty("api.title", "User API").apiProperty("api.version", "1.2.3")
                .apiProperty("cors", "true")
                .clientRequestValidation(true);

        rest("/users").description("User rest service")
                .consumes("application/json").produces("application/json")

                .get("/{id}").description("Find user by id").outType(User.class)
                .param().name("id").type(RestParamType.path).description("The id of the user to get").dataType("integer").endParam()
                .responseMessage().code(200).message("The user").endResponseMessage()
                .to("bean:userService?method=getUser(${header.id})")

                .put().description("Updates or create a user").type(User.class)
                .param().name("body").type(RestParamType.body).description("The user to update or create").required(true).endParam()
                .responseMessage().code(200).message("User created or updated").endResponseMessage()
                .to("bean:userService?method=updateUser")

                .get().description("Find all users").outType(User[].class)
                .responseMessage().code(200).message("All users").endResponseMessage()
                .to("bean:userService?method=listUsers")

                .get("/{id}/departments/{did}").description("Find all users").outType(User[].class)
                .param().name("id").type(RestParamType.path).description("The id of the user to get").dataType("integer").endParam()
                .param().name("did").type(RestParamType.path).description("The id of the department to get").dataType("integer").required(true).endParam()
                .responseMessage().code(200).message("All users").endResponseMessage()
                .to("bean:userService?method=listUsers");
    }