screwdriver-api 7.0.137 → 7.0.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "7.0.137",
3
+ "version": "7.0.139",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -464,8 +464,7 @@ function parseJobInfo({ joinObj, currentBuild, currentPipeline, currentJob, next
464
464
 
465
465
  return {
466
466
  parentBuilds,
467
- joinListNames,
468
- joinParentBuilds
467
+ joinListNames
469
468
  };
470
469
  }
471
470
 
@@ -480,11 +479,21 @@ async function getBuildsForGroupEvent(groupEventId, buildFactory) {
480
479
 
481
480
  builds.forEach(b => {
482
481
  try {
483
- b.environment = JSON.parse(b.environment);
484
- b.parentBuilds = JSON.parse(b.parentBuilds);
485
- b.stats = JSON.parse(b.stats);
486
- b.meta = JSON.parse(b.meta);
487
- b.parentBuildId = JSON.parse(b.parentBuildId);
482
+ if (typeof b.environment === 'string') {
483
+ b.environment = JSON.parse(b.environment);
484
+ }
485
+ if (typeof b.parentBuilds === 'string') {
486
+ b.parentBuilds = JSON.parse(b.parentBuilds);
487
+ }
488
+ if (typeof b.stats === 'string') {
489
+ b.stats = JSON.parse(b.stats);
490
+ }
491
+ if (typeof b.meta === 'string') {
492
+ b.meta = JSON.parse(b.meta);
493
+ }
494
+ if (typeof b.parentBuildId === 'string') {
495
+ b.parentBuildId = JSON.parse(b.parentBuildId);
496
+ }
488
497
 
489
498
  if (b.parentBuildId) {
490
499
  // parentBuildId could be the string '123', the number 123, or an array
@@ -3,7 +3,7 @@
3
3
  const boom = require('@hapi/boom');
4
4
  const schema = require('screwdriver-data-schema');
5
5
  const templateSchema = schema.api.templateValidator;
6
- const pipelineValidator = require('screwdriver-template-validator').parsePipelineTemplate;
6
+ const pipelineValidator = require('screwdriver-template-validator').validatePipelineTemplate;
7
7
 
8
8
  module.exports = () => ({
9
9
  method: 'POST',
@@ -15,8 +15,8 @@ module.exports = () => ({
15
15
  handler: async (request, h) => {
16
16
  try {
17
17
  const { yaml: templateString } = request.payload;
18
-
19
- const result = await pipelineValidator(templateString);
18
+ const { templateFactory } = request.server.app;
19
+ const result = await pipelineValidator(templateString, templateFactory);
20
20
 
21
21
  return h.response(result);
22
22
  } catch (err) {