diff --git a/languages/c/Types.mjs b/languages/c/Types.mjs index 1ed84940..52ef6c75 100644 --- a/languages/c/Types.mjs +++ b/languages/c/Types.mjs @@ -220,7 +220,8 @@ function getMethodSignatureParams(method, module, { destination, callback = fals if ((callback === true) && (type === 'char*')) { type = getFireboltStringType() } - signatureParams += type + (!param.required ? '* ' : ' ') + param.name + + signatureParams += type + ((!param.required && !type.includes('_t') && (type !== 'char*')) ? '* ' : ' ') + param.name }) return signatureParams } @@ -349,6 +350,7 @@ function getSchemaTypeInfo(module = {}, json = {}, name = '', schemas = {}, pref structure.namespace = getModuleName(module) } } + return structure } @@ -532,7 +534,7 @@ function getSchemaShapeInfo(json, module, schemas = {}, { name = '', prefix = '' if (info.type && info.type.length > 0) { let type = getArrayElementSchema(json, module, schemas, info.name) - let arrayName = capitalize(info.name) + capitalize(type.type) + let arrayName = capitalize(info.name); let namespace = info.namespace if (type && type.type === 'object') { namespace = getModuleName(module) diff --git a/languages/c/language.config.json b/languages/c/language.config.json index ee3604d7..b684e11b 100644 --- a/languages/c/language.config.json +++ b/languages/c/language.config.json @@ -12,5 +12,6 @@ "/src/module_common.cpp", "/src/jsondata_module.h" ], - "persistPermission": true + "persistPermission": true, + "createPolymorphicMethods": true } diff --git a/languages/c/templates/codeblocks/export.c b/languages/c/templates/codeblocks/export.c index c98498e4..e69de29b 100644 --- a/languages/c/templates/codeblocks/export.c +++ b/languages/c/templates/codeblocks/export.c @@ -1 +0,0 @@ -export { default as ${info.title} } from './${info.title}/index.mjs' \ No newline at end of file diff --git a/languages/c/templates/codeblocks/setter.c b/languages/c/templates/codeblocks/setter.c index 342a98d6..5bc0cd91 100644 --- a/languages/c/templates/codeblocks/setter.c +++ b/languages/c/templates/codeblocks/setter.c @@ -1,7 +1,7 @@ -/* ${method.name} - ${method.description} */ +/* ${method.json.name} - ${method.description} */ uint32_t ${info.Title}_${method.Name}( ${method.signature.params} ) { - const string method = _T("${info.title}.${method.name}"); + const string method = _T("${info.title}.${method.json.name}"); ${if.params}${method.params.serialization}${end.if.params} return FireboltSDK::Properties::Set(method, jsonParameters); } diff --git a/languages/c/templates/methods/default.c b/languages/c/templates/methods/default.c index 6fbca47e..11eeeef7 100644 --- a/languages/c/templates/methods/default.c +++ b/languages/c/templates/methods/default.c @@ -1,4 +1,4 @@ -/* ${method.name} - ${method.description} */ +/* ${method.json.name} - ${method.description} */ uint32_t ${info.Title}_${method.Name}( ${method.signature.params}${if.result}${if.params}, ${end.if.params}${method.result.type}* ${method.result.name}${end.if.result}${if.signature.empty}void${end.if.signature.empty} ) { uint32_t status = FireboltSDKErrorUnavailable; @@ -7,9 +7,9 @@ uint32_t ${info.Title}_${method.Name}( ${method.signature.params}${if.result}${i ${method.params.serialization.with.indent} ${method.result.json.type} jsonResult; - status = transport->Invoke("${info.title}.${method.name}", jsonParameters, jsonResult); + status = transport->Invoke("${info.title}.${method.json.name}", jsonParameters, jsonResult); if (status == FireboltSDKErrorNone) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title}.${method.name} is successfully invoked"); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title}.${method.json.name} is successfully invoked"); ${method.result.instantiation} } diff --git a/languages/c/templates/methods/event.c b/languages/c/templates/methods/event.c index ec868cd5..2950d3bc 100644 --- a/languages/c/templates/methods/event.c +++ b/languages/c/templates/methods/event.c @@ -1,4 +1,4 @@ -/* ${method.name} - ${method.description} */ +/* ${method.json.name} - ${method.description} */ static void ${info.Title}${method.Name}InnerCallback( void* userCB, const void* userData, void* response ) { ${event.callback.params.serialization} @@ -11,7 +11,7 @@ static void ${info.Title}${method.Name}InnerCallback( void* userCB, const void* } uint32_t ${info.Title}_Register_${method.Name}( ${event.signature.params}${if.event.params}, ${end.if.event.params}${info.Title}${method.Name}Callback userCB, const void* userData ) { - const string eventName = _T("${info.title}.${method.name}"); + const string eventName = _T("${info.title}.${method.json.name}"); uint32_t status = FireboltSDKErrorNone; if (userCB != nullptr) { @@ -22,5 +22,5 @@ uint32_t ${info.Title}_Register_${method.Name}( ${event.signature.params}${if.ev } uint32_t ${info.Title}_Unregister_${method.Name}( ${info.Title}${method.Name}Callback userCB) { - return FireboltSDK::Event::Instance().Unsubscribe(_T("${info.title}.${method.name}"), reinterpret_cast(userCB)); + return FireboltSDK::Event::Instance().Unsubscribe(_T("${info.title}.${method.json.name}"), reinterpret_cast(userCB)); } diff --git a/languages/c/templates/methods/polymorphic-pull-event.c b/languages/c/templates/methods/polymorphic-pull-event.c index d2f5ef4c..4ab28bde 100644 --- a/languages/c/templates/methods/polymorphic-pull-event.c +++ b/languages/c/templates/methods/polymorphic-pull-event.c @@ -1,4 +1,4 @@ -/* ${method.name} - ${method.description} */ +/* ${method.json.name} - ${method.description} */ static void ${info.Title}${method.Name}InnerCallback( void* userCB, const void* userData, void* response ) { ${event.callback.params.serialization} @@ -29,7 +29,7 @@ static void ${info.Title}${method.Name}InnerCallback( void* userCB, const void* WPEFramework::Core::JSON::Boolean jsonResult; uint32_t status = transport->Invoke(_T("${info.title}.${method.pulls.for}"), jsonParameters, jsonResult); if (status == FireboltSDKErrorNone) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title}.${method.name} is successfully pushed with status as %d", jsonResult.Value()); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title}.${method.json.name} is successfully pushed with status as %d", jsonResult.Value()); status = (jsonResult.Value() == true) ? FireboltSDKErrorNone : FireboltSDKErrorNotSupported; } } else { @@ -39,7 +39,7 @@ static void ${info.Title}${method.Name}InnerCallback( void* userCB, const void* } uint32_t ${info.Title}_Register_${method.Name}( ${info.Title}${method.Name}Callback userCB, const void* userData ) { - const string eventName = _T("${info.title}.${method.name}"); + const string eventName = _T("${info.title}.${method.json.name}"); uint32_t status = FireboltSDKErrorNone; if (userCB != nullptr) { @@ -50,5 +50,5 @@ uint32_t ${info.Title}_Register_${method.Name}( ${info.Title}${method.Name}Callb } uint32_t ${info.Title}_Unregister_${method.Name}( ${info.Title}${method.Name}Callback userCB) { - return FireboltSDK::Event::Instance().Unsubscribe(_T("${info.title}.${method.name}"), reinterpret_cast(userCB)); + return FireboltSDK::Event::Instance().Unsubscribe(_T("${info.title}.${method.json.name}"), reinterpret_cast(userCB)); } diff --git a/languages/c/templates/methods/polymorphic-pull.c b/languages/c/templates/methods/polymorphic-pull.c index ec052e64..3536dad3 100644 --- a/languages/c/templates/methods/polymorphic-pull.c +++ b/languages/c/templates/methods/polymorphic-pull.c @@ -1,16 +1,17 @@ -/* ${method.name} - ${method.description} */ +/* ${method.json.name} - ${method.description} */ uint32_t ${info.Title}_Push${method.Name}( ${method.signature.params} ) { uint32_t status = FireboltSDKErrorUnavailable; - string correlationId = ""; -${method.params.serialization} FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); if (transport != nullptr) { + string correlationId = ""; + ${method.params.serialization.with.indent} + WPEFramework::Core::JSON::Boolean jsonResult; - status = transport->Invoke(_T("${info.title}.${method.name}"), jsonParameters, jsonResult); + status = transport->Invoke(_T("${info.title}.${method.json.name}"), jsonParameters, jsonResult); if (status == FireboltSDKErrorNone) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title}.${method.name} is successfully pushed with status as %d", jsonResult.Value()); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title}.${method.json.name} is successfully pushed with status as %d", jsonResult.Value()); status = (jsonResult.Value() == true) ? FireboltSDKErrorNone : FireboltSDKErrorNotSupported; } } else { diff --git a/languages/c/templates/methods/property.c b/languages/c/templates/methods/property.c index 9a92dce4..dfdd0b5e 100644 --- a/languages/c/templates/methods/property.c +++ b/languages/c/templates/methods/property.c @@ -1,7 +1,7 @@ -/* ${method.name} - ${method.description} */ +/* ${method.json.name} - ${method.description} */ uint32_t ${info.Title}_Get${method.Name}( ${method.signature.params}${if.params}, ${end.if.params}${method.result.type}* ${method.result.name} ) { - const string method = _T("${info.title}.${method.name}"); + const string method = _T("${info.title}.${method.json.name}"); ${if.params}${method.params.serialization}${end.if.params} ${method.result.json} jsonResult; ${if.params}uint32_t status = FireboltSDK::Properties::Get(method, jsonParameters, jsonResult);${end.if.params} diff --git a/src/macrofier/engine.mjs b/src/macrofier/engine.mjs index bff898ca..ec336a5a 100644 --- a/src/macrofier/engine.mjs +++ b/src/macrofier/engine.mjs @@ -29,7 +29,7 @@ import isString from 'crocks/core/isString.js' import predicates from 'crocks/predicates/index.js' const { isObject, isArray, propEq, pathSatisfies, propSatisfies } = predicates -import { isRPCOnlyMethod, isProviderInterfaceMethod, getProviderInterface, getPayloadFromEvent, providerHasNoParameters, isTemporalSetMethod, hasMethodAttributes, getMethodAttributes, isEventMethodWithContext, getSemanticVersion, getSetterFor, getProvidedCapabilities, isPolymorphicPullMethod, hasPublicAPIs } from '../shared/modules.mjs' +import { isRPCOnlyMethod, isProviderInterfaceMethod, getProviderInterface, getPayloadFromEvent, providerHasNoParameters, isTemporalSetMethod, hasMethodAttributes, getMethodAttributes, isEventMethodWithContext, getSemanticVersion, getSetterFor, getProvidedCapabilities, isPolymorphicPullMethod, hasPublicAPIs, createPolymorphicMethods } from '../shared/modules.mjs' import isEmpty from 'crocks/core/isEmpty.js' import { getLinkedSchemaPaths, getSchemaConstraints, isSchema, localizeDependencies, isDefinitionReferencedBySchema } from '../shared/json-schema.mjs' @@ -419,7 +419,7 @@ const generateMacros = (obj, templates, languages, options = {}) => { const eventsEnum = generateEvents(obj, templates) const examples = generateExamples(obj, templates, languages) - const allMethodsArray = generateMethods(obj, examples, templates) + const allMethodsArray = generateMethods(obj, examples, templates, { polymorphic : options.createPolymorphicMethods }) const methodsArray = allMethodsArray.filter(m => !m.event && (!options.hideExcluded || !m.excluded)) const eventsArray = allMethodsArray.filter(m => m.event && (!options.hideExcluded || !m.excluded)) const declarationsArray = allMethodsArray.filter(m => m.declaration) @@ -934,12 +934,30 @@ function generateExamples(json = {}, mainTemplates = {}, languages = {}) { return examples } -function generateMethods(json = {}, examples = {}, templates = {}) { +function generateMethods(json = {}, examples = {}, templates = {}, options = { polymorphic: false }) { const methods = compose( option([]), getMethods )(json) + let methodList = [] + if (options.polymorphic) { + methods.forEach(method => { + let polymorphicMethods = createPolymorphicMethods(method, json) + if (polymorphicMethods.length > 1) { + polymorphicMethods.forEach(polymorphicMethod => { + methodList.push(polymorphicMethod) + }) + } + else { + methodList.push(method) + } + }) + } + else { + methodList = methods + } + // Code to generate methods const results = reduce((acc, methodObj, i, arr) => { const result = { @@ -953,21 +971,21 @@ function generateMethods(json = {}, examples = {}, templates = {}) { let template = getTemplateForMethod(methodObj, templates); if (template && template.length) { - let javascript = insertMethodMacros(template, methodObj, json, templates, examples) + let javascript = insertMethodMacros(template, methodObj, json, templates, options, examples) result.body = javascript } template = getTemplateForDeclaration(methodObj, templates) if (template && template.length) { - let javascript = insertMethodMacros(template, methodObj, json, templates, examples) + let javascript = insertMethodMacros(template, methodObj, json, templates, options, examples) result.declaration = javascript } acc.push(result) return acc - }, [], methods) + }, [], methodList) // TODO: might be useful to pass in local macro for an array with all capability & provider interface names if (json.methods && json.methods.find(isProviderInterfaceMethod)) { @@ -1005,7 +1023,7 @@ function generateMethods(json = {}, examples = {}, templates = {}) { } // TODO: this is called too many places... let's reduce that to just generateMethods -function insertMethodMacros(template, methodObj, json, templates, examples = {}) { +function insertMethodMacros(template, methodObj, json, templates, options = { polymorphic: false }, examples={}) { const moduleName = getModuleName(json) const info = { @@ -1069,11 +1087,11 @@ function insertMethodMacros(template, methodObj, json, templates, examples = {}) // grab some related methdos in case they are output together in a single template file const puller = json.methods.find(method => method.tags.find(tag => tag['x-pulls-for'] === methodObj.name)) const pullsFor = methodObj.tags.find(t => t['x-pulls-for']) && json.methods.find(method => method.name === methodObj.tags.find(t => t['x-pulls-for'])['x-pulls-for']) - const pullerTemplate = (puller ? insertMethodMacros(getTemplate('/codeblocks/puller', templates), puller, json, templates, examples) : '') + const pullerTemplate = (puller ? insertMethodMacros(getTemplate('/codeblocks/puller', templates), puller, json, templates, options, examples) : '') const setter = getSetterFor(methodObj.name, json) - const setterTemplate = (setter ? insertMethodMacros(getTemplate('/codeblocks/setter', templates), setter, json, templates, examples) : '') + const setterTemplate = (setter ? insertMethodMacros(getTemplate('/codeblocks/setter', templates), setter, json, templates, options, examples) : '') const subscriber = json.methods.find(method => method.tags.find(tag => tag['x-alternative'] === methodObj.name)) - const subscriberTemplate = (subscriber ? insertMethodMacros(getTemplate('/codeblocks/subscriber', templates), subscriber, json, templates, examples) : '') + const subscriberTemplate = (subscriber ? insertMethodMacros(getTemplate('/codeblocks/subscriber', templates), subscriber, json, templates, options, examples) : '') const setterFor = methodObj.tags.find(t => t.name === 'setter') && methodObj.tags.find(t => t.name === 'setter')['x-setter-for'] || '' const pullsResult = (puller || pullsFor) ? localizeDependencies(pullsFor || methodObj, json).params[1].schema : null const pullsParams = (puller || pullsFor) ? localizeDependencies(getPayloadFromEvent(puller || methodObj), json, null, { mergeAllOfs: true }).properties.parameters : null @@ -1113,6 +1131,7 @@ function insertMethodMacros(template, methodObj, json, templates, examples = {}) template = insertExampleMacros(template, examples[methodObj.name] || [], methodObj, json, templates) template = template.replace(/\$\{method\.name\}/g, method.name) + .replace(/\$\{method\.json\.name\}/g, options.polymorphic ? methodObj.actualName || method.name : method.name) .replace(/\$\{method\.summary\}/g, methodObj.summary) .replace(/\$\{method\.description\}/g, methodObj.description || methodObj.summary) diff --git a/src/macrofier/index.mjs b/src/macrofier/index.mjs index dc5f30e8..86483fad 100644 --- a/src/macrofier/index.mjs +++ b/src/macrofier/index.mjs @@ -44,6 +44,7 @@ const macrofy = async ( templatesPerModule, templatesPerSchema, persistPermission, + createPolymorphicMethods, createModuleDirectories, copySchemasIntoModules, extractSubSchemas, @@ -159,7 +160,7 @@ const macrofy = async ( // Pick the index and defaults templates for each module. templatesPerModule.forEach(t => { - const macros = engine.generateMacros(module, templates, exampleTemplates, {hideExcluded: hideExcluded, copySchemasIntoModules: copySchemasIntoModules, destination: t}) + const macros = engine.generateMacros(module, templates, exampleTemplates, {hideExcluded: hideExcluded, copySchemasIntoModules: copySchemasIntoModules, createPolymorphicMethods: createPolymorphicMethods, destination: t}) let content = getTemplateForModule(module.info.title, t, templates) // NOTE: whichever insert is called first also needs to be called again last, so each phase can insert recursive macros from the other @@ -174,7 +175,7 @@ const macrofy = async ( }) if (primaryOutput) { - const macros = engine.generateMacros(module, templates, exampleTemplates, {hideExcluded: hideExcluded, copySchemasIntoModules: copySchemasIntoModules, destination: primaryOutput}) + const macros = engine.generateMacros(module, templates, exampleTemplates, {hideExcluded: hideExcluded, copySchemasIntoModules: copySchemasIntoModules, createPolymorphicMethods: createPolymorphicMethods, destination: primaryOutput}) macros.append = append outputFiles[primaryOutput] = engine.insertMacros(outputFiles[primaryOutput], macros) } @@ -256,7 +257,7 @@ const macrofy = async ( Object.values(externalSchemas).forEach( document => { if (templatesPerSchema) { templatesPerSchema.forEach( t => { - const macros = engine.generateMacros(document, templates, exampleTemplates, {hideExcluded: hideExcluded, destination: t}) + const macros = engine.generateMacros(document, templates, exampleTemplates, {hideExcluded: hideExcluded, createPolymorphicMethods: createPolymorphicMethods, destination: t}) let content = getTemplate('/schemas', t, templates) // NOTE: whichever insert is called first also needs to be called again last, so each phase can insert recursive macros from the other diff --git a/src/sdk/index.mjs b/src/sdk/index.mjs index 7e85fab9..2e72ba9b 100755 --- a/src/sdk/index.mjs +++ b/src/sdk/index.mjs @@ -58,6 +58,7 @@ const run = async ({ templatesPerModule: config.templatesPerModule, templatesPerSchema: config.templatesPerSchema, persistPermission: config.persistPermission, + createPolymorphicMethods: config.createPolymorphicMethods, operators: config.operators, createModuleDirectories: config.createModuleDirectories, copySchemasIntoModules: config.copySchemasIntoModules, diff --git a/src/shared/modules.mjs b/src/shared/modules.mjs index 386b9d6d..bd1a9890 100644 --- a/src/shared/modules.mjs +++ b/src/shared/modules.mjs @@ -854,6 +854,167 @@ const generateEventListenResponse = json => { return json } +const getRefDefinition = (uri = '', moduleJson = {}) => { + if (!uri) { + throw "getRefDefinition requires a non-null uri parameter" + } + if (uri.startsWith('#')) { + const path = (uri).split('#').pop() + + let definition + if (path) { + definition = getPathOr(null, path.slice(1).split('/'), moduleJson) + } + if (!definition) { + throw `getRefDefinition: Path '${uri}' not found in ${moduleJson ? (moduleJson.title || moduleJson.info.title) : moduleJson}.` + return null + } + else { + return definition + } + } + else { + throw `Cannot call getRefDefinition with ${uri}` + } +} + +const getAnyOfSchema = (inType, json, anyOfTypes) => { + let outType = localizeDependencies(inType, json) + if (outType.schema.anyOf) { + if (anyOfTypes.length > 0) { + } + else { + let definition = '' + if (inType.schema['$ref'] && (inType.schema['$ref'][0] === '#')) { + definition = getRefDefinition(inType.schema['$ref'], json, json['x-schemas']) + } + else { + definition = outType.schema + } + definition.anyOf.forEach(anyOf => { + anyOfTypes.push(anyOf) + }) + outType.schema = anyOfTypes + } + } + return outType +} + +const generateAnyOfSchema = (anyOf, name, summary) => { + let anyOfType = [] + if (!anyOf['$ref']) { + anyOf.name = anyOf.title || anyOf.name || '' + delete anyOf.title + if (anyOf.schema === undefined) { + anyOf.schema = {} + if (anyOf.oneOf) { + anyOf.schema.oneOf = anyOf.oneOf + delete anyOf.oneOf + } + else if (anyOf.anyOf) { + anyOf.schema.anyOf = anyOf.anyOf + delete anyOf.anyOf + } + else if (anyOf.allOf) { + anyOf.schema.allOf = anyOf.allOf + delete anyOf.allOf + } + } + } + anyOfType.name = name[0].toLowerCase() + name.substr(1) + anyOfType.summary = summary + anyOfType.schema = anyOf + return anyOfType +} + +const generateParamsAnyOfSchema = (methodParams, anyOf, anyOfTypes, title, summary) => { + let params = [] + methodParams.forEach(p => { + if (p.schema === anyOfTypes) { + let anyOfType = generateAnyOfSchema(anyOf, title, summary) + anyOfType.required = p.required + params.push(anyOfType) + } + else { + params.push(p) + } + }) + return params +} + +const generateResultAnyOfSchema = (method, methodResult, anyOf, anyOfTypes, title, summary) => { + let methodResultSchema = Object.assign({}, method.result.schema) + + if (methodResult.schema === anyOfTypes) { + let anyOfType = generateAnyOfSchema(anyOf, title, summary) + let index = 0 + if (isEventMethod(method)) { + index = (method.result.schema.anyOf || method.result.schema.oneOf).indexOf(getPayloadFromEvent(method)) + } + else { + index = (method.result.schema.anyOf || method.result.schema.oneOf).indexOf(anyOfType) + } + if (method.result.schema.anyOf) { + methodResultSchema.anyOf = Object.assign([], method.result.schema.anyOf) + methodResultSchema.anyOf[index] = anyOfType.schema + } + else if (method.result.schema.oneOf) { + methodResultSchema.oneyOf = Object.assign([], method.result.schema.oneOf) + methodResultSchema.oneOf[index] = anyOfType.schema + } + else { + methodResultSchema = anyOfType.schema + } + } + return methodResultSchema +} + +const createPolymorphicMethods = (method, json) => { + let anyOfTypes = [] + let methodParams = [] + let methodResult = Object.assign({}, method.result) + + method.params.forEach(p => { + if (p.schema) { + methodParams.push(getAnyOfSchema(p, json, anyOfTypes)) + } + }) + if (isEventMethod(method)) { + methodResult.schema = getPayloadFromEvent(method) + } + methodResult = getAnyOfSchema(methodResult, json, anyOfTypes) + + let polymorphicMethodSchemas = [] + if (anyOfTypes.length > 0) { + let polymorphicMethodSchema = { + name: {}, + tags: {}, + summary: `${method.summary}`, + params: {}, + result: {}, + examples: {} + } + anyOfTypes.forEach(anyOf => { + let localized = localizeDependencies(anyOf, json) + let title = localized.title || localized.name || '' + let summary = localized.summary || localized.description || '' + polymorphicMethodSchema.actualName = method.name + polymorphicMethodSchema.name = `${method.name}With${title}` + polymorphicMethodSchema.tags = method.tags + polymorphicMethodSchema.params = generateParamsAnyOfSchema(methodParams, anyOf, anyOfTypes, title, summary) + polymorphicMethodSchema.result = Object.assign({}, method.result) + polymorphicMethodSchema.result.schema = generateResultAnyOfSchema(method, methodResult, anyOf, anyOfTypes, title, summary) + polymorphicMethodSchema.examples = method.examples + polymorphicMethodSchemas.push(Object.assign({}, polymorphicMethodSchema)) + }) + } + else { + polymorphicMethodSchemas = method + } + + return polymorphicMethodSchemas +} + const getPathFromModule = (module, path) => { console.error("DEPRECATED: getPathFromModule") @@ -1175,5 +1336,6 @@ export { getSemanticVersion, addExternalMarkdown, addExternalSchemas, - getExternalMarkdownPaths -} \ No newline at end of file + getExternalMarkdownPaths, + createPolymorphicMethods +}