Skip to content

Instantly share code, notes, and snippets.

View moltar's full-sized avatar
📦
Building stuff.

Roman moltar

📦
Building stuff.
View GitHub Profile
@moltar
moltar / gist:17ef5ac9da5b9bace73da725cd979292
Created June 3, 2022 08:55 — forked from archisgore/gist:d1dda9965db63342546501689fa3f309
Convert json-schema into AWS Glue struct schema (for automating JSON parsing in Glue using AWS CDK)
import request from 'sync-request';
import * as glue from '@aws-cdk/aws-glue';
export function polytectJsonSchemaToGlue(): glue.Type {
console.log("Getting Polytect reference schema...")
const res = request('GET', 'https://raw.githubusercontent.com/polyverse/polytect/master/reference/schema.json');
const body = res.getBody();
const schema = JSON.parse(body.toString());
return recursiveGlueColumns(schema, schema.definitions);
}