0.1.2 • Published 5 years ago

dynamodb-json-schema v0.1.2

Weekly downloads
5
License
MIT
Repository
-
Last release
5 years ago

dynamodb-json-schema Build Status

Generate dynamodb table schema from json schema

Example Usage

import * as fs from "fs";
import { getTableSchema } from "dynamodb-json-schema";

const USER_SCHEMA = JSON.parse(fs.readFileSync("User.json", "utf8"));

const tableSchema = getTableSchema({
  tableName: "users-table",
  hashKey: "id",
  itemSchema: USER_SCHEMA
});

/*
=> {
  "TableName": "users-table",
  "KeySchema": [{
    "AttributeName": "id",
    "AttributeType": "HASH"
  }],
  "AttributeDefinitions": [{
    "AttributeName": "id",
    "AttributeType": "S"
  }]
}
*/