@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
|
-
|
|
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] = {
|
package/oclif.manifest.json
CHANGED