Azure / azure-functions-java-library

Contains annotations for writing Azure Functions in Java
MIT License
42 stars 42 forks source link

Incorrect Javadoc comment in HttpTrigger.java #131

Open m-moris opened 3 years ago

m-moris commented 3 years ago

The following Javadoc describes the HttpTriger route method, but the sample described is incorrect and causes a compile error.

https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.functions.annotation.httptrigger.route?view=azure-java-stable#com_microsoft_azure_functions_annotation_HttpTrigger_route__

The correct method type is HttpResponseMessage, not HttpResponseMessage<String>.

@FunctionName("routeTest")
  public HttpResponseMessage<String> routeTest(
      @HttpTrigger(name = "req",
                    methods = {HttpMethod.GET},
                    authLevel = AuthorizationLevel.ANONYMOUS,
                    route = "products/{category:alpha}/{id:int}") 
                    HttpRequestMessage<Optional<String>> request,
      @BindingName("category") String category,
      @BindingName("id") int id,
       final ExecutionContext context
  ) {
           ....
           context.getLogger().info("We have " + category + " with id " + id);
           ....
  }

This Javadoc is probably auto-generated from the following link. Please fix it.

https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java#L140

m-moris commented 3 years ago

I found another similar part.

https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java#L36

amamounelsayed commented 3 years ago

Thank you so much @m-moris for reporting the issue. We will work with the doc team to fix it.