OpenApiComponentAnnotationScanner.ScanFromPath method
Scan starting from a main script file path.
public static Dictionary<string, AnnotatedVariable> ScanFromPath(string mainPath,
IReadOnlyCollection<string>? attributeTypeFilter = null, string componentNameArgument = "Name",
int maxFiles = 200)
| parameter | description |
|---|---|
| mainPath | The main script file path to start scanning from. |
| attributeTypeFilter | Optional filter of attribute type names to include. If null or empty, includes all. |
| componentNameArgument | The name of the attribute argument to use as component name. |
| maxFiles | Maximum number of files to scan to prevent cycles. |
Return Value
A dictionary keyed by variable name. Each value contains the collected annotations, the declared variable type (if any), and the initializer value/expression (if any).
Exceptions
| exception | condition |
|---|---|
| InvalidOperationException | Thrown if the maximum number of files is exceeded while following dot-sourced scripts. |
Remarks
This method performs a breadth-first traversal of the script files starting from mainPath, following dot-sourced includes and extracting attribute annotations that precede variable assignments.
See Also
- class AnnotatedVariable
- class OpenApiComponentAnnotationScanner
- namespace Kestrun.OpenApi