Skip to content

Commit

Permalink
CSharp Service Emitter (#2904)
Browse files Browse the repository at this point in the history
Fixes #3141

---------

Co-authored-by: Timothee Guerin <[email protected]>
Co-authored-by: Timothee Guerin <[email protected]>
  • Loading branch information
3 people authored Jul 31, 2024
1 parent 325cb47 commit 53b7a8a
Show file tree
Hide file tree
Showing 21 changed files with 4,448 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .chronus/changes/service-csharp-2024-1-12-3-50-33.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: internal
packages:
- "@typespec/http-server-csharp"
---

Initial check-in for CSharp service emitter
2 changes: 2 additions & 0 deletions packages/http-server-csharp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Change Log - @typespec/http-server-csharp

21 changes: 21 additions & 0 deletions packages/http-server-csharp/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
40 changes: 40 additions & 0 deletions packages/http-server-csharp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# @typespec/http-server-csharp

TypeSpec service code generator for c-sharp

## Install

```bash
npm install @typespec/http-server-csharp
```

## Emitter

### Usage

1. Via the command line

```bash
tsp compile . --emit=@typespec/http-server-csharp
```

2. Via the config

```yaml
emit:
- "@typespec/http-server-csharp"
```
### Emitter options
#### `skip-format`

**Type:** `boolean`

Skips formatting of generated C# Types. By default, C# files are formatted using 'dotnet format'.

#### `output-type`

**Type:** `"models" | "all"`

Chooses which service artifacts to emit. choices include 'models' or 'all' artifacts.
77 changes: 77 additions & 0 deletions packages/http-server-csharp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"name": "@typespec/http-server-csharp",
"version": "0.58.0-alpha.1",
"author": "Microsoft Corporation",
"description": "TypeSpec service code generator for c-sharp",
"homepage": "https://typespec.io",
"readme": "https://github.com/microsoft/typespec/blob/main/packages/http-server-csharp/README.md",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/typespec.git"
},
"bugs": {
"url": "https://github.com/microsoft/typespec/issues"
},
"keywords": [
"typespec",
"service",
"c-sharp"
],
"type": "module",
"main": "dist/src/index.js",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"default": "./dist/src/index.js"
},
"./testing": {
"types": "./dist/src/testing/index.d.ts",
"default": "./dist/src/testing/index.js"
}
},
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"clean": "rimraf ./dist ./temp",
"build": "tsc -p .",
"watch": "tsc -p . --watch",
"test": "vitest run",
"test:watch": "vitest -w",
"test:ui": "vitest --ui",
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
"lint": "eslint . --max-warnings=0",
"lint:fix": "eslint . --fix",
"regen-docs": "echo No doc generation for alpha version"
},
"files": [
"lib/*.tsp",
"dist/**",
"!dist/test/**"
],
"peerDependencies": {
"@typespec/compiler": "workspace:~",
"@typespec/rest": "workspace:~",
"@typespec/http": "workspace:~",
"@typespec/versioning": "workspace:~"
},
"dependencies": {
"change-case": "~5.4.4"
},
"devDependencies": {
"@typespec/compiler": "workspace:~",
"@typespec/openapi": "workspace:~",
"@typespec/rest": "workspace:~",
"@typespec/http": "workspace:~",
"@types/node": "~18.11.19",
"@typespec/library-linter": "workspace:~",
"@typespec/tspd": "workspace:~",
"@vitest/coverage-v8": "^2.0.4",
"@vitest/ui": "^2.0.4",
"c8": "^10.1.2",
"rimraf": "~6.0.1",
"typescript": "~5.5.4",
"vitest": "^2.0.4"
}
}
Loading

0 comments on commit 53b7a8a

Please sign in to comment.