feat(slicing): emit param annotations as separate ANNOTATION slices#243
Conversation
Instead of adding an annotations field to ParamDef (which changes the schema), parameter annotations are now emitted as separate ObjectUsageSlice entries with label=ANNOTATION using the existing CallDef type. Removed annotations field from ParamDef (no schema change) Changed computeUsageSlice to return List instead of Option For each MethodParameterIn annotation, emit a new ANNOTATION entry with the param name in name and annotation in resolvedMethod This preserves backward compatibility — existing tools ignore the extra entries, while new consumers can read ANNOTATION entries to discover @RequestBody, @PathVariable, @RequestParam, @RequestHeader etc.
|
I think this will make the json larger since they will never get filtered out. Can you refine the PR to retain the In general, guide it with a prompt to make only the required functional change instead of other generic changes. |
Sure @prabhu |
…arately instead of List. Param annotation slices are now collected in a separate paramAnnotationSlices function, combined in computeSlices.
Prabhu Can you check it out once I refined the PR |
| param.method -> ObjectUsageSlice( | ||
| targetObj = annDef, | ||
| definedBy = Some(annDef), | ||
| invokedCalls = List.empty, |
There was a problem hiding this comment.
Can you ask claude if we can track the self-invocation of the annotation here instead of returning an empty list?
There was a problem hiding this comment.
Can you ask claude if we can track the self-invocation of the annotation here instead of returning an empty list?
can you check out once and share your feedback?
|
Can you run |
Done @prabhu |
|
@abdul-levo did you push your changes? The test is still failing due to formatting issues. https://github.com/AppThreat/atom/actions/runs/22974943140/job/67401986301?pr=243 |
Yeah @prabhu i pushed it. |
Instead of adding an annotations field to ParamDef (which changes the schema), parameter annotations are now emitted as separate ObjectUsageSlice entries with label=ANNOTATION using the existing CallDef type.
Removed annotations field from ParamDef (no schema change) Changed computeUsageSlice to return List instead of Option For each MethodParameterIn annotation, emit a new ANNOTATION entry with the param name in name and annotation in resolvedMethod This preserves backward compatibility — existing tools ignore the extra entries, while new consumers can read ANNOTATION entries to discover @RequestBody, @PathVariable, @RequestParam, @RequestHeader etc.
Summary
Emits parameter annotations (e.g. @RequestBody, @PathVariable) as separate ObjectUsageSlice entries with label=ANNOTATION
Removes the previously added annotations field from ParamDef — no schema change
Uses existing CallDef type so downstream tools don't need parser updates
How it works
For a method like confirm(@RequestBody OrderRequest body, @RequestHeader String key):
PARAM entry for body (unchanged, same as before)
ANNOTATION entry: name=body, resolvedMethod=@RequestBody, label=ANNOTATION
ANNOTATION entry: name=key, resolvedMethod=@RequestHeader, label=ANNOTATION