Watch Aspire live streamsDocsTry Aspire
Watch Aspire live streamsDocsTry

IApiReferenceExporter Methods

InterfaceMethods1 member
Optional companion to ICodeGenerator for languages that can describe their generated surface as a machine-readable API reference.
ExportApi(AtsContext, ApiReferenceExportOptions, CancellationToken)Section titled ExportApi(AtsContext, ApiReferenceExportOptions, CancellationToken)abstractJsonElement
Exports the API reference for the surface the generator would produce from the same context.
public interface IApiReferenceExporter
{
public abstract JsonElement ExportApi(
AtsContext context,
ApiReferenceExportOptions options,
CancellationToken cancellationToken)
{
// ...
}
}
contextAtsContextThe ATS context containing capabilities, types, and enums.
optionsApiReferenceExportOptions The package identity and ownership scope for the export. Assembly ownership matching follows the case-insensitive contract documented by ApiReferenceExportOptions.ExportingAssemblyNames.
cancellationTokenCancellationTokenA token to cancel the export between projected items.
JsonElement A language-defined JSON document describing the generated API. The returned element must be detached from any owning Json.JsonDocument, for example by calling JsonElement.Clone.
OperationCanceledException Thrown when cancellationToken requests cancellation.
using var document = JsonDocument.Parse(json);
return document.RootElement.Clone();