OpenApiConfig class

OpenAPI docs for the app: /docs, /openapi.json and /openapi.yaml.

import 'package:my_app/openapi.g.dart';

OpenApiConfig(
  info: Info(title: 'Blog API', version: '1.0.0'),
  registry: openApiRegistry,
);

The page at /docs uses Scalar. Use ui: DocsUi.swagger for Swagger UI.

Constructors

OpenApiConfig({bool? enabled, Info info = const Info(title: 'Dox API', version: '1.0.0'), List<Server> servers = const <Server>[], Map<String, SecurityScheme> securitySchemes = const <String, SecurityScheme>{}, Map<String, List<Map<String, List<String>>>> securityByMiddleware = const <String, List<Map<String, List<String>>>>{}, OpenApiRegistry registry = const OpenApiRegistry(), DocsUi ui = DocsUi.scalar, ScalarOptions scalar = const ScalarOptions(), String? pageTitle})
const

Properties

enabled → bool?
Serve the docs routes. When null, they are on only when APP_ENV is development or local, so production is off by default.
final
hashCode → int
The hash code for this object.
no setterinherited
info → Info
Title and version of the API.
final
isEnabled → bool
true when the docs routes are served
no setter
pageTitle → String?
Title of the /docs page. Uses Info.title when null.
final
registry → OpenApiRegistry
What dox_builder found in the code: controller docs, route calls and model schemas. Pass openApiRegistry from the generated lib/openapi.g.dart. Run dart run build_runner build to make it.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scalar → ScalarOptions
Options for the Scalar page: theme, dark mode, download button and proxy.
final
securityByMiddleware → Map<String, List<Map<String, List<String>>>>
Security for routes that use a middleware class with this name. AuthMiddleware gets bearerAuth when it is not in this map.
final
securitySchemes → Map<String, SecurityScheme>
Ways to log in, like {'bearerAuth': SecurityScheme.bearer()}.
final
servers → List<Server>
Base URLs of the API.
final
ui → DocsUi
The UI of the /docs page. Scalar by default.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited