@team-supercharge/oasg 18.0.1 → 18.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +210 -33
- package/bin/oasg +2 -0
- package/config.schema.yml +37 -0
- package/package.json +1 -1
- package/targets/dotnet/generate.sh +2 -11
- package/targets/dotnet/publish.sh +2 -17
- package/targets/dotnet/templates/Project.csproj.mustache +39 -0
- package/targets/dotnet-common.sh +48 -0
- package/targets/dotnet-system-text-json/generate.sh +6 -0
- package/targets/dotnet-system-text-json/generator-config.json +15 -0
- package/targets/dotnet-system-text-json/publish.sh +6 -0
- package/targets/dotnet-system-text-json/templates/netcore_project.mustache +85 -0
- package/targets/dotnet-webapi/generate.sh +2 -11
- package/targets/dotnet-webapi/publish.sh +2 -17
- package/targets/dotnet-webapi/templates/Project.csproj.mustache +61 -0
- package/targets/dotnet-webapi-system-text-json/README.md +234 -0
- package/targets/dotnet-webapi-system-text-json/generate.sh +33 -0
- package/targets/dotnet-webapi-system-text-json/generator-config.json +29 -0
- package/targets/dotnet-webapi-system-text-json/publish.sh +6 -0
- package/targets/dotnet-webapi-system-text-json/templates/Project.csproj.mustache +65 -0
- package/targets/dotnet-webapi-system-text-json/templates/controller.mustache +7 -0
- package/targets/dotnet-webapi-system-text-json/templates/endpointParam.mustache +1 -0
- package/targets/dotnet-webapi-system-text-json/templates/minimalEndpoints.mustache +118 -0
- package/targets/dotnet-webapi-system-text-json/templates/model.mustache +206 -0
- package/targets/dotnet-webapi-system-text-json/templates/paramType.mustache +1 -0
- package/targets/dotnet-webapi-system-text-json/templates/serviceCollectionExtensions.mustache +66 -0
- package/targets/react/templates/hook.mustache +29 -6
package/README.md
CHANGED
|
@@ -128,39 +128,42 @@ include:
|
|
|
128
128
|
|
|
129
129
|
The table below gives an overview of the changes (breaking, non-breaking, bug fixes) introduced in various major versions. For the resolution of breaking changes please consult the [Migration Guide](#migration-guide).
|
|
130
130
|
|
|
131
|
-
| Component
|
|
132
|
-
|
|
133
|
-
| **Internal**
|
|
134
|
-
| _Core_
|
|
135
|
-
| _Linter_
|
|
136
|
-
| **Client Targets**
|
|
137
|
-
| `android`
|
|
138
|
-
| `angular`
|
|
139
|
-
| `dotnet`
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
143
|
-
| `
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
|
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
|
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
|
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
|
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
131
|
+
| Component | | | | | | | | | | | | | | | | | | |
|
|
132
|
+
|----------------------------------|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|
|
133
|
+
| **Internal** | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|
|
134
|
+
| _Core_ |✨ |💥 |✨ |🐛 |💥 |✨ |🐛 |✨ |➖ |✨ |🐛 |🐛 |➖ |💥 |💥 |✨ |💥 |🆕 |
|
|
135
|
+
| _Linter_ |➖ |➖ |🐛 |➖ |➖ |➖ |➖ |💥 |➖ |➖ |➖ |➖ |🐛 |➖ |✨ |💥 |🆕 |
|
|
136
|
+
| **Client Targets** | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|
|
137
|
+
| `android` |✨ |➖ |➖ |➖ |🐛 |💥 |➖ |➖ |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
|
138
|
+
| `angular` |➖ |➖ |✨ |➖ |🐛 |💥 |➖ |➖ |➖ |🐛 |➖ |➖ |➖ |💥 |➖ |➖ |➖ |🆕 |
|
|
139
|
+
| `dotnet` |✨ |➖ |➖ |➖ |🆕 |
|
|
140
|
+
| `dotnet-system-text-json` |🆕➖|
|
|
141
|
+
| `dotnet-webapi` |✨ |➖ |🆕➖|
|
|
142
|
+
| `dotnet-webapi-system-text-json` |🆕➖|
|
|
143
|
+
| `feign` |➖ |🐛 |✨ |➖ |➖ |➖ |➖ |➖ |✨ |💥 |💥 |➖ |➖ |🐛 |🐛 |🆕 |
|
|
144
|
+
| `feign-kotlin` |➖ |🐛 |✨ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
|
145
|
+
| `plain-java` |➖ |🐛 |🆕 |
|
|
146
|
+
| `flutter` |➖ |➖ |➖ |➖ |➖ |🆕 |
|
|
147
|
+
| `ios` |➖ |➖ |➖ |➖ |➖ |💥 |🐛 |➖ |➖ |➖ |✨ |➖ |💥 |➖ |➖ |✨ |🆕 |
|
|
148
|
+
| `apple-swift` |➖ |➖ |🆕 |
|
|
149
|
+
| `kmp` |✨ |✨ |➖ |➖ |🆕 |
|
|
150
|
+
| `python` |➖ |➖ |🆕 |
|
|
151
|
+
| `python-legacy` |➖ |➖ |💥 |➖ |🐛 |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
|
152
|
+
| `react` |💥 |➖ |🐛 |🐛 |➖ |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
|
153
|
+
| `typescript-axios` |✨ |➖ |🆕 |
|
|
154
|
+
| `typescript-fetch` |✨ |➖ |🆕 |
|
|
155
|
+
| **Server Targets** | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|
|
156
|
+
| `nestjs` |✨ |🐛 |💥 |💥 |➖ |💥 |✨ |➖ |➖ |🐛 |➖ |➖ |✨ |🆕 |
|
|
157
|
+
| `python-fastapi` |➖ |➖ |➖ |➖ |🆕 |
|
|
158
|
+
| `python-fastapi-raw-request` |➖ |➖ |➖ |➖ |🆕 |
|
|
159
|
+
| `spring` |➖ |🐛 |✨ |➖ |➖ |➖ |➖ |➖ |✨ |💥 |💥 |➖ |➖ |➖ |✨ |➖ |🆕 |
|
|
160
|
+
| `spring-kotlin` |➖ |✨ |✨ |➖ |➖ |➖ |➖ |➖ |✨ |💥 |💥 |➖ |➖ |🐛 |✨ |➖ |🆕 |
|
|
161
|
+
| **Misc Targets** | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
|
|
162
|
+
| `contract-testing` |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
|
|
163
|
+
| `openapi` |➖ |➖ |➖ |➖ |➖ |➖ |💥 |➖ |➖ |✨ |➖ |🆕 |
|
|
164
|
+
| `stubby` |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |💥 |➖ |➖ |➖ |➖ |🆕 |
|
|
165
|
+
| `postman` |➖ |➖ |➖ |🆕 |
|
|
166
|
+
| `msw` |🆕 |
|
|
164
167
|
|
|
165
168
|
**Legend:**
|
|
166
169
|
|
|
@@ -1190,6 +1193,180 @@ Validations from OpenAPI spec:
|
|
|
1190
1193
|
| apiKey | Api key of nuget source (If not specified, provide the CI_JOB_TOKEN) | N | - |
|
|
1191
1194
|
| generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
|
|
1192
1195
|
|
|
1196
|
+
#### `dotnet-system-text-json`
|
|
1197
|
+
|
|
1198
|
+
An AOT-oriented C# **client library**. Unlike `dotnet` (which uses the
|
|
1199
|
+
`csharp-functions` generator and produces an Azure Functions app serialized with
|
|
1200
|
+
Newtonsoft.Json), this target uses the `csharp` generator's `generichost`
|
|
1201
|
+
library: an `HttpClient` + .NET Generic Host (dependency-injection) **host API**,
|
|
1202
|
+
serialized with **System.Text.Json source generation** (a `JsonSerializerContext`
|
|
1203
|
+
per model — no Newtonsoft, no reflection-based serialization).
|
|
1204
|
+
|
|
1205
|
+
The generated project targets **.NET 10** and is marked
|
|
1206
|
+
`<IsAotCompatible>true</IsAotCompatible>`, so the trim/AOT analyzers run against
|
|
1207
|
+
consumers.
|
|
1208
|
+
|
|
1209
|
+
```json
|
|
1210
|
+
{
|
|
1211
|
+
"id": "dotnet-system-text-json",
|
|
1212
|
+
"type": "dotnet-system-text-json",
|
|
1213
|
+
"source": "source-merged",
|
|
1214
|
+
"sourceUrl": "https://api.nuget.org/v3/index.json",
|
|
1215
|
+
"apiKey": "apiKey",
|
|
1216
|
+
"packageName": "packageName"
|
|
1217
|
+
}
|
|
1218
|
+
```
|
|
1219
|
+
|
|
1220
|
+
| Parameter | Description | Required | Default |
|
|
1221
|
+
| ------------------- | ------------------------------------------------------------------------------ | -------- | ------- |
|
|
1222
|
+
| sourceUrl | Url to where the package will be published | Y | - |
|
|
1223
|
+
| apiKey | Api key of nuget source | Y | - |
|
|
1224
|
+
| packageName | Name of the generated package | Y | - |
|
|
1225
|
+
| generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
|
|
1226
|
+
|
|
1227
|
+
> **AOT status — AOT-capable, not certified warning-clean.** Newtonsoft is gone
|
|
1228
|
+
> and every generated **model** has a source-generated `JsonSerializerContext`,
|
|
1229
|
+
> which is the core requirement for trimming/Native AOT. However, the upstream
|
|
1230
|
+
> `generichost` serialization is a deliberate **hybrid**: the JSON options
|
|
1231
|
+
> combine the source-gen model contexts with a reflection
|
|
1232
|
+
> `DefaultJsonTypeInfoResolver()` fallback (plus a reflection
|
|
1233
|
+
> `JsonStringEnumConverter`) to handle types the contexts don't cover —
|
|
1234
|
+
> `List<T>` responses, dictionaries, primitives, enums. Because of that fallback
|
|
1235
|
+
> the build emits `IL2026`/`IL3050` trim/AOT analyzer warnings.
|
|
1236
|
+
>
|
|
1237
|
+
> These warnings are inherent to the generator (unchanged through 7.17.0), not
|
|
1238
|
+
> something a template override fixes cleanly: removing the fallback would break
|
|
1239
|
+
> at runtime for any uncovered type, and routing calls so the analyzer goes
|
|
1240
|
+
> quiet would only hide that risk. So a consumer can use this package and its
|
|
1241
|
+
> source-gen model paths are AOT-safe, but a full Native-AOT publish is **not
|
|
1242
|
+
> guaranteed** for every spec shape. `<IsAotCompatible>true</IsAotCompatible>`
|
|
1243
|
+
> is set so consumers see those analyzer warnings rather than discovering the
|
|
1244
|
+
> gaps at runtime.
|
|
1245
|
+
|
|
1246
|
+
#### `dotnet-webapi-system-text-json`
|
|
1247
|
+
|
|
1248
|
+
A server-stub library (`aspnetcore` generator, `buildTarget=library`) serialized
|
|
1249
|
+
with **System.Text.Json**, targeting **.NET 10** and marked
|
|
1250
|
+
`<IsAotCompatible>true</IsAotCompatible>`. Operations are exposed as
|
|
1251
|
+
**minimal-API endpoints** (Native-AOT compatible) rather than MVC controllers.
|
|
1252
|
+
|
|
1253
|
+
```json
|
|
1254
|
+
{
|
|
1255
|
+
"id": "dotnet-webapi-system-text-json",
|
|
1256
|
+
"type": "dotnet-webapi-system-text-json",
|
|
1257
|
+
"source": "source-merged",
|
|
1258
|
+
"sourceUrl": "https://api.nuget.org/v3/index.json",
|
|
1259
|
+
"apiKey": "apiKey",
|
|
1260
|
+
"packageName": "packageName"
|
|
1261
|
+
}
|
|
1262
|
+
```
|
|
1263
|
+
|
|
1264
|
+
| Parameter | Description | Required | Default |
|
|
1265
|
+
| --------------------------- | ------------------------------------------------------------------------------ | -------- | ------- |
|
|
1266
|
+
| sourceUrl | Url to where the package will be published | Y | - |
|
|
1267
|
+
| packageName | Name of the generated package | Y | - |
|
|
1268
|
+
| apiKey | Api key of nuget source (If not specified, provide the CI_JOB_TOKEN) | N | - |
|
|
1269
|
+
| withWolverineImplementation | Make the minimal-API endpoints invoke Wolverine directly (see below) | N | `false` |
|
|
1270
|
+
| generatorCustomArgs | Custom arguments of the generator (--global-property, --additional-properties) | N | - |
|
|
1271
|
+
|
|
1272
|
+
> **Minimal API + Native AOT.** A single `EndpointRouteBuilderExtensions.cs`
|
|
1273
|
+
> (generated once via a `files` SupportingFiles template) holds an `I{ApiName}`
|
|
1274
|
+
> interface per API, a `Map{ApiName}Endpoints()` per API, and an aggregate
|
|
1275
|
+
> `MapAll{PackageName}Endpoints()` that calls them all — mapping the operations as
|
|
1276
|
+
> minimal-API endpoints delegating to the DI-resolved implementation. The host
|
|
1277
|
+
> implements each `I{ApiName}` and calls `app.MapAll{PackageName}Endpoints()`; the
|
|
1278
|
+
> abstract MVC controllers are suppressed.
|
|
1279
|
+
>
|
|
1280
|
+
> The model/DTO layer is also AOT-clean: each model emits a source-generated
|
|
1281
|
+
> `JsonSerializerContext` and its `ToJson()` serializes through it (no Newtonsoft,
|
|
1282
|
+
> no reflection `JsonSerializer`). Minimal APIs are Native-AOT compatible (unlike
|
|
1283
|
+
> MVC), so combined with the source-generated models this server can be
|
|
1284
|
+
> Native-AOT published.
|
|
1285
|
+
>
|
|
1286
|
+
> The host must also register the package's JSON options so enums deserialize by
|
|
1287
|
+
> their `[EnumMember]` wire value (e.g. `"available"`), which the minimal-API STJ
|
|
1288
|
+
> pipeline does not do out of the box:
|
|
1289
|
+
>
|
|
1290
|
+
> ```csharp
|
|
1291
|
+
> builder.Services.Add{PackageName}JsonOptions();
|
|
1292
|
+
> ```
|
|
1293
|
+
|
|
1294
|
+
##### `withWolverineImplementation`
|
|
1295
|
+
|
|
1296
|
+
When `true`, the generated minimal-API endpoints invoke [Wolverine](https://wolverinefx.net)
|
|
1297
|
+
**directly** instead of delegating to the `I{ApiName}` interfaces — there are no
|
|
1298
|
+
`I{ApiName}` interfaces in this mode. The single `EndpointRouteBuilderExtensions.cs`
|
|
1299
|
+
instead contains:
|
|
1300
|
+
|
|
1301
|
+
- **A request wrapper per operation** — `public record AddPetRequest(Pet pet);`,
|
|
1302
|
+
`public record GetPetByIdRequest(long petId);`, etc. Each bundles **all** of the
|
|
1303
|
+
operation's parameters (path, query, header, body), so two operations never
|
|
1304
|
+
collide on a shared request/response type and every parameter is carried
|
|
1305
|
+
(including for file uploads).
|
|
1306
|
+
- **`Map{ApiName}Endpoints()`** (one per API), plus an aggregate
|
|
1307
|
+
**`MapAll{PackageName}Endpoints()`** that calls them all — each endpoint invokes
|
|
1308
|
+
the request through Wolverine and returns the result:
|
|
1309
|
+
```csharp
|
|
1310
|
+
endpoints.MapPost("/api/v3/pet",
|
|
1311
|
+
async ([FromBody] Pet pet, [FromServices] IMessageBus messageBus, CancellationToken ct) =>
|
|
1312
|
+
Results.Ok(await messageBus.InvokeAsync<Pet>(new AddPetRequest(pet), ct)));
|
|
1313
|
+
```
|
|
1314
|
+
Operations with no response body return `Results.NoContent()`; secured
|
|
1315
|
+
operations get `.RequireAuthorization()`.
|
|
1316
|
+
- **`ConfigureWolverineMessaging(this WolverineOptions options, string localQueueName = "PackageName")`** —
|
|
1317
|
+
one method that routes every request type in the assembly to a local queue (the
|
|
1318
|
+
queue name is a parameter).
|
|
1319
|
+
|
|
1320
|
+
The `WolverineFx` package reference is added automatically.
|
|
1321
|
+
|
|
1322
|
+
**Host wiring** the consumer provides:
|
|
1323
|
+
|
|
1324
|
+
```csharp
|
|
1325
|
+
builder.Host.UseWolverine(opts =>
|
|
1326
|
+
{
|
|
1327
|
+
opts.ConfigureWolverineMessaging(); // or pass a custom queue name
|
|
1328
|
+
|
|
1329
|
+
// Static codegen (see below). Pre-generate with `dotnet run -- codegen write`.
|
|
1330
|
+
opts.CodeGeneration.TypeLoadMode = JasperFx.CodeGeneration.TypeLoadMode.Static;
|
|
1331
|
+
});
|
|
1332
|
+
|
|
1333
|
+
var app = builder.Build();
|
|
1334
|
+
app.MapAll{PackageName}Endpoints(); // aggregate; or call Map{ApiName}Endpoints() individually
|
|
1335
|
+
```
|
|
1336
|
+
|
|
1337
|
+
The host also provides a **handler for each `*Request` type** (Wolverine discovers
|
|
1338
|
+
them by convention), e.g. `public Task<Pet> Handle(AddPetRequest request) { ... }`.
|
|
1339
|
+
|
|
1340
|
+
**Static codegen.** Set `TypeLoadMode.Static` in the host (above) so Wolverine
|
|
1341
|
+
does **not** compile handler code at runtime, and pre-generate it as part of your
|
|
1342
|
+
build/deploy, e.g. `dotnet run -- codegen write` (or, to opt back into runtime
|
|
1343
|
+
compilation, drop that line and reference `WolverineFx.RuntimeCompilation`).
|
|
1344
|
+
|
|
1345
|
+
**No retries / error handling.** Wolverine scopes retry rules per message type on
|
|
1346
|
+
the **handler**, not on the routing options, so `ConfigureWolverineMessaging`
|
|
1347
|
+
does not set a retry policy. Disable retries per handler where you want
|
|
1348
|
+
fail-fast, e.g.:
|
|
1349
|
+
|
|
1350
|
+
```csharp
|
|
1351
|
+
public static class AddPetRequestHandler
|
|
1352
|
+
{
|
|
1353
|
+
public static void Configure(HandlerChain chain) => chain.OnAnyException().Discard();
|
|
1354
|
+
public Task<Pet> Handle(AddPetRequest request) { ... }
|
|
1355
|
+
}
|
|
1356
|
+
```
|
|
1357
|
+
|
|
1358
|
+
With no retries, a handler exception propagates straight back through
|
|
1359
|
+
`InvokeAsync` into the endpoint, where you map it to an HTTP response host-side
|
|
1360
|
+
(`IExceptionHandler` + `AddProblemDetails()`).
|
|
1361
|
+
|
|
1362
|
+
> **File uploads.** The wrapper carries every parameter, so a file operation's
|
|
1363
|
+
> path/query parameters reach the handler alongside the body (unlike sending the
|
|
1364
|
+
> body alone). The body itself is carried as a `System.IO.Stream`, which works
|
|
1365
|
+
> for the in-process local-queue routing used here (passed by reference). A
|
|
1366
|
+
> `Stream` is **not** serializable, so if you re-route these requests to a remote
|
|
1367
|
+
> transport (RabbitMQ, Azure Service Bus, …) the file body would not serialize —
|
|
1368
|
+
> buffer it to a `byte[]` in that case.
|
|
1369
|
+
|
|
1193
1370
|
#### `postman`
|
|
1194
1371
|
|
|
1195
1372
|
```json
|
package/bin/oasg
CHANGED
|
@@ -57,7 +57,9 @@ const DEFAULT_GENERATOR_MAPPING = {
|
|
|
57
57
|
"python-fastapi": { version: '7.8.0', generator: 'python-fastapi' },
|
|
58
58
|
"python-fastapi-raw-request": { version: '7.0.1', generator: 'python-fastapi' },
|
|
59
59
|
"dotnet": { version: '7.11.0', generator: 'csharp-functions' },
|
|
60
|
+
"dotnet-system-text-json": { version: '7.11.0', generator: 'csharp' },
|
|
60
61
|
"dotnet-webapi": { version: '7.11.0', generator: 'aspnetcore' },
|
|
62
|
+
"dotnet-webapi-system-text-json": { version: '7.11.0', generator: 'aspnetcore' },
|
|
61
63
|
// misc targets
|
|
62
64
|
"contract-testing": { version: '4.3.1', generator: 'typescript-node' },
|
|
63
65
|
"openapi": { version: undefined, generator: undefined },
|
package/config.schema.yml
CHANGED
|
@@ -34,7 +34,9 @@ properties:
|
|
|
34
34
|
- $ref: '#/targets/Flutter'
|
|
35
35
|
- $ref: '#/targets/Kmp'
|
|
36
36
|
- $ref: '#/targets/Dotnet'
|
|
37
|
+
- $ref: '#/targets/DotnetSystemTextJson'
|
|
37
38
|
- $ref: '#/targets/DotnetWebApi'
|
|
39
|
+
- $ref: '#/targets/DotnetWebApiSystemTextJson'
|
|
38
40
|
- $ref: '#/targets/Postman'
|
|
39
41
|
- $ref: '#/targets/TypeScriptAxios'
|
|
40
42
|
- $ref: '#/targets/TypeScriptFetch'
|
|
@@ -456,6 +458,23 @@ targets:
|
|
|
456
458
|
- apiKey
|
|
457
459
|
- packageName
|
|
458
460
|
|
|
461
|
+
DotnetSystemTextJson:
|
|
462
|
+
allOf:
|
|
463
|
+
- $ref: '#/targets/Base'
|
|
464
|
+
- properties:
|
|
465
|
+
type:
|
|
466
|
+
pattern: '^dotnet-system-text-json$'
|
|
467
|
+
sourceUrl:
|
|
468
|
+
type: string
|
|
469
|
+
apiKey:
|
|
470
|
+
type: string
|
|
471
|
+
packageName:
|
|
472
|
+
type: string
|
|
473
|
+
required:
|
|
474
|
+
- sourceUrl
|
|
475
|
+
- apiKey
|
|
476
|
+
- packageName
|
|
477
|
+
|
|
459
478
|
DotnetWebApi:
|
|
460
479
|
allOf:
|
|
461
480
|
- $ref: '#/targets/Base'
|
|
@@ -472,6 +491,24 @@ targets:
|
|
|
472
491
|
- sourceUrl
|
|
473
492
|
- packageName
|
|
474
493
|
|
|
494
|
+
DotnetWebApiSystemTextJson:
|
|
495
|
+
allOf:
|
|
496
|
+
- $ref: '#/targets/Base'
|
|
497
|
+
- properties:
|
|
498
|
+
type:
|
|
499
|
+
pattern: '^dotnet-webapi-system-text-json$'
|
|
500
|
+
sourceUrl:
|
|
501
|
+
type: string
|
|
502
|
+
apiKey:
|
|
503
|
+
type: string
|
|
504
|
+
packageName:
|
|
505
|
+
type: string
|
|
506
|
+
withWolverineImplementation:
|
|
507
|
+
type: boolean
|
|
508
|
+
required:
|
|
509
|
+
- sourceUrl
|
|
510
|
+
- packageName
|
|
511
|
+
|
|
475
512
|
Kmp:
|
|
476
513
|
allOf:
|
|
477
514
|
- $ref: '#/targets/Base'
|
package/package.json
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
source $(dirname "$0")/../common.sh
|
|
4
|
+
source $(dirname "$0")/../dotnet-common.sh
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
mkdir -p out/$targetId
|
|
7
|
-
|
|
8
|
-
java -jar $binary generate \
|
|
9
|
-
-g $generatorId \
|
|
10
|
-
-i $openApiFile \
|
|
11
|
-
-t $templateDir \
|
|
12
|
-
-o out/$targetId \
|
|
13
|
-
-c $(dirname "$0")/generator-config.json \
|
|
14
|
-
-p "packageVersion=$version,packageName=$packageName" \
|
|
15
|
-
$generatorCustomArgs
|
|
6
|
+
dotnet_generate
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
source $(dirname "$0")/../common.sh
|
|
4
|
+
source $(dirname "$0")/../dotnet-common.sh
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# install dotnet
|
|
8
|
-
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
|
|
9
|
-
chmod +x dotnet-install.sh
|
|
10
|
-
./dotnet-install.sh --channel 6.0 --install-dir "$HOME/.dotnet"
|
|
11
|
-
export PATH="$HOME/.dotnet:$PATH"
|
|
12
|
-
|
|
13
|
-
# pack
|
|
14
|
-
dotnet restore
|
|
15
|
-
dotnet build -c Release
|
|
16
|
-
dotnet pack -c Release -p:Version=$version -p:IsPackable=true
|
|
17
|
-
|
|
18
|
-
# publish
|
|
19
|
-
dotnet nuget push "src/**/bin/Release/*.nupkg" --source $sourceUrl -k ${apiKey:-$CI_JOB_TOKEN}
|
|
20
|
-
|
|
21
|
-
cd ../..
|
|
6
|
+
dotnet_publish
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
<PropertyGroup>
|
|
3
|
+
<Description>{{packageDescription}}{{^packageDescription}}{{packageName}}{{/packageDescription}}</Description>
|
|
4
|
+
<Copyright>{{packageCopyright}}</Copyright>
|
|
5
|
+
<Authors>{{packageAuthors}}</Authors>
|
|
6
|
+
<TargetFramework>net10.0</TargetFramework>
|
|
7
|
+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
8
|
+
<PreserveCompilationContext>true</PreserveCompilationContext>
|
|
9
|
+
<Version>{{packageVersion}}</Version>
|
|
10
|
+
<AzureFunctionsVersion>{{azureFunctionsVersion}}</AzureFunctionsVersion>
|
|
11
|
+
{{#nullableReferenceTypes}}
|
|
12
|
+
<Nullable>annotations</Nullable>
|
|
13
|
+
{{/nullableReferenceTypes}}
|
|
14
|
+
{{#isLibrary}}
|
|
15
|
+
<OutputType>Library</OutputType>
|
|
16
|
+
{{/isLibrary}}
|
|
17
|
+
<AssemblyName>{{packageName}}</AssemblyName>
|
|
18
|
+
<PackageId>{{packageName}}</PackageId>
|
|
19
|
+
<UserSecretsId>{{userSecretsGuid}}</UserSecretsId>
|
|
20
|
+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
|
21
|
+
<DockerfileContext>..\..</DockerfileContext>
|
|
22
|
+
</PropertyGroup>
|
|
23
|
+
<ItemGroup>
|
|
24
|
+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.1" />
|
|
25
|
+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi.Core" Version="1.0.0" />
|
|
26
|
+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="{{functionsSDKVersion}}" />
|
|
27
|
+
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
|
|
28
|
+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="0.7.2-preview" />
|
|
29
|
+
</ItemGroup>
|
|
30
|
+
<ItemGroup>
|
|
31
|
+
<None Update="host.json">
|
|
32
|
+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
33
|
+
</None>
|
|
34
|
+
<None Update="local.settings.json">
|
|
35
|
+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
36
|
+
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
|
|
37
|
+
</None>
|
|
38
|
+
</ItemGroup>
|
|
39
|
+
</Project>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Shared build/publish logic for the .NET targets (dotnet, dotnet-webapi and
|
|
4
|
+
# their -system-text-json variants). Each target's generate.sh / publish.sh is a
|
|
5
|
+
# thin wrapper that sources ../common.sh (to populate the positional args) and
|
|
6
|
+
# this file, then calls one of the functions below.
|
|
7
|
+
#
|
|
8
|
+
# These functions rely on the variables exported by common.sh (targetId, binary,
|
|
9
|
+
# generatorId, openApiFile, version, templateDir, sourceUrl, apiKey, ...). They
|
|
10
|
+
# use $0 — the calling wrapper script — to locate the target's own directory, so
|
|
11
|
+
# generator-config.json resolves to the wrapper's target, not to this file.
|
|
12
|
+
|
|
13
|
+
dotnet_generate() {
|
|
14
|
+
local targetDir
|
|
15
|
+
targetDir=$(dirname "$0")
|
|
16
|
+
|
|
17
|
+
rm -rf out/$targetId
|
|
18
|
+
mkdir -p out/$targetId
|
|
19
|
+
|
|
20
|
+
java -jar $binary generate \
|
|
21
|
+
-g $generatorId \
|
|
22
|
+
-i $openApiFile \
|
|
23
|
+
-t $templateDir \
|
|
24
|
+
-o out/$targetId \
|
|
25
|
+
-c "$targetDir/generator-config.json" \
|
|
26
|
+
-p "packageVersion=$version,packageName=$packageName" \
|
|
27
|
+
$generatorCustomArgs
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
dotnet_publish() {
|
|
31
|
+
cd out/$targetId
|
|
32
|
+
|
|
33
|
+
# install dotnet
|
|
34
|
+
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
|
|
35
|
+
chmod +x dotnet-install.sh
|
|
36
|
+
./dotnet-install.sh --channel 10.0 --install-dir "$HOME/.dotnet"
|
|
37
|
+
export PATH="$HOME/.dotnet:$PATH"
|
|
38
|
+
|
|
39
|
+
# pack
|
|
40
|
+
dotnet restore
|
|
41
|
+
dotnet build -c Release
|
|
42
|
+
dotnet pack -c Release -p:Version=$version -p:IsPackable=true
|
|
43
|
+
|
|
44
|
+
# publish
|
|
45
|
+
dotnet nuget push "src/**/bin/Release/*.nupkg" --source $sourceUrl -k ${apiKey:-$CI_JOB_TOKEN}
|
|
46
|
+
|
|
47
|
+
cd ../..
|
|
48
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"inlineSchemaOptions": {
|
|
3
|
+
"ARRAY_ITEM_SUFFIX": "",
|
|
4
|
+
"MAP_ITEM_SUFFIX": "",
|
|
5
|
+
"SKIP_SCHEMA_REUSE": "true"
|
|
6
|
+
},
|
|
7
|
+
"additionalProperties": {
|
|
8
|
+
"library": "generichost",
|
|
9
|
+
"useSourceGeneration": true,
|
|
10
|
+
"targetFramework": "net9.0",
|
|
11
|
+
"nullableReferenceTypes": true,
|
|
12
|
+
"enumNameSuffix": "",
|
|
13
|
+
"enumValueSuffix": ""
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
|
|
3
|
+
<PropertyGroup>{{#useGenericHost}}
|
|
4
|
+
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> <!-- setting GenerateAssemblyInfo to false causes this bug https://github.com/dotnet/project-system/issues/3934 -->{{/useGenericHost}}{{^useGenericHost}}
|
|
5
|
+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo><!-- setting GenerateAssemblyInfo to false causes this bug https://github.com/dotnet/project-system/issues/3934 -->{{/useGenericHost}}
|
|
6
|
+
<TargetFramework>net10.0</TargetFramework>
|
|
7
|
+
<IsAotCompatible>true</IsAotCompatible>
|
|
8
|
+
<AssemblyName>{{packageName}}</AssemblyName>
|
|
9
|
+
<PackageId>{{packageName}}</PackageId>
|
|
10
|
+
<OutputType>Library</OutputType>
|
|
11
|
+
<Authors>{{packageAuthors}}</Authors>
|
|
12
|
+
<Company>{{packageCompany}}</Company>
|
|
13
|
+
<AssemblyTitle>{{packageTitle}}</AssemblyTitle>
|
|
14
|
+
<Description>{{packageDescription}}</Description>
|
|
15
|
+
<Copyright>{{packageCopyright}}</Copyright>
|
|
16
|
+
<RootNamespace>{{packageName}}</RootNamespace>
|
|
17
|
+
<Version>{{packageVersion}}</Version>
|
|
18
|
+
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\{{packageName}}.xml</DocumentationFile>{{#licenseId}}
|
|
19
|
+
<PackageLicenseExpression>{{.}}</PackageLicenseExpression>{{/licenseId}}
|
|
20
|
+
<RepositoryUrl>https://{{{gitHost}}}/{{{gitUserId}}}/{{{gitRepoId}}}.git</RepositoryUrl>
|
|
21
|
+
<RepositoryType>git</RepositoryType>{{#releaseNote}}
|
|
22
|
+
<PackageReleaseNotes>{{.}}</PackageReleaseNotes>{{/releaseNote}}{{#packageTags}}
|
|
23
|
+
<PackageTags>{{{.}}}</PackageTags>{{/packageTags}}{{#nrt}}
|
|
24
|
+
<Nullable>{{#useGenericHost}}enable{{/useGenericHost}}{{^useGenericHost}}annotations{{/useGenericHost}}</Nullable>{{/nrt}}
|
|
25
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
|
26
|
+
</PropertyGroup>
|
|
27
|
+
|
|
28
|
+
<ItemGroup>
|
|
29
|
+
{{#useCompareNetObjects}}
|
|
30
|
+
<PackageReference Include="CompareNETObjects" Version="4.83.0" />
|
|
31
|
+
{{/useCompareNetObjects}}
|
|
32
|
+
{{^useGenericHost}}
|
|
33
|
+
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
|
|
34
|
+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
35
|
+
{{/useGenericHost}}
|
|
36
|
+
{{#useRestSharp}}
|
|
37
|
+
<PackageReference Include="RestSharp" Version="112.0.0" />
|
|
38
|
+
{{/useRestSharp}}
|
|
39
|
+
{{#useGenericHost}}
|
|
40
|
+
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.0" />
|
|
41
|
+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
|
|
42
|
+
{{#supportsRetry}}
|
|
43
|
+
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="10.0.0" />
|
|
44
|
+
{{/supportsRetry}}
|
|
45
|
+
{{#net80OrLater}}
|
|
46
|
+
<PackageReference Include="Microsoft.Net.Http.Headers" Version="10.0.0" />
|
|
47
|
+
{{/net80OrLater}}
|
|
48
|
+
{{^net60OrLater}}
|
|
49
|
+
<PackageReference Include="System.Threading.Channels" Version="8.0.0" />
|
|
50
|
+
{{#net47OrLater}}
|
|
51
|
+
<Reference Include="System.Web" />
|
|
52
|
+
{{/net47OrLater}}
|
|
53
|
+
{{/net60OrLater}}
|
|
54
|
+
{{/useGenericHost}}
|
|
55
|
+
{{^useGenericHost}}
|
|
56
|
+
{{#supportsRetry}}
|
|
57
|
+
<PackageReference Include="Polly" Version="{{^netStandard}}8.1.0{{/netStandard}}{{#netStandard}}8.1.0{{/netStandard}}" />
|
|
58
|
+
{{/supportsRetry}}
|
|
59
|
+
{{/useGenericHost}}
|
|
60
|
+
{{#validatable}}
|
|
61
|
+
{{^net60OrLater}}
|
|
62
|
+
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
|
63
|
+
{{/net60OrLater}}
|
|
64
|
+
{{/validatable}}
|
|
65
|
+
</ItemGroup>
|
|
66
|
+
|
|
67
|
+
{{^useGenericHost}}
|
|
68
|
+
<ItemGroup>
|
|
69
|
+
{{^net60OrLater}}
|
|
70
|
+
<None Remove="System.Web" />
|
|
71
|
+
{{/net60OrLater}}
|
|
72
|
+
{{#net48}}
|
|
73
|
+
<None Remove="System.Net.Http" />
|
|
74
|
+
{{/net48}}
|
|
75
|
+
</ItemGroup>
|
|
76
|
+
<ItemGroup>
|
|
77
|
+
{{^net60OrLater}}
|
|
78
|
+
<Reference Include="System.Web" />
|
|
79
|
+
{{/net60OrLater}}
|
|
80
|
+
{{#net48}}
|
|
81
|
+
<Reference Include="System.Net.Http" />
|
|
82
|
+
{{/net48}}
|
|
83
|
+
</ItemGroup>
|
|
84
|
+
{{/useGenericHost}}
|
|
85
|
+
{{>netcore_project.additions}}</Project>
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
source $(dirname "$0")/../common.sh
|
|
4
|
+
source $(dirname "$0")/../dotnet-common.sh
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
mkdir -p out/$targetId
|
|
7
|
-
|
|
8
|
-
java -jar $binary generate \
|
|
9
|
-
-g $generatorId \
|
|
10
|
-
-i $openApiFile \
|
|
11
|
-
-t $templateDir \
|
|
12
|
-
-o out/$targetId \
|
|
13
|
-
-c $(dirname "$0")/generator-config.json \
|
|
14
|
-
-p "packageVersion=$version,packageName=$packageName" \
|
|
15
|
-
$generatorCustomArgs
|
|
6
|
+
dotnet_generate
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
source $(dirname "$0")/../common.sh
|
|
4
|
+
source $(dirname "$0")/../dotnet-common.sh
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# install dotnet
|
|
8
|
-
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
|
|
9
|
-
chmod +x dotnet-install.sh
|
|
10
|
-
./dotnet-install.sh --channel 8.0 --install-dir "$HOME/.dotnet"
|
|
11
|
-
export PATH="$HOME/.dotnet:$PATH"
|
|
12
|
-
|
|
13
|
-
# pack
|
|
14
|
-
dotnet restore
|
|
15
|
-
dotnet build -c Release
|
|
16
|
-
dotnet pack -c Release -p:Version=$version -p:IsPackable=true
|
|
17
|
-
|
|
18
|
-
# publish
|
|
19
|
-
dotnet nuget push "src/**/bin/Release/*.nupkg" --source $sourceUrl -k ${apiKey:-$CI_JOB_TOKEN}
|
|
20
|
-
|
|
21
|
-
cd ../..
|
|
6
|
+
dotnet_publish
|