• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

screwdriver-cd / screwdriver / #3202

25 Jul 2025 04:52PM UTC coverage: 67.669% (-27.3%) from 94.935%
#3202

push

screwdriver

web-flow
feat(3363): Update the existing endpoint to get admin for a pipeline from the specified SCM context (#3370)

1284 of 2114 branches covered (60.74%)

Branch coverage included in aggregate %.

1 of 11 new or added lines in 1 file covered. (9.09%)

1235 existing lines in 49 files now uncovered.

3417 of 4833 relevant lines covered (70.7%)

50.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.15
/plugins/template-validator.js
1
'use strict';
2

3
const boom = require('@hapi/boom');
1✔
4
const schema = require('screwdriver-data-schema');
1✔
5
const templateSchema = schema.api.templateValidator;
1✔
6
const validator = require('screwdriver-template-validator').parseJobTemplate;
1✔
7

8
/**
9
 * Hapi Template Validator Plugin
10
 *  - Validates sd-template.yaml and returns the parsed template with any
11
 *    errors associated with it
12
 * @method register
13
 * @param  {Hapi.Server}    server
14
 * @param  {Function} next
15
 */
16
const templateValidatorPlugin = {
1✔
17
    name: 'template-validator',
18
    async register(server) {
UNCOV
19
        server.route({
×
20
            method: 'POST',
21
            path: '/validator/template',
22
            options: {
23
                description: 'Validate a given sd-template.yaml',
24
                notes: 'returns the parsed config, validation errors, or both',
25
                tags: ['api', 'validation', 'yaml'],
26
                plugins: {
27
                    'hapi-rate-limit': {
28
                        enabled: false
29
                    }
30
                },
31
                handler: async (request, h) => {
UNCOV
32
                    try {
×
UNCOV
33
                        const { templateFactory } = request.server.app;
×
UNCOV
34
                        const { yaml: templateString } = request.payload;
×
35

UNCOV
36
                        const result = await validator(templateString, templateFactory);
×
37

UNCOV
38
                        return h.response(result);
×
39
                    } catch (err) {
UNCOV
40
                        throw boom.badRequest(err.toString());
×
41
                    }
42
                },
43
                validate: {
44
                    payload: templateSchema.input
45
                },
46
                response: {
47
                    schema: templateSchema.output
48
                }
49
            }
50
        });
51
    }
52
};
53

54
module.exports = templateValidatorPlugin;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc