Platformatic v0.16.0

Platformatic v0.16.0

Hi Folks,

We are shipping another Platformatic release this week with a few new features and plenty of bugfixes!

Generate getSchema() definitions

getSchema() is a useful utility to a reusable schema of an object. In Platformatic DB, we use this technique to share the schemas of all our entities. In #700, @rozzilla extended our typescript generator to include the types of those schemas.

declare module 'fastify' {
  interface FastifyInstance {
    getSchema(schemaId: 'Movie'): {
      '$id': string,
      title: string,
      description: string,
      type: string,
      properties: object,
      required: string[]

add request.platformaticContext decorator

We added a new platformaticContext request decorator to help create an object with the right structure for the authorization plugin. Use it in this way in your custom plugins:

  app.get('/all-pages', async (req, reply) => {
    // Optionally get the platformatic context.
    // Passing this to all sql-mapper functions allow to apply
    // authorization rules to the database queries (amongst other things).
    const ctx = req.platformaticContext
    // Will return all rows from 'pages' table
    const res = await
    const res = await{ ctx })
    return res

This new feature was added in

hot reload setting CLI flag

Platformatic hot reload functionality might crash on your system. We are working on it, but it requires some new features in Node.js core to be implemented. In the meanwhile, you can disable it from the command line:

plt db start --hot-reload false

This feature was added by @salesh in

What's Changed