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:
- Incorporating method signature into keys to distinguish overloads
- 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
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
:returnkeys:throws/keysExample Keys
com.example.MyService/myMethod(java.lang.String,int)com.example.MyService/myMethod(java.lang.String,int):returncom.example.MyService/myMethod(java.lang.String,int):throws/com.example.CustomExceptioncom.example.MyService/myMethod(java.lang.String,int):param/paramNameImplementation Notes
This involves two related fixes:
Both should be handled together as they are interrelated.
Context
Affected Code
core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotatedDocServicePlugin.javaextractMethodDescription()extractReturnDescription()extractThrowsDescriptions()extractParameterDescriptions()