SwaggerUI class
This class starts all the default attributes to start swagger-ui.
In addition to receiving the Spec (YAML/JSON)
it is also possible to configure the title and enable "deepLink".
fileSchemaPath
: Schema path (YAML/JSON).
title: Defines the title that is visible in the browser tab.
docExpansion: (Default DocExpansion.list), Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing).
deepLink: (Default true) enables the use of deep-links to reference each node in the url (ex: /swagger/#/post).
syntaxHighlightTheme: (Default SyntaxHighlightTheme.agate) Highlight.js syntax coloring theme to use. (Only these 6 styles are available).
persistAuthorization: (Default false) If set to true, it persists authorization data and it would not be lost on browser close/refresh.
Example:
final swaggerHandler = SwaggerUI.fromFile(
File('swagger/swagger.yaml'),
title: 'Swagger API',
deepLink: true,
);
var server = await io.serve(swaggerHandler, '0.0.0.0', 4000);
Constructors
- SwaggerUI.new(String schemaText, {SpecType specType = SpecType.json, String title = 'API Swagger', DocExpansion docExpansion = DocExpansion.list, SyntaxHighlightTheme syntaxHighlightTheme = SyntaxHighlightTheme.agate, bool deepLink = false, bool persistAuthorization = false})
Properties
- deepLink → bool
-
(Default false) enables the use of deep-links to reference each node in the url (ex: /swagger/#/post).
final
- docExpansion → DocExpansion
-
Controls the default expansion setting for the operations and tags.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- persistAuthorization → bool
-
If set to true, it persists authorization data and it would not be lost on browser close/refresh
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schemaText → String
-
Schema text (YAML/JSON).
final
- specType → SpecType
-
Type Schema (YAML/JSON).
final
- syntaxHighlightTheme → SyntaxHighlightTheme
-
Highlight.js syntax coloring theme to use. (Only these 6 styles are available).
final
- title → String
-
Defines the title that is visible in the browser tab.
final
Methods
-
call(
Request request) → FutureOr< Response> -
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
Static Methods
-
fromFile(
File fileSchema, {String title = 'API Swagger', DocExpansion docExpansion = DocExpansion.list, SyntaxHighlightTheme syntaxHighlightTheme = SyntaxHighlightTheme.agate, bool deepLink = false, bool persistAuthorization = false}) → SwaggerUI