diff --git a/forward_engineering/helpers/pathHelper.js b/forward_engineering/helpers/pathHelper.js index 1b108b0..c9a606e 100644 --- a/forward_engineering/helpers/pathHelper.js +++ b/forward_engineering/helpers/pathHelper.js @@ -62,7 +62,7 @@ function getRequestData(collections, containers, containerId, containersPath = [ methodName: data.collectionName, isActivated: data.isActivated }; - const extensions = getExtensions(data.operationExtensions); + const extensions = getExtensions(data.scopesExtensions); return Object.assign({}, request, extensions); }) @@ -103,9 +103,10 @@ function mapResponses(collections, collectionId, isParentActivated) { .map(collection => { const responseCode = collection.collectionName; const shouldResponseBeCommented = !collection.isActivated && isParentActivated; + const extensions = getExtensions(collection.scopesExtensions); const response = mapResponse(get(collection, 'properties.response'), collection.description, shouldResponseBeCommented); - return { responseCode, response }; + return { responseCode, response: { ...response, ...extensions } }; }) .reduce((acc, { responseCode, response }) => { acc[responseCode] = response; @@ -137,8 +138,9 @@ function getCallbacks(data, containers, containerId, containersPath = []) { containers, [...containersPath, containerId] ); + const extensions = getExtensions(value.scopesExtensions); - return { [key]: { [value.callbackExpression]: callbackData }}; + return { [key]: { [value.callbackExpression]: callbackData, ...extensions }}; }) .reduce((acc, item) => { diff --git a/forward_engineering/helpers/typeHelper.js b/forward_engineering/helpers/typeHelper.js index 34f052f..e4a2ea3 100644 --- a/forward_engineering/helpers/typeHelper.js +++ b/forward_engineering/helpers/typeHelper.js @@ -21,6 +21,8 @@ function getType(data, key) { function getTypeProps(data, key) { const { type, properties, items, required } = data; + const extensions = getExtensions(data.scopesExtensions); + switch (type) { case 'array': { const arrayProps = { @@ -37,7 +39,7 @@ function getTypeProps(data, key) { }; const arrayChoices = getChoices(data, key); - return Object.assign({}, arrayProps, arrayChoices); + return Object.assign({}, arrayProps, arrayChoices, extensions); } case 'object': { const objectProps = { @@ -56,7 +58,7 @@ function getTypeProps(data, key) { }; const objectChoices = getChoices(data, key); - return Object.assign({}, objectProps, objectChoices); + return Object.assign({}, objectProps, objectChoices, extensions); } case 'parameter': if (!properties || properties.length === 0) { @@ -167,7 +169,8 @@ function getPrimitiveTypeProps(data) { maxLength: data.maxLength, multipleOf: data.multipleOf, xml: getXml(data.xml), - example: data.sample + example: data.sample, + ...getExtensions(data.scopesExtensions) }; return addIfTrue(properties, 'nullable', data.nullable); diff --git a/properties_pane/field_level/fieldLevelConfig.json b/properties_pane/field_level/fieldLevelConfig.json index da4938c..a4c5c83 100644 --- a/properties_pane/field_level/fieldLevelConfig.json +++ b/properties_pane/field_level/fieldLevelConfig.json @@ -1432,7 +1432,11 @@ making sure that you maintain a proper JSON format. "template": "textarea", "markdown": false } - ] + ], + "dependency": { + "key": "subtype", + "value": "schema" + } }, "comments" ], @@ -2566,6 +2570,31 @@ making sure that you maintain a proper JSON format. ] } ] + }, + { + "propertyName": "extensions", + "propertyType": "group", + "propertyKeyword": "scopesExtensions", + "shouldValidate": true, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "pattern", + "propertyKeyword": "extensionPattern", + "shouldValidate": true, + "propertyType": "text", + "regex":"^x-" + }, + { + "propertyName": "value", + "propertyKeyword": "extensionValue", + "propertyValidate": false, + "propertyTooltip": "Popup for multi-line text entry", + "propertyType": "details", + "template": "textarea", + "markdown": false + } + ] } ], "expression": [ diff --git a/snippets/encoding.json b/snippets/encoding.json index 6f5f4e8..828f5fc 100644 --- a/snippets/encoding.json +++ b/snippets/encoding.json @@ -1,6 +1,5 @@ { "name": "encoding", - "subtype": "snippetChildrenOnly", "parentType": "document", "properties": [{ "name": "headers", diff --git a/types/encoding.json b/types/encoding.json index be0f6e9..60b8263 100644 --- a/types/encoding.json +++ b/types/encoding.json @@ -14,8 +14,10 @@ "minProperties": "", "maxProperties": "", "snippet": "encoding", + "properties": [], "additionalProperties": false, "enum": [], + "subtype": "snippetChildrenOnly", "hackoladeMeta": { "disableAdd": true }