Core
Framework v2.x
2

BackendOpenApi #

Available since 2.17.0

The BackendOpenApi class handles OpenAPI definition.

It is accessible from the Backend.openapi property.

See the OpenAPI guide.

definition #

Type Description
JSONObject
OpenAPI definition

Example: Default content of OpenAPI definition

Copied to clipboard!
app.openApi.definition

/*
{
  swagger: '2.0',
  info: {
    title: `${application.name} API`, | Framework | Core

    description: `${application.name} HTTP API definition`,
    contact: {
      name: 'Kuzzle team',
      url: 'https://kuzzle.io',
      email: 'support@kuzzle.io',
      discord: 'http://join.discord.kuzzle.io'
    },
    license: {
      name: 'Apache 2',
      url: 'http://opensource.org/licenses/apache2.0'
    },
    version: application.version
  },
  externalDocs: {
    description: 'Kuzzle API Documentation',
  },
  servers: [
    {
      url: 'https://{baseUrl}:{port}',
      description: `${application.name} Base Url`,
      variables: {
        baseUrl: { default: 'localhost' },
        port: { default: 7512 },
      }

    }
  ],
  tags: [],
  schemes: [ 'https', 'http' ],
  paths: {},
  components: {}
};
*/