Skip to content

Instantly share code, notes, and snippets.

@drgirasol
drgirasol / notes.md
Created June 12, 2018 14:55 — forked from JedWatson/notes.md
Notes on how to create a new field type for Keystone

Creating new Field Types for KeystoneJS

We're currently working on making it easier to add new field types to KeystoneJS as plugins.

In the meantime, if you'd like to work on your own field type, hopefully this guide will point you in the right direction.

Keystone fields require the following:

  • a {fieldType}.js file in ./lib/fieldTypes that controls the field and encapsulates options support, underscore functions, validation and updating
  • the {fieldType}.js file needs to be included by ./lib/fieldTypes/index.js
@drgirasol
drgirasol / discover-schema.js
Created March 27, 2018 15:44 — forked from officer-rosmarino/discover-schema.js
Loopback: Discover a schema in a db.
/*
* Discovers a table schema and outputs it into a file: run this script via:
* $ node discover-schema.js
*/
var path = require('path');
var fs = require('fs');
var app = require('loopback');
var output_directory = path.resolve(__dirname, '..', '..', 'common', 'models');