Azure / Azure/Connectors-NET-LSP

Auto-generate binary trigger payload handling from SDK annotations

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
0
Forks
4
Avg merge
3d 4h
Merged PRs (30d)
5

Description

## Problem

When a developer writes a trigger callback function for a binary-content trigger (e.g., OneDrive OnNewFileV2), they must manually write JsonDocument inspection code to detect the body field type and decode base64 content. This boilerplate is error-prone and non-obvious.

The AI Gateway sends binary triggers as JSON with a base64 string body:
- Binary: {"body":""}
- Metadata: {"body":{"value":[{...typed items...}]}}

Both arrive with Content-Type: application/json, so content-type sniffing does not work.

## Proposed Solution

When the LSP detects a [ConnectorTriggerMetadata] attribute referencing a binary-content trigger operation, it should:

1. Offer a CodeAction/CodeLens to generate the binary payload handling boilerplate
2. Generate the JsonDocument body-type inspection pattern
3. Generate the base64 decode + byte array extraction
4. Warn if the developer uses a typed TriggerCallbackPayload deserializer on a binary trigger

## Prerequisites

This depends on Azure/Connectors-NET-SDK#51 - the SDK needs to annotate trigger operations as binary vs metadata before the LSP can act on them.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.