UNPKG

@codefresh-io/yaml-validator

Version:

An NPM module/CLI for validating the Codefresh YAML

41 lines (32 loc) 1.36 kB
/** * Defines the composition launch step schema */ 'use strict'; //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ const Joi = require('joi'); const BaseSchema = require('./../base-schema'); class CompositionLaunch extends BaseSchema { //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ static getType() { return 'launch-composition'; } getSchema() { const compositionProperties = { 'type': Joi.string().valid(CompositionLaunch.getType()), 'working_directory': Joi.string(), 'composition': Joi.alternatives(Joi.object(), Joi.string()).required(), 'composition_variables': Joi.array().items(Joi.string()) }; return this._createSchema(compositionProperties).unknown(); } _applyStepCompatibility(schema) { return schema.rename('working-directory', 'working_directory', { ignoreUndefined: true }) .rename('composition-variables', 'composition_variables', { ignoreUndefined: true }); } } // Exported objects/methods module.exports = CompositionLaunch;