Skip to content

Diagnostics: attribute validation (ConnectorName, OperationName, ConnectorTriggerMetadata) #40

@daviburg

Description

@daviburg

Summary

Validate [ConnectorTriggerMetadata], [ConnectorOperation], and related attribute arguments against the SDK index.

Parent: #38 | Depends on: #39 (diagnostics infrastructure)

Diagnostics

Small effort

Code Severity Diagnostic Detection
CSDK001 Error ConnectorName value doesn't match any constant in ConnectorNames class Compare attribute string value against SdkIndex.ConnectorNameConstants
CSDK002 Warning Possible typo in ConnectorName — did you mean ""X""? Levenshtein distance <= 2 against SdkConstant.Value list
CSDK003 Warning ConnectorName has wrong casing (e.g., ""Office365"" vs ""office365"") Case-insensitive match exists but case-sensitive doesn't
CSDK004 Error [ConnectorTriggerMetadata] missing required ConnectorName property Check attribute constructor/named args for presence
CSDK005 Error [ConnectorTriggerMetadata] missing required OperationName property Check attribute constructor/named args for presence
CSDK006 Warning [ConnectorTriggerMetadata] applied to non-async method Check method signature has async modifier or returns Task/Task<T>

Medium effort

Code Severity Diagnostic Detection
CSDK007 Error OperationName doesn't exist for connector ""X"" Lookup SdkIndex.TriggerOperationsByConnector[connectorName], validate operation exists
CSDK008 Warning OperationName specified without ConnectorName — cannot validate Detect presence of OperationName but missing ConnectorName
CSDK009 Warning [ConnectorOperation] attribute value doesn't match any known operation for this connector Cross-reference operation method discovery from SdkDynamicOperationsDiscovery

Implementation Notes

  • Use Roslyn SemanticModel.GetDeclaredSymbol() to get method symbols, then inspect GetAttributes()
  • Extract attribute argument values via AttributeData.ConstructorArguments and NamedArguments
  • SdkIndex.ConnectorNameConstants already provides the full list of valid connector names
  • SdkIndex.TriggerOperationsByConnector maps connector → valid trigger operations
  • For typo detection, use simple Levenshtein distance; suggest the closest match if distance <= 2

Acceptance Criteria

  • All 9 diagnostics implemented and tested
  • Diagnostics appear as squiggles on the attribute argument value (precise range)
  • Typo suggestion includes the correct value in the message
  • Unit tests with mock SdkIndex covering valid, invalid, and typo scenarios

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions