ecs-task-definition-validator

Validate the an ECS Task Definition

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
ecs-task-definition-validator
400.2.24 years ago4 years agoMinified + gzip package size for ecs-task-definition-validator in KB

Readme

ECS Task Definition Validator
ECS Task Definition Validator uses JSON Schema to validate ECS Task Definitions.

Installation

npm install ecs-task-definition-validator --save

Usage

Basic

const validator = require('ecs-task-definition-validator');
let taskDefinition = {
  // your task definition here
}

let result = validator(taskDefinition);
if (result.errors.length > 0) {
  // do whatever you do when validation fails
}

Schema Modification

You can pass a function as the second argument to do runtime modification of the JSON Schemas.
// Force portMappings parameter to be required
function schemaUpdate(schema) {
  if (schema.id !== '/containerDefinition') return schema;

  schema.required.push('portMappings');
  return schema;
}

let result = validator(taskDefinition, schemaUpdate);