Home > Enterprise >  Quarkus: How to make request @HeaderParam key as Mandatory Key
Quarkus: How to make request @HeaderParam key as Mandatory Key

Time:09-05

How to make the employeeId and employeeName both HeaderParam keys as Mandatory in Quarkus

    @POST
    @Path("/employee")
    @Produces(MediaType.APPLICATION_JSON)
    public Response SaveEmployeeDetails(@RequestBody Employee employeeObj, @HeaderParam("empId") BigInteger eemployeeId, @HeaderParam("empName") String employeeName) throws Exception {
        //Service Layer Code
    }

CodePudding user response:

As the JAX-RS specification does not provide a way to do this, your best best is to the quarkus-hibernate-validator extension and add the @javax.validation.constraints.NotNull annotation to each parameter that needs to not be null.

  • Related