docworks-jsdoc2spec
Advanced tools
Comparing version 1.4.4 to 1.5.0
@@ -28,3 +28,3 @@ 'use strict'; | ||
return function (prop) { | ||
return (0, _docworksModel.MessageMember)(prop.name, (0, _jsdocHandlerShared.handleType)(prop.type, find, onError, context), prop.description, prop.description); | ||
return (0, _docworksModel.MessageMember)(prop.name, (0, _jsdocHandlerShared.handleType)(prop.type, find, onError, context), prop.description); | ||
}; | ||
@@ -46,3 +46,3 @@ }; | ||
return (0, _jsdocHandlerShared.handleMeta)(mes.meta); | ||
}), (0, _jsdocHandlerShared.handleDoc)(message), (0, _jsdocHandlerShared.handleDoc)(message), extra); | ||
}), (0, _jsdocHandlerShared.handleDoc)(message), extra); | ||
} | ||
@@ -49,0 +49,0 @@ }; |
@@ -30,3 +30,3 @@ 'use strict'; | ||
if (param.name && !param.type) onError((0, _docworksModel.JsDocError)(context.kind + ' ' + context.name + ' param ' + param.name + ' has a name but no type. Did you forget the {} around the type?', [context.location])); | ||
return (0, _docworksModel.Param)(param.name, (0, _jsdocHandlerShared.handleType)(param.type, find, onError, context), param.description, param.description, param.optional, param.defaultvalue, param.variable); | ||
return (0, _docworksModel.Param)(param.name, (0, _jsdocHandlerShared.handleType)(param.type, find, onError, context), param.description, param.optional, param.defaultvalue, param.variable); | ||
}; | ||
@@ -45,3 +45,3 @@ }; | ||
var ret = (0, _docworksModel.Return)(_docworksModel.Void, undefined, undefined); | ||
var ret = (0, _docworksModel.Return)(_docworksModel.Void, undefined); | ||
if (func.returns && func.returns.length > 0) { | ||
@@ -52,7 +52,7 @@ if (func.returns.length > 1) onError((0, _docworksModel.JsDocError)(kind + ' ' + func.name + ' has multiple returns annotations', [(0, _jsdocHandlerShared.handleMeta)(func.meta)])); | ||
onError((0, _docworksModel.JsDocError)(kind + ' ' + func.name + ' has return without description or type', [(0, _jsdocHandlerShared.handleMeta)(func.meta)])); | ||
ret = (0, _docworksModel.Return)('void', '', ''); | ||
ret = (0, _docworksModel.Return)('void', ''); | ||
} else { | ||
if (func.returns[0].description && !func.returns[0].type) onError((0, _docworksModel.JsDocError)(kind + ' ' + func.name + ' has return description but no type. Did you forget the {} around the type?', [(0, _jsdocHandlerShared.handleMeta)(func.meta)])); | ||
ret = (0, _docworksModel.Return)((0, _jsdocHandlerShared.handleType)(func.returns[0].type, find, onError, (0, _jsdocHandlerShared.typeContext)(kind, func.name, 'return', func.memberof, (0, _jsdocHandlerShared.handleMeta)(func.meta))), func.returns[0].description, func.returns[0].description); | ||
ret = (0, _docworksModel.Return)((0, _jsdocHandlerShared.handleType)(func.returns[0].type, find, onError, (0, _jsdocHandlerShared.typeContext)(kind, func.name, 'return', func.memberof, (0, _jsdocHandlerShared.handleMeta)(func.meta))), func.returns[0].description); | ||
} | ||
@@ -65,3 +65,3 @@ } | ||
return (0, _jsdocHandlerShared.handleMeta)(func.meta); | ||
}), (0, _jsdocHandlerShared.handleDoc)(func), (0, _jsdocHandlerShared.handleDoc)(func), extra); | ||
}), (0, _jsdocHandlerShared.handleDoc)(func), extra); | ||
} | ||
@@ -68,0 +68,0 @@ }; |
@@ -29,9 +29,9 @@ 'use strict'; | ||
var defaultValue = member.defaultvalue; | ||
if (member.type) return (0, _docworksModel.Property)(member.name, [], true, false, (0, _jsdocHandlerShared.handleType)(member.type, find, onError, context), defaultValue, [location], (0, _jsdocHandlerShared.handleDoc)(member), (0, _jsdocHandlerShared.handleDoc)(member), extra); | ||
if (member.type) return (0, _docworksModel.Property)(member.name, [], true, false, (0, _jsdocHandlerShared.handleType)(member.type, find, onError, context), defaultValue, [location], (0, _jsdocHandlerShared.handleDoc)(member), extra); | ||
// handle write property | ||
if (member.params && member.params.length > 0) return (0, _docworksModel.Property)(member.name, [], false, true, (0, _jsdocHandlerShared.handleType)(member.params[0].type, find, onError, context), defaultValue, [location], (0, _jsdocHandlerShared.handleDoc)(member), (0, _jsdocHandlerShared.handleDoc)(member), extra); | ||
if (member.params && member.params.length > 0) return (0, _docworksModel.Property)(member.name, [], false, true, (0, _jsdocHandlerShared.handleType)(member.params[0].type, find, onError, context), defaultValue, [location], (0, _jsdocHandlerShared.handleDoc)(member), extra); | ||
onError((0, _docworksModel.JsDocError)('Property ' + member.name + ' is missing a type annotation', [location])); | ||
return (0, _docworksModel.Property)(member.name, [], false, false, _docworksModel.Void, defaultValue, [location], (0, _jsdocHandlerShared.handleDoc)(member), (0, _jsdocHandlerShared.handleDoc)(member), extra); | ||
return (0, _docworksModel.Property)(member.name, [], false, false, _docworksModel.Void, defaultValue, [location], (0, _jsdocHandlerShared.handleDoc)(member), extra); | ||
}; | ||
@@ -63,3 +63,3 @@ }; | ||
var docs = prop1.get ? prop1.docs : prop2.docs; | ||
return (0, _docworksModel.Property)(prop1.name, [], true, true, prop1.type, prop1.defaultValue, _locations, docs, docs, extra); | ||
return (0, _docworksModel.Property)(prop1.name, [], true, true, prop1.type, prop1.defaultValue, _locations, docs, extra); | ||
} | ||
@@ -74,3 +74,3 @@ | ||
onError((0, _docworksModel.JsDocError)('Property ' + prop1.name + ' is defined two or more times', _locations)); | ||
return (0, _docworksModel.Property)(prop1.name, [], true, true, prop1.type, prop1.defaultValue, _locations, prop1.docs, prop1.docs, prop1.extra); | ||
return (0, _docworksModel.Property)(prop1.name, [], true, true, prop1.type, prop1.defaultValue, _locations, prop1.docs, prop1.extra); | ||
} | ||
@@ -77,0 +77,0 @@ var locations = (_ref = []).concat.apply(_ref, _toConsumableArray(properties.map(function (_) { |
@@ -72,4 +72,4 @@ 'use strict'; | ||
var extra = (0, _docworksPlugins2.default)(plugins, 'extendDocworksService', serviceDoclet); | ||
return (0, _docworksModel.Service)(serviceDoclet.name, serviceDoclet.memberof, mixes, [], properties, operations, callbacks, messages, location, docs, docs, extra); | ||
return (0, _docworksModel.Service)(serviceDoclet.name, serviceDoclet.memberof, mixes, [], properties, operations, callbacks, messages, location, docs, extra); | ||
}; | ||
} |
@@ -19,3 +19,3 @@ import {handleMeta, handleType, typeContext, handleDoc} from './jsdoc-handler-shared'; | ||
handleType(prop.type, find, onError, context), | ||
prop.description, prop.description | ||
prop.description | ||
); | ||
@@ -34,3 +34,3 @@ }; | ||
let extra = handlePlugins(plugins, 'extendDocworksMessage', message); | ||
return Message(message.name, [], members, messages.map(mes => handleMeta(mes.meta)), handleDoc(message), handleDoc(message), extra); | ||
return Message(message.name, [], members, messages.map(mes => handleMeta(mes.meta)), handleDoc(message), extra); | ||
} | ||
@@ -37,0 +37,0 @@ }; |
@@ -22,3 +22,2 @@ import {handleMeta, handleType, typeContext, handleDoc} from './jsdoc-handler-shared'; | ||
param.description, | ||
param.description, | ||
param.optional, | ||
@@ -40,3 +39,3 @@ param.defaultvalue, | ||
let ret = Return(Void, undefined, undefined); | ||
let ret = Return(Void, undefined); | ||
if (func.returns && func.returns.length > 0) { | ||
@@ -49,3 +48,3 @@ if (func.returns.length > 1) | ||
ret = | ||
Return('void', '', ''); | ||
Return('void', ''); | ||
} | ||
@@ -58,3 +57,2 @@ else { | ||
Return(handleType(func.returns[0].type, find, onError, typeContext(kind, func.name, 'return', func.memberof, handleMeta(func.meta))), | ||
func.returns[0].description, | ||
func.returns[0].description); | ||
@@ -66,3 +64,3 @@ } | ||
let extra = handlePlugins(plugins, (kind==='Operation')?'extendDocworksOperation':'extendDocworksCallback', func); | ||
return Operation(func.name, [], [], params, ret, funcs.map(func => handleMeta(func.meta)), handleDoc(func), handleDoc(func), extra); | ||
return Operation(func.name, [], [], params, ret, funcs.map(func => handleMeta(func.meta)), handleDoc(func), extra); | ||
} | ||
@@ -69,0 +67,0 @@ }; |
@@ -15,10 +15,10 @@ | ||
if (member.type) | ||
return Property(member.name, [], true, false, handleType(member.type, find, onError, context), defaultValue, [location], handleDoc(member), handleDoc(member), extra); | ||
return Property(member.name, [], true, false, handleType(member.type, find, onError, context), defaultValue, [location], handleDoc(member), extra); | ||
// handle write property | ||
if (member.params && member.params.length > 0) | ||
return Property(member.name, [], false, true, handleType(member.params[0].type, find, onError, context), defaultValue, [location], handleDoc(member), handleDoc(member), extra); | ||
return Property(member.name, [], false, true, handleType(member.params[0].type, find, onError, context), defaultValue, [location], handleDoc(member), extra); | ||
onError(JsDocError(`Property ${member.name} is missing a type annotation`, [location])); | ||
return Property(member.name, [], false, false, Void, defaultValue, [location], handleDoc(member), handleDoc(member), extra); | ||
return Property(member.name, [], false, false, Void, defaultValue, [location], handleDoc(member), extra); | ||
@@ -56,3 +56,3 @@ }; | ||
let docs = prop1.get?prop1.docs:prop2.docs; | ||
return Property(prop1.name, [], true, true, prop1.type, prop1.defaultValue, locations, docs, docs, extra); | ||
return Property(prop1.name, [], true, true, prop1.type, prop1.defaultValue, locations, docs, extra); | ||
} | ||
@@ -73,3 +73,3 @@ | ||
locations)); | ||
return Property(prop1.name, [], true, true, prop1.type, prop1.defaultValue, locations, prop1.docs, prop1.docs, prop1.extra) | ||
return Property(prop1.name, [], true, true, prop1.type, prop1.defaultValue, locations, prop1.docs, prop1.extra) | ||
@@ -76,0 +76,0 @@ } |
@@ -47,5 +47,5 @@ import helper from 'jsdoc/util/templateHelper'; | ||
let extra = handlePlugins(plugins, 'extendDocworksService', serviceDoclet); | ||
return Service(serviceDoclet.name, serviceDoclet.memberof, mixes, [], properties, operations, callbacks, messages, location, docs, docs, extra); | ||
return Service(serviceDoclet.name, serviceDoclet.memberof, mixes, [], properties, operations, callbacks, messages, location, docs, extra); | ||
} | ||
} | ||
{ | ||
"name": "docworks-jsdoc2spec", | ||
"version": "1.4.4", | ||
"version": "1.5.0", | ||
"description": "extractor for jsdoc apis to api spec", | ||
@@ -14,3 +14,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"docworks-model": "^1.4.4", | ||
"docworks-model": "^1.5.0", | ||
"intercept-stdout": "^0.1.2", | ||
@@ -17,0 +17,0 @@ "jsdoc": "3.4.0", |
@@ -7,3 +7,3 @@ import runJsDoc from '../lib/jsdoc-runner'; | ||
describe('jsdoc plugins', function() { | ||
describe('docworks plugins', function() { | ||
it('run with plugin', function() { | ||
@@ -10,0 +10,0 @@ let jsDocRes = runJsDoc({ |
@@ -19,6 +19,6 @@ import runJsDoc from '../lib/jsdoc-runner'; | ||
operations: [ | ||
{name: 'operation', srcDocs: {summary: 'this is another new summary'}} | ||
{name: 'operation', docs: {summary: 'this is another new summary'}} | ||
], | ||
properties: [ | ||
{name: 'label', srcDocs: {summary: 'this is the new summary'}} | ||
{name: 'label', docs: {summary: 'this is the new summary'}} | ||
] | ||
@@ -25,0 +25,0 @@ } |
@@ -19,4 +19,4 @@ | ||
* the description of the message | ||
* @property {string} name | ||
* @property {string|number} age | ||
* @property {string} name the name | ||
* @property {string|number} age the age | ||
*/ | ||
@@ -23,0 +23,0 @@ |
@@ -39,7 +39,2 @@ import runJsDoc from '../lib/jsdoc-runner'; | ||
links: ["{@link http://somedomain2.com} a related site"] | ||
}, | ||
srcDocs: { | ||
summary: 'this is a docs test service', | ||
description: 'this class is used to test how service docs work', | ||
links: ["{@link http://somedomain2.com} a related site"] | ||
} | ||
@@ -70,13 +65,2 @@ } | ||
] | ||
}, | ||
srcDocs: { | ||
summary: 'the summary for propertyWithDocs', | ||
description: 'the description for propertyWithDocs\nanother line of description', | ||
links: ["aNamespace.ServiceProperties a related service", | ||
"{@link aNamespace.ServiceOperations) another related service", | ||
"{@link http://somedomain.com} a related site"], | ||
examples: [ | ||
{title: undefined, body: '// returns 2\nlet z = x.propertyWithDocs;'}, | ||
{title: 'the example caption', body: '// returns 3\nlet z = y.propertyWithDocs;'} | ||
] | ||
} | ||
@@ -103,7 +87,2 @@ } | ||
links: [] | ||
}, | ||
srcDocs: { | ||
summary: 'summary from the getter', | ||
description: 'desc from the getter', | ||
links: [] | ||
} | ||
@@ -118,3 +97,3 @@ } | ||
it.skip('should support docs on an operation', function() { | ||
it('should support docs on an operation', function() { | ||
expect(jsDocRes).to.containSubset({ | ||
@@ -127,5 +106,5 @@ services: [ | ||
params: [ | ||
{name: 'input', type: 'string', doc: 'the input', srcDoc: 'the input'} | ||
{name: 'input', type: 'string', doc: 'the input'} | ||
], | ||
ret: {type: 'string', doc: 'the return value', srcDoc: 'the return value'}, | ||
ret: {type: 'string', doc: 'the return value'}, | ||
docs: { | ||
@@ -135,7 +114,2 @@ summary: 'an operation', | ||
links: [] | ||
}, | ||
srcDocs: { | ||
summary: 'an operation', | ||
description: 'the description of the operation', | ||
links: [] | ||
}} | ||
@@ -163,7 +137,6 @@ ] | ||
}, | ||
srcDocs: { | ||
summary: 'a Message with docs', | ||
description: 'the description of the message', | ||
links: [] | ||
} | ||
members: [ | ||
{name: 'name', type: 'string', doc: 'the name'}, | ||
{name: 'age', type: ['string', 'number'], doc: 'the age'} | ||
] | ||
} | ||
@@ -170,0 +143,0 @@ ] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122924
3473
Updateddocworks-model@^1.5.0