@intrig/core 0.0.15-29 → 0.0.15-30

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/main.js +11 -8
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -7840,15 +7840,16 @@ function normalizeResponses(spec) {
7840
7840
  k,
7841
7841
  doDeref(v)
7842
7842
  ]).filter(([_, v])=>v !== undefined));
7843
- Object.values(operationOb.responses).filter(Boolean).map((a)=>a).forEach((response)=>{
7844
- if (response.headers) {
7845
- response.headers = doDeref(response.headers);
7843
+ Object.entries(operationOb.responses).filter(([_, v])=>Boolean(v)).forEach(([statusCode, response])=>{
7844
+ const responseObj = response;
7845
+ if (responseObj.headers) {
7846
+ responseObj.headers = doDeref(responseObj.headers);
7846
7847
  }
7847
- if (response.links) {
7848
- response.links = doDeref(response.links);
7848
+ if (responseObj.links) {
7849
+ responseObj.links = doDeref(responseObj.links);
7849
7850
  }
7850
- if (response.content) {
7851
- Object.values(response.content).forEach((mto)=>{
7851
+ if (responseObj.content) {
7852
+ Object.values(responseObj.content).forEach((mto)=>{
7852
7853
  if (mto.examples) {
7853
7854
  mto.examples = Object.fromEntries(Object.entries(mto.examples).map(([k, v])=>[
7854
7855
  k,
@@ -7856,7 +7857,9 @@ function normalizeResponses(spec) {
7856
7857
  ]).filter(([_, v])=>v !== undefined));
7857
7858
  }
7858
7859
  if (!isRef(mto.schema)) {
7859
- const paramName = generateTypeName(operationOb, 'ResponseBody');
7860
+ // Include status code in name to differentiate responses
7861
+ const postfix = statusCode.startsWith('2') ? 'ResponseBody' : `ResponseBody${statusCode}`;
7862
+ const paramName = generateTypeName(operationOb, postfix);
7860
7863
  draft.components = draft.components ?? {};
7861
7864
  draft.components.schemas = draft.components.schemas ?? {};
7862
7865
  draft.components.schemas[paramName] = mto.schema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intrig/core",
3
- "version": "0.0.15-29",
3
+ "version": "0.0.15-30",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {