Skip to content

[http-client-csharp] export an API for downstream emitter to call #9316

@ArcturusZhang

Description

@ArcturusZhang

Originally posted: Azure/azure-sdk-for-net#54788

Per best practice of writing an emitter or typespec library, we should have signatures like this:

getStuff(): [Stuff, readonly Diagnostic[]]

Therefore here, we are making the following changes:

  1. in emitter.ts file, wrap everything inside the if (!program.compilerOptions.noEmit && !program.hasError()) into a new function, which returns [void, readonly Diagnostic[]].
  2. refactor the createCodeModel method to make it return [CodeModel, readonly Diagnostic[]] instead. Inside the createCodeModel method, see if there are code snippets calling the reportDiagnostic method, we need to change them to append the diagnostic into the array and return it.

Metadata

Metadata

Labels

emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharp

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions