Cookie Cutter

Cookie Cutter

  • Introduction
  • API
  • Help

›Modules

Introduction

  • Getting Started
  • Inputs
  • Message Handling
  • Outputs
  • Versioning and Contribution Guide

Components

  • Dispatch Context
  • State
  • Metrics
  • Tracing
  • Logging
  • Validation
  • Encoding
  • Config
  • Testing

Modules

  • Kafka
  • Azure
  • AMQP
  • gRPC
  • ValidateJS
  • MSSQL
  • Timer
  • StatsD
  • Protobuf
  • Prometheus
  • Redis
  • S3
  • Google PubSub

ValidateJS

The ValidateJS package can be used to setup input and output message validation by defining constraints according to validatejs' syntax (see https://validatejs.org/#examples). Constraints have to be named following a convention to be effective. The convention is based on the input message's type, it must be {TypeName}Constraint.

const MyConstraints = {
    InputAConstraint: {
        fieldA: required,
        fieldB: required,
    },
    OutputAConstraint: {
        fieldC: required,
        fieldD: required,
    },
}

Application.create()
    // ...
    .validate(withValidateJs(MyConstraints))
    .dispatch({
        onInputA: (msg: IInputA, ctx: IDispatchContext) {
            ctx.publish(OutputA, { /* payload */ });
        },
    })
    .run();
← gRPCMSSQL →
Cookie Cutter
Docs
IntroductionKafka
More
Blog
Copyright © 2023 Walmart Inc.