@team-supercharge/oasg 18.3.2 → 18.3.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-supercharge/oasg",
3
- "version": "18.3.2",
3
+ "version": "18.3.3",
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",
@@ -18,9 +18,11 @@ there are no `I{ApiName}` interfaces in that mode.
18
18
  Everything lives in a single `EndpointRouteBuilderExtensions.cs`:
19
19
 
20
20
  - A **request wrapper** record per operation, bundling every parameter:
21
- `AddPetRequest(Pet pet)`, `GetPetByIdRequest(long petId)`,
22
- `UploadFileRequest(long petId, string? additionalMetadata, Stream? body)`, …
23
- A distinct type per operation, so request/response pairs never collide.
21
+ `AddPetRequest(Pet Body)`, `GetPetByIdRequest(long PetId)`,
22
+ `UploadFileRequest(long PetId, string? AdditionalMetadata, Stream? Body)`, …
23
+ A distinct type per operation, so request/response pairs never collide. The
24
+ body parameter (if any) is always named `Body`, regardless of its schema
25
+ name, so it can never collide with the wrapper's own name.
24
26
  - **`Map{ApiName}Endpoints(this IEndpointRouteBuilder)`** (one per API, e.g.
25
27
  `MapPetApiEndpoints`) — maps that API's operations as minimal-API endpoints
26
28
  that invoke the request through Wolverine and return the result
@@ -125,7 +127,7 @@ public class PetHandlers
125
127
  {
126
128
  // Operation with a response body -> return the response model
127
129
  public Task<Pet> Handle(AddPetRequest request)
128
- => Task.FromResult(request.Pet);
130
+ => Task.FromResult(request.Body);
129
131
 
130
132
  public async Task<Pet> Handle(GetPetByIdRequest request)
131
133
  => await _repository.GetAsync(request.PetId)
@@ -41,7 +41,8 @@ namespace {{packageName}}
41
41
  {{#operations}}
42
42
  {{#operation}}
43
43
  /// <summary>Wolverine request for {{classname}}.{{operationId}}, carrying every parameter.</summary>
44
- public record {{operationId}}Request({{#allParams}}{{>paramType}} {{#lambda.pascalcase}}{{paramName}}{{/lambda.pascalcase}}{{^-last}}, {{/-last}}{{/allParams}});
44
+ /// <remarks>The body parameter is always named <c>Body</c>, regardless of its schema name, so it can never collide with the enclosing record's own name (see CS0542).</remarks>
45
+ public record {{operationId}}Request({{#allParams}}{{>paramType}} {{#isBodyParam}}Body{{/isBodyParam}}{{^isBodyParam}}{{#lambda.pascalcase}}{{paramName}}{{/lambda.pascalcase}}{{/isBodyParam}}{{^-last}}, {{/-last}}{{/allParams}});
45
46
  {{/operation}}
46
47
  {{/operations}}
47
48
  {{/apis}}