# Platformatic v0.18.0 - GraphQL and OpenAPI support for Service, automatic config update, and many more fixes

Hey Folks, we have been working hard in the last week to help reduce friction while building backend development. Unfortunately, this has led to a breaking change.

In Platformatic DB, you used to write:

```json
{
  "core": {
    "connectionString": "..."
  }
}
``` 

Now you should write instead:

```json
{
  "db": {
    "connectionString": "..."
  }
}
```

We made this change to better support Platformatic Service.
However, you would not have to make any changes as your config file will automatically update while loading.

## OpenAPI and GraphQL support for Platformatic Service

Platformatic Service can be configured to automatically expose OpenAPI and GraphQL schemas by providing the following configuration:

```json
{
  "service": {
    "graphql": true,
    "openapi": true
  }
}
```

A complete set of options is also available! Make sure to check the [configuration docs](https://oss.platformatic.dev/docs/reference/service/configuration) as well as [@fastify/swagger](https://github.com/fastify/fastify-swagger) and [Mercurius](https://mercurius.dev/#/).

This feature was implemented in [#783](https://github.com/platformatic/platformatic/pull/783)

## Automatic platformatic update

In [version v0.17.0](https://blog.platformatic.dev/platformatic-v0170-config-file-changes-a-schema-store-and-a-new-upgrade-command), we introduced a new `platformatic upgrade` command to allow you to upgrade to the latest configuration format easily. This same behavior is now applied whenever you start Platformatic DB or Platformatic Service, so you would not miss an update.

This feature was implemented in [#784](https://github.com/platformatic/platformatic/pull/784)

## TypeScript template for Platformatic Service

Platformatic Service now has its own typescript generator in `npx create-platformatic@latest`:

```typescript
import { FastifyInstance, FastifyPluginOptions } from 'fastify'

export default async function (fastify: FastifyInstance, opts: FastifyPluginOptions) {
  fastify.get('/', async (request, reply) => {
    return { hello: fastify.example }
  })
}
```

This change was implemented by [@dongheeleeme](dongheeleeme) in [#757}(https://github.com/platformatic/platformatic/pull/757).

## OpenAPI configuration 

Platformatic DB and Platformatic Service now allows you to completely configure the OpenAPI schema:

  ```json
  {
    "db": {
      ...
      "openapi": {
        ...
        "security": [{ "bearerAuth": [] }],
        "components": {
          "securitySchemes": {
            "bearerAuth": {
              "type": "http",
              "scheme": "bearer",
              "bearerFormat": "JWT"
            }
          }
        }
      }
    }
  }
  ```

This feature was implemented by [@rozzilla](https://github.com/rozzilla) in [#779](https://github.com/platformatic/platformatic/pull/779) and [#785](https://github.com/platformatic/platformatic/pull/785)

## Other fixes
* Add more Fastify options to the `server` schema by [@abdelrazzaq-dev](https://github.com/abdelrazzaq-dev) in [#738](https://github.com/platformatic/platformatic/pull/738)
* Fix version dependent test in [#761](https://github.com/platformatic/platformatic/pull/761)
* metaconfig: update README code snippet by [@cjihrig](https://github.com/cjihrig) in [#762](https://github.com/platformatic/platformatic/pull/762)
* chore(service): Improve error message by [@rozzilla](https://github.com/rozzilla) in [#765](https://github.com/platformatic/platformatic/pull/765).
* fix(tests): TypeScript config error by [@rozzilla](https://github.com/rozzilla) in [#763](https://github.com/platformatic/platformatic/pull/763)
* fix(docs): Issue #766 by [@rozzilla](https://github.com/rozzilla) in [#767](https://github.com/platformatic/platformatic/pull/767)
* docs: fix typo in guide for prisma database provider init option by [@dmateiu](https://github.com/dmateiu) in [#768](https://github.com/platformatic/platformatic/pull/768)
* feat: add config option for type generation target directory by [@dmateiu](https://github.com/dmateiu) in [#769](https://github.com/platformatic/platformatic/pull/769)
* Support directories in paths when using plugins by in [#774](https://github.com/platformatic/platformatic/pull/774).
* Ensure create-platformatic always generate valid config by in [#778](https://github.com/platformatic/platformatic/pull/778).
* set additionalProperties: false for config schema in [#781](https://github.com/platformatic/platformatic/pull/781)
* docs(contributing): Add troubleshooting guideline by [@rozzilla](https://github.com/rozzilla) in [#787](https://github.com/platformatic/platformatic/pull/787).

## New Contributors
* [@dmateiu](https://github.com/dmateiu) made their first contribution in [#768](https://github.com/platformatic/platformatic/pull/768)
* @dongheeleeme made their first contribution in [#757](https://github.com/platformatic/platformatic/pull/757)
