@palbase/backend 36.0.1 → 37.0.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.
@@ -6750,19 +6750,21 @@ function registerOperation(registry, op) {
6750
6750
  } : {}
6751
6751
  };
6752
6752
  const resolvedThrows = resolveThrows(op.throws);
6753
- const responses = {
6754
- 200: {
6755
- description: "Success",
6756
- content: {
6757
- "application/json": {
6758
- // A streaming operation's response is ONE FRAME, and its schema is the
6759
- // declared frame — not the handler's return type, which is void. Without
6760
- // this the document describes an untyped response and every generated
6761
- // client is opaque (measured live: the contract gate refuses the deploy).
6762
- schema: op.sseConfig !== void 0 ? op.sseConfig.frame : op.returnSchema !== void 0 ? op.returnSchema : z.unknown()
6763
- }
6753
+ const returnKind = op.returnSchema?._def?.typeName;
6754
+ const noContent = op.sseConfig === void 0 && (returnKind === "ZodVoid" || returnKind === "ZodUndefined");
6755
+ const successResponse = noContent ? {
6756
+ description: "No Content"
6757
+ } : {
6758
+ description: "Success",
6759
+ content: {
6760
+ "application/json": {
6761
+ // SSE's schema describes one frame, not the void handler return.
6762
+ schema: op.sseConfig?.frame ?? op.returnSchema ?? z.unknown()
6764
6763
  }
6765
- },
6764
+ }
6765
+ };
6766
+ const responses = {
6767
+ [noContent ? 204 : 200]: successResponse,
6766
6768
  400: errorResponse("Validation error"),
6767
6769
  401: errorResponse("Unauthorized"),
6768
6770
  403: errorResponse("Forbidden"),