typespec-http-zod 0.13.0 → 0.14.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 (2) hide show
  1. package/dist/src/api.js +8 -4
  2. package/package.json +1 -1
package/dist/src/api.js CHANGED
@@ -1320,13 +1320,17 @@ function responseArmsOf(route, response, alternate) {
1320
1320
  * empty list, or every `respond` implementation has to tell "none declared" from "none carried".
1321
1321
  */
1322
1322
  /**
1323
- * The media types this status offers. Emitted only where the document names more than one, because
1324
- * a single type is what a `respond` already assumes and repeating it on every arm in every service
1325
- * would be noise rather than a fact.
1323
+ * The media types this status offers.
1324
+ *
1325
+ * **Emitted whenever the document names any, including a single one.** It was emitted only for
1326
+ * several, on the reasoning that one type is what a `respond` already assumes - and that reasoning
1327
+ * was wrong, because it assumed the one type is JSON. A `text/plain` arm and a JSON arm were then
1328
+ * indistinguishable to a generic `respond`: the document knew and the runtime did not, so consumers
1329
+ * restated the media type in their own result envelope to get it back.
1326
1330
  */
1327
1331
  const mediaTypesFor = (status) => {
1328
1332
  const declared = route.responseMediaTypes.find((entry) => entry.status === status)?.contentTypes ?? [];
1329
- if (declared.length < 2)
1333
+ if (declared.length === 0)
1330
1334
  return "";
1331
1335
  return `, contentTypes: [${declared.map((t) => JSON.stringify(t)).join(", ")}]`;
1332
1336
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typespec-http-zod",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "TypeSpec emitter and library: turn an HTTP service definition into Zod validators and framework-free contract types that agree, keyword for keyword, with the OpenAPI document @typespec/openapi3 publishes from the same source.",
5
5
  "keywords": [
6
6
  "codegen",