Skip to content

0xch4z/dynamodb-json-schema

Repository files navigation

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"
  }]
}
*/

About

Generate dynamodb table schema from json schema

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •