Skip to content

Use full method signature for docstring keys #6619

Description

@coderabbitai

Problem

Currently, docstring keys use only the class name and method name, causing overloaded methods to share the same key and overwrite each other's descriptions.

Current format: <fqcn>/<method>

This causes issues when multiple overloaded methods have different @ReturnDescription, @ThrowsDescription, or parameter descriptions, as they all map to the same key.

Proposed Solution

Update docstring key format to include the full method signature:

Desired format: <fqcn>/<method>(<method_signature>)

Example: com.example.MyService/myMethod(com.example.FirstParam,com.example.SecondParam)

Additional Requirements

  • Always use fully-qualified class names (FQCN) for:
    • Parameter types in method signatures
    • Return types in :return keys
    • Exception types in :throws/ keys

Example Keys

  • Method description: com.example.MyService/myMethod(java.lang.String,int)
  • Return description: com.example.MyService/myMethod(java.lang.String,int):return
  • Exception description: com.example.MyService/myMethod(java.lang.String,int):throws/com.example.CustomException
  • Parameter description: com.example.MyService/myMethod(java.lang.String,int):param/paramName

Implementation Notes

This involves two related fixes:

  1. Incorporating method signature into keys to distinguish overloads
  2. Ensuring FQCN usage throughout all docstring key components

Both should be handled together as they are interrelated.

Context

Affected Code

  • core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotatedDocServicePlugin.java
    • extractMethodDescription()
    • extractReturnDescription()
    • extractThrowsDescriptions()
    • extractParameterDescriptions()
  • Similar patterns in gRPC and Thrift plugins may need updating
  • Properties file format and parsing logic
  • UI/client code that looks up docstrings by key

Metadata

Metadata

Assignees

Labels

Type

No type
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