Skip to content

Commit 937ed5a

Browse files
committed
Remove since tag, get version from project-version relationship
1 parent d665134 commit 937ed5a

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

lib/api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function extractMethodsFromClasses(classes) {
162162
currentClass.data.attributes.methods
163163
.reduce((classMethods, currentMethod) => {
164164
// Transform the current method and push on to methods.
165-
classMethods.push(schemas.methodSchema(currentMethod))
165+
classMethods.push(schemas.methodSchema(currentMethod, currentClass))
166166
return classMethods
167167
}, [])
168168
// Merge all methods of all classes into a single array
@@ -187,7 +187,7 @@ function extractStaticFunctionsFromModules(modules) {
187187

188188
return moduleStaticFunctions
189189
.reduce((moduleStaticFunctions, currentStaticFunction) => {
190-
moduleStaticFunctions.push(schemas.methodSchema(currentStaticFunction))
190+
moduleStaticFunctions.push(schemas.methodSchema(currentStaticFunction, currentModule))
191191
return moduleStaticFunctions
192192
}, [])
193193
.concat(methods)

lib/schemas/class.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
export default function classSchema(classObj) {
77
const data = classObj.data
88
const attributes = data.attributes
9+
const versionId = data.relationships['project-version'].data.id;
10+
const version = versionId.substring(versionId.lastIndexOf('-')+1);
911

1012
return {
1113
id: data.id,
@@ -14,8 +16,7 @@ export default function classSchema(classObj) {
1416
namespace: attributes.namespace,
1517
_tags: [
1618
`module:${attributes.module}`,
17-
`version:${attributes.version}`,
18-
`since:${attributes.since}`
19+
`version:${version}`
1920
]
2021
}
2122
}

lib/schemas/method.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
* @param {Object} method - An object with the method information.
44
* @returns {Object} - Transformed object
55
*/
6-
export default function methodSchema(method) {
6+
export default function methodSchema(method, versioned) {
7+
let versionId = versioned.data.relationships['project-version'].data.id;
8+
let version = versionId.substring(versionId.lastIndexOf('-')+1);
9+
710
return {
811
file: method.file,
912
line: method.line,
@@ -17,8 +20,7 @@ export default function methodSchema(method) {
1720

1821
_tags: [
1922
`module:${method.module}`,
20-
`version:${method.version}`,
21-
`since:${method.since}`
23+
`version:${version}`
2224
],
2325

2426
hierarchy: {

lib/schemas/module.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
export default function moduleSchema(module) {
77
const data = module.data
88
const attributes = data.attributes
9-
9+
let versionId = data.relationships['project-version'].data.id;
10+
let version = versionId.substring(versionId.lastIndexOf('-')+1);
1011
return {
1112
id: data.id,
1213
name: attributes.name,
1314
submodules: attributes.submodules,
1415
namespaces: attributes.namespaces,
15-
_tags: [`module:${attributes.name}`, `version:${attributes.version}`]
16+
_tags: [
17+
`module:${attributes.name}`,
18+
`version:${version}`
19+
]
1620
}
1721
}

0 commit comments

Comments
 (0)