microsoft / microsoft/typespec

.NET Client Patterns: Service description specifying authentication should generate client following unbranded .NET client patterns

Open
#4,910 1 comment 0 reactions 0 assignees View on GitHub
emitter:client:csharp
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

### TypeSpec file:

```tsp
import "@typespec/http";
import "@typespec/rest";

@service({
title: "KeyCredentialService",
})

@useAuth(ApiKeyAuth)
namespace KeyCredentialService;

using TypeSpec.Http;
using TypeSpec.Rest;

interface KeyCredentialServiceClient {
}
```

### Expected client output

- [ ] - Client should have a public constructor that takes endpoint, credential, and client options
- [ ] - Client constructor should validate arguments, assign endpoint, create options if needed, and create pipeline
- [ ] - Client should create pipeline with authentication policy corresponding to the credential type
- [ ] - Client should not have fields for credential or client of same type
- [ ] - Rest file should not be created if not needed
- [ ] - Emitted internal helper files should not have methods that aren't used by the client
- [ ] - Nullable annotations should be used
- [ ] - No subclient factory method should be added when there are no subclients
- [ ] - No internal constructors should be added when they are not called
- [ ] - (would be nice) consts should be defined at the top of the client class definition
- [ ] - (would be nice) use file scoped namespace declarations

A diff of expected generator output compared to current generator output is here: https://github.com/annelo-msft/typespec/pull/3

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.