dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
32 lines (31 loc) • 1.17 kB
JavaScript
import { getFormattedAnyOfJSONSchema } from './anyOf.js';
import { getFormattedItemJSONSchema } from './item.js';
import { getFormattedListJSONSchema } from './list.js';
import { getFormattedMapJSONSchema } from './map.js';
import { getFormattedPrimitiveJSONSchema } from './primitive.js';
import { getFormattedRecordJSONSchema } from './record.js';
import { getFormattedSetJSONSchema } from './set.js';
export const getFormattedValueJSONSchema = (schema) => {
switch (schema.type) {
case 'any':
return {};
case 'null':
case 'boolean':
case 'number':
case 'string':
case 'binary':
return getFormattedPrimitiveJSONSchema(schema);
case 'set':
return getFormattedSetJSONSchema(schema);
case 'list':
return getFormattedListJSONSchema(schema);
case 'map':
return getFormattedMapJSONSchema(schema);
case 'record':
return getFormattedRecordJSONSchema(schema);
case 'anyOf':
return getFormattedAnyOfJSONSchema(schema);
case 'item':
return getFormattedItemJSONSchema(schema);
}
};