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< securityByMiddleware = const <String, List<Map<String, List<String>>>>{}, OpenApiRegistry registry = const OpenApiRegistry(), DocsUi ui = DocsUi.scalar, ScalarOptions scalar = const ScalarOptions(), String? pageTitle})Map< >String, List< >String> > -
const
Properties
- enabled → bool?
-
Serve the docs routes. When null, they are on only when
APP_ENVisdevelopmentorlocal, 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
/docspage. Uses Info.title when null.final - registry → OpenApiRegistry
-
What
dox_builderfound in the code: controller docs, route calls and model schemas. PassopenApiRegistryfrom the generatedlib/openapi.g.dart. Rundart run build_runner buildto 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.
AuthMiddlewaregetsbearerAuthwhen 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
/docspage. 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