@team-supercharge/oasg 18.0.2 → 18.2.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.
Files changed (28) hide show
  1. package/README.md +222 -33
  2. package/bin/oasg +2 -0
  3. package/config.schema.yml +37 -0
  4. package/package.json +1 -1
  5. package/targets/dotnet/generate.sh +2 -11
  6. package/targets/dotnet/publish.sh +2 -17
  7. package/targets/dotnet/templates/Project.csproj.mustache +39 -0
  8. package/targets/dotnet-common.sh +48 -0
  9. package/targets/dotnet-system-text-json/generate.sh +6 -0
  10. package/targets/dotnet-system-text-json/generator-config.json +15 -0
  11. package/targets/dotnet-system-text-json/publish.sh +6 -0
  12. package/targets/dotnet-system-text-json/templates/netcore_project.mustache +85 -0
  13. package/targets/dotnet-webapi/generate.sh +2 -11
  14. package/targets/dotnet-webapi/publish.sh +2 -17
  15. package/targets/dotnet-webapi/templates/Project.csproj.mustache +61 -0
  16. package/targets/dotnet-webapi-system-text-json/README.md +241 -0
  17. package/targets/dotnet-webapi-system-text-json/generate.sh +33 -0
  18. package/targets/dotnet-webapi-system-text-json/generator-config.json +29 -0
  19. package/targets/dotnet-webapi-system-text-json/publish.sh +6 -0
  20. package/targets/dotnet-webapi-system-text-json/templates/Project.csproj.mustache +66 -0
  21. package/targets/dotnet-webapi-system-text-json/templates/controller.mustache +7 -0
  22. package/targets/dotnet-webapi-system-text-json/templates/endpointParam.mustache +1 -0
  23. package/targets/dotnet-webapi-system-text-json/templates/enumClass.mustache +24 -0
  24. package/targets/dotnet-webapi-system-text-json/templates/minimalEndpoints.mustache +120 -0
  25. package/targets/dotnet-webapi-system-text-json/templates/model.mustache +205 -0
  26. package/targets/dotnet-webapi-system-text-json/templates/paramType.mustache +1 -0
  27. package/targets/dotnet-webapi-system-text-json/templates/serviceCollectionExtensions.mustache +90 -0
  28. package/targets/dotnet-webapi-system-text-json/templates/typeConverter.mustache +11 -0
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** | 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
- | `feign` |➖ |🐛 |✨ |➖ |➖ |➖ |➖ |➖ |✨ |💥 |💥 |➖ |➖ |🐛 |🐛 |🆕 |
141
- | `feign-kotlin` |➖ |🐛 |✨ |➖ |➖ |➖ |➖ |➖ |🆕 |
142
- | `plain-java` |➖ |🐛 |🆕 |
143
- | `flutter` |➖ |➖ |➖ |➖ |➖ |🆕 |
144
- | `ios` |➖ |➖ |➖ |➖ |➖ |💥 |🐛 |➖ |➖ |➖ |✨ |➖ |💥 |➖ |➖ |✨ |🆕 |
145
- | `apple-swift` |➖ |➖ |🆕 |
146
- | `kmp` |✨ |✨ |➖ |➖ |🆕 |
147
- | `python` |➖ |➖ |🆕 |
148
- | `python-legacy` |➖ |➖ |💥 |➖ |🐛 |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
149
- | `react` |💥 |➖ |🐛 |🐛 |➖ |💥 |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
150
- | `typescript-axios` |✨ |➖ |🆕 |
151
- | `typescript-fetch` |✨ |➖ |🆕 |
152
- | **Server Targets** | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
153
- | `nestjs` |✨ |🐛 |💥 |💥 |➖ |💥 |✨ |➖ |➖ |🐛 |➖ |➖ |✨ |🆕 |
154
- | `python-fastapi` |➖ |➖ |➖ |➖ |🆕 |
155
- | `python-fastapi-raw-request` |➖ |➖ |➖ |➖ |🆕 |
156
- | `spring` |➖ |🐛 |✨ |➖ |➖ |➖ |➖ |➖ |✨ |💥 |💥 |➖ |➖ |➖ |✨ |➖ |🆕 |
157
- | `spring-kotlin` |➖ |✨ |✨ |➖ |➖ |➖ |➖ |➖ |✨ |💥 |💥 |➖ |➖ |🐛 |✨ |➖ |🆕 |
158
- | **Misc Targets** | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
159
- | `contract-testing` |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |🆕 |
160
- | `openapi` |➖ |➖ |➖ |➖ |➖ |➖ |💥 |➖ |➖ |✨ |➖ |🆕 |
161
- | `stubby` |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |➖ |💥 |➖ |➖ |➖ |➖ |🆕 |
162
- | `postman` |➖ |➖ |➖ |🆕 |
163
- | `msw` |🆕 |
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,192 @@ 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 package builds AOT-clean: it sets `<EnableRequestDelegateGenerator>` so the
1281
+ > minimal-API `Map*()` calls are statically generated (no reflection-based request
1282
+ > delegates), each model emits a source-generated `JsonSerializerContext` used by
1283
+ > its `ToJson()` (no Newtonsoft, no reflection `JsonSerializer`), and there is no
1284
+ > reflection-based enum converter. Building the package under the AOT analyzer
1285
+ > (`<IsAotCompatible>`) raises no IL2026/IL3050 warnings.
1286
+ >
1287
+ > Enums (de)serialize by their wire value (e.g. `"available"`): each generated enum
1288
+ > carries `[JsonConverter(typeof(JsonStringEnumConverter<T>))]` with per-member
1289
+ > `[JsonStringEnumMemberName]`, which the source generator honours.
1290
+ >
1291
+ > **JSON registration.** The package generates a `{PackageName}JsonSerializerContext`
1292
+ > (a source-generated `JsonSerializerContext` over every model, request/response type
1293
+ > and inline enum) plus an `Add{PackageName}JsonOptions()` extension that registers it
1294
+ > on the minimal-API JSON resolver chain. Call it in Program.cs:
1295
+ >
1296
+ > ```csharp
1297
+ > builder.Services.Add{PackageName}JsonOptions();
1298
+ > ```
1299
+ >
1300
+ > This is **required when the host is published with Native AOT** (`PublishAot=true`),
1301
+ > because AOT removes the reflection JSON fallback and the endpoints must resolve every
1302
+ > DTO through source generation. For a reflection-based (JIT) host it is harmless (the
1303
+ > reflection resolver already covers everything), but registering it still gives faster,
1304
+ > allocation-free metadata, so calling it unconditionally is recommended.
1305
+
1306
+ ##### `withWolverineImplementation`
1307
+
1308
+ When `true`, the generated minimal-API endpoints invoke [Wolverine](https://wolverinefx.net)
1309
+ **directly** instead of delegating to the `I{ApiName}` interfaces — there are no
1310
+ `I{ApiName}` interfaces in this mode. The single `EndpointRouteBuilderExtensions.cs`
1311
+ instead contains:
1312
+
1313
+ - **A request wrapper per operation** — `public record AddPetRequest(Pet pet);`,
1314
+ `public record GetPetByIdRequest(long petId);`, etc. Each bundles **all** of the
1315
+ operation's parameters (path, query, header, body), so two operations never
1316
+ collide on a shared request/response type and every parameter is carried
1317
+ (including for file uploads).
1318
+ - **`Map{ApiName}Endpoints()`** (one per API), plus an aggregate
1319
+ **`MapAll{PackageName}Endpoints()`** that calls them all — each endpoint invokes
1320
+ the request through Wolverine and returns the result:
1321
+ ```csharp
1322
+ endpoints.MapPost("/api/v3/pet",
1323
+ async ([FromBody] Pet pet, [FromServices] IMessageBus messageBus, CancellationToken ct) =>
1324
+ Results.Ok(await messageBus.InvokeAsync<Pet>(new AddPetRequest(pet), ct)));
1325
+ ```
1326
+ Operations with no response body return `Results.NoContent()`; secured
1327
+ operations get `.RequireAuthorization()`.
1328
+ - **`ConfigureWolverineMessaging(this WolverineOptions options, string localQueueName = "PackageName")`** —
1329
+ one method that routes every request type in the assembly to a local queue (the
1330
+ queue name is a parameter).
1331
+
1332
+ The `WolverineFx` package reference is added automatically.
1333
+
1334
+ **Host wiring** the consumer provides:
1335
+
1336
+ ```csharp
1337
+ builder.Host.UseWolverine(opts =>
1338
+ {
1339
+ opts.ConfigureWolverineMessaging(); // or pass a custom queue name
1340
+
1341
+ // Static codegen (see below). Pre-generate with `dotnet run -- codegen write`.
1342
+ opts.CodeGeneration.TypeLoadMode = JasperFx.CodeGeneration.TypeLoadMode.Static;
1343
+ });
1344
+
1345
+ var app = builder.Build();
1346
+ app.MapAll{PackageName}Endpoints(); // aggregate; or call Map{ApiName}Endpoints() individually
1347
+ ```
1348
+
1349
+ The host also provides a **handler for each `*Request` type** (Wolverine discovers
1350
+ them by convention), e.g. `public Task<Pet> Handle(AddPetRequest request) { ... }`.
1351
+
1352
+ **Static codegen.** Set `TypeLoadMode.Static` in the host (above) so Wolverine
1353
+ does **not** compile handler code at runtime, and pre-generate it as part of your
1354
+ build/deploy, e.g. `dotnet run -- codegen write` (or, to opt back into runtime
1355
+ compilation, drop that line and reference `WolverineFx.RuntimeCompilation`).
1356
+
1357
+ **No retries / error handling.** Wolverine scopes retry rules per message type on
1358
+ the **handler**, not on the routing options, so `ConfigureWolverineMessaging`
1359
+ does not set a retry policy. Disable retries per handler where you want
1360
+ fail-fast, e.g.:
1361
+
1362
+ ```csharp
1363
+ public static class AddPetRequestHandler
1364
+ {
1365
+ public static void Configure(HandlerChain chain) => chain.OnAnyException().Discard();
1366
+ public Task<Pet> Handle(AddPetRequest request) { ... }
1367
+ }
1368
+ ```
1369
+
1370
+ With no retries, a handler exception propagates straight back through
1371
+ `InvokeAsync` into the endpoint, where you map it to an HTTP response host-side
1372
+ (`IExceptionHandler` + `AddProblemDetails()`).
1373
+
1374
+ > **File uploads.** The wrapper carries every parameter, so a file operation's
1375
+ > path/query parameters reach the handler alongside the body (unlike sending the
1376
+ > body alone). The body itself is carried as a `System.IO.Stream`, which works
1377
+ > for the in-process local-queue routing used here (passed by reference). A
1378
+ > `Stream` is **not** serializable, so if you re-route these requests to a remote
1379
+ > transport (RabbitMQ, Azure Service Bus, …) the file body would not serialize —
1380
+ > buffer it to a `byte[]` in that case.
1381
+
1193
1382
  #### `postman`
1194
1383
 
1195
1384
  ```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,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-supercharge/oasg",
3
- "version": "18.0.2",
3
+ "version": "18.2.0",
4
4
  "description": "Node-based tool to lint OpenAPI documents and generate clients, servers and documentation from them",
5
5
  "author": "Supercharge",
6
6
  "license": "MIT",
@@ -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
- rm -rf out/$targetId
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
- cd out/$targetId
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,6 @@
1
+ #!/bin/bash
2
+
3
+ source $(dirname "$0")/../common.sh
4
+ source $(dirname "$0")/../dotnet-common.sh
5
+
6
+ dotnet_generate
@@ -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,6 @@
1
+ #!/bin/bash
2
+
3
+ source $(dirname "$0")/../common.sh
4
+ source $(dirname "$0")/../dotnet-common.sh
5
+
6
+ dotnet_publish
@@ -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
- rm -rf out/$targetId
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
- cd out/$targetId
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