microsoft / microsoft/typespec
.NET Client Patterns: Simple service description should generate client following unbranded .NET client patterns
- 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";
import "@typespec/openapi3";
@service({
title: "SimplePost",
})
namespace SimplePost;
using TypeSpec.Http;
using TypeSpec.Rest;
interface SimplePostClient {
@post @route("add") IncrementCount(@path addend: int32) : int32;
}
```
### Expected client output
- Client should have a public constructor that takes endpoint and client options
- Client constructor should validate arguments, assign endpoint, create options if needed, and create pipeline
- Convenience methods should take CancellationToken parameters
- Protocol methods should take a nullable RequestOptions parameter
- Rest file should only create instances of classifiers used by the client
- Rest file should not re-allocate a classifier that has already been allocated
- Request creation helpers should not add headers the service doesn't use
- Emitted internal helper files should not have methods that aren't used by the client
- Emitted internal helper files should be added if needed 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) 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/1
Contributor guide
Assessment
This issue has not been assessed yet.