JSPM

ecs-task-definition-validator

0.2.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 312
  • Score
    100M100P100Q99761F
  • License MIT

Validate the an ECS Task Definition

Package Exports

  • ecs-task-definition-validator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ecs-task-definition-validator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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);