@alagoni97/cli 0.72.3 → 0.72.4

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.
@@ -104,17 +104,21 @@ function extractPayloadsFromOperations(paths) {
104
104
  method,
105
105
  path: pathKey
106
106
  });
107
- // Extract request payload schema
107
+ // Extract request payload schema.
108
+ // Prefer the 3.x `requestBody`: 3.x operations also carry a `parameters`
109
+ // array (path/query/header), so presence of `parameters` cannot be used
110
+ // to detect 2.0 - doing so would drop the body on any 3.x operation that
111
+ // declares parameters. The 2.0 body lives in a `parameters` entry with
112
+ // `in: 'body'`, so fall back to that only when there is no `requestBody`.
108
113
  let requestSchema = null;
109
- // Check if this is OpenAPI 2.0 vs 3.x based on the structure
110
- if ('parameters' in operationObj && operationObj.parameters) {
111
- // OpenAPI 2.0 style
112
- requestSchema = extractOpenAPI2RequestSchema(operationObj.parameters);
113
- }
114
- else if ('requestBody' in operationObj && operationObj.requestBody) {
114
+ if ('requestBody' in operationObj && operationObj.requestBody) {
115
115
  // OpenAPI 3.x style
116
116
  requestSchema = extractOpenAPI3RequestSchema(operationObj.requestBody);
117
117
  }
118
+ else if ('parameters' in operationObj && operationObj.parameters) {
119
+ // OpenAPI 2.0 style (body carried as a `in: 'body'` parameter)
120
+ requestSchema = extractOpenAPI2RequestSchema(operationObj.parameters);
121
+ }
118
122
  if (requestSchema) {
119
123
  const requestSchemaId = (0, utils_1.pascalCase)(`${operationId}_Request`);
120
124
  requestPayloads[operationId] = {
@@ -506,5 +506,5 @@
506
506
  ]
507
507
  }
508
508
  },
509
- "version": "0.72.3"
509
+ "version": "0.72.4"
510
510
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alagoni97/cli",
3
3
  "description": "CLI to work with code generation in any environment",
4
- "version": "0.72.3",
4
+ "version": "0.72.4",
5
5
  "bin": {
6
6
  "codegen": "./bin/run.mjs"
7
7
  },