Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/0xch4z/dynamodb-json-schema

Generate dynamodb table schema from json schema
https://github.com/0xch4z/dynamodb-json-schema

dynamodb jsonschema

Last synced: about 2 months ago
JSON representation

Generate dynamodb table schema from json schema

Awesome Lists containing this project

README

        

# dynamodb-json-schema [![Build Status](https://travis-ci.org/charliekenney23/dynamodb-json-schema.svg?branch=master)](https://travis-ci.org/charliekenney23/dynamodb-json-schema)

> Generate dynamodb table schema from json schema

## Example Usage

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