Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ function getSchemaKeyword(properties = {}) {
return defaultKeyword;
}

const schemaKey = Object.keys(properties).find(key => !restRequestPropNames.includes(key));
return schemaKey;
return Object.keys(properties).find(key => !restRequestPropNames.includes(key));
}

module.exports = {
Expand Down
14 changes: 8 additions & 6 deletions forward_engineering/helpers/componentsHelpers/responsesHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ function mapResponse({ data, responseCollectionDescription, shouldResponseBeComm
});
const links = getLinks(get(data, `properties.links`), specVersion);
const extensions = getExtensions(data.scopesExtensions);
const response = {};
if (shouldResponseBeCommented) {
response[`hackoladeInnerCommentStart`] = true;
}

Object.assign(response, { description, headers, content, links }, extensions);
const response = {
...(shouldResponseBeCommented && { hackoladeInnerCommentStart: true }),
description,
headers,
content,
links,
...extensions,
};

if (shouldResponseBeCommented) {
response[`hackoladeInnerCommentEnd`] = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ function mapSecurityScheme(data, specVersion) {
};
const extensions = getExtensions(data.scopesExtensions);

return Object.assign({}, securitySchemeProps, commonFields, extensions);
return {
...securitySchemeProps,
...commonFields,
...extensions,
};
}

function mapOAuthFlows(data) {
Expand All @@ -110,7 +114,10 @@ function mapOAuthFlows(data) {

const extensions = getExtensions(data.scopesExtensions);

return cleanUp(Object.assign({}, flows, extensions));
return cleanUp({
...flows,
...extensions,
});
}

function mapOAuthFlowObject({ authorizationUrl, tokenUrl, refreshUrl, scopes, scopesExtensions }) {
Expand All @@ -122,7 +129,10 @@ function mapOAuthFlowObject({ authorizationUrl, tokenUrl, refreshUrl, scopes, sc
};
const extensions = getExtensions(scopesExtensions);

return Object.assign({}, flow, extensions);
return {
...flow,
...extensions,
};
}

function mapScopes(data) {
Expand Down
2 changes: 1 addition & 1 deletion forward_engineering/helpers/generateModelScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const handleRefInContainers = (containers, externalDefinitions, resolveApiExtern
const separatePathAndWebhooks = containers => {
const pathContainers = [];
const webhookContainers = [];
console.log('containers', containers);

containers.forEach(container => {
if (container.containerData?.[0]?.webhook) {
webhookContainers.push(container);
Expand Down
2 changes: 1 addition & 1 deletion forward_engineering/helpers/pathHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { getArrayItems } = require('./sharedHelper');

function getPaths(containers, containersIdsForCallbacks = [], specVersion) {
return containers
.filter(({ id }) => !containersIdsForCallbacks.includes(id))
.filter(({ id, containerData }) => !containersIdsForCallbacks.includes(id))
.reduce((acc, container, index) => {
const { name, isActivated } = container.containerData[0];
const containerData = getRequestsForContainer({
Expand Down
7 changes: 4 additions & 3 deletions forward_engineering/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ function removeEmptyObjectFields(inputObj) {
.reduce((newObj, key) => {
const isObjectAndNotArray = typeof obj[key] === 'object' && !Array.isArray(obj[key]);
if (isObjectAndNotArray) {
return Object.assign(newObj, {
return {
...newObj,
[key]: removeEmptyObjectFields(obj[key]),
});
};
}
return Object.assign(newObj, { [key]: obj[key] });
return { ...newObj, [key]: obj[key] };
}, {});
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading