Reads and writes OpenAPI (Swagger) specifications.
final file = new File("test/specs/kubernetes.json");
final contents = await file.readAsString();
final doc = new APIDocument.fromJSON(contents);
final output = JSON.encode(doc.asMap());
APIResponse.addHeader
and APIResponse.addContent
.APIOperation.addResponse
.APISchemaObject.isFreeForm
and related support for free-form schema objects.APISchema
, APIHeader
and APIParameter
into APIProperty
.Add this to your package's pubspec.yaml file:
dependencies:
open_api: ^2.0.1
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter packages get
Alternatively, your editor might support pub get
or flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:open_api/v2.dart';
import 'package:open_api/v3.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
2.0.1 | Sep 1, 2018 |
|
|
2.0.0 | Aug 6, 2018 |
|
|
1.0.2 | Feb 14, 2018 |
|
|
1.0.1 | Feb 3, 2018 |
|
|
1.0.0 | Jan 29, 2018 |
|
|
0.9.1 | Oct 11, 2017 |
|
|
0.9.0 | Oct 8, 2017 |
|
|
2.0.0-beta.4 | Jul 11, 2018 |
|
|
2.0.0-beta.3 | May 29, 2018 |
|
|
2.0.0-beta.2 | May 29, 2018 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
54
|
Health:
Code health derived from static analysis.
[more]
|
97
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
90
|
Overall:
Weighted score of the above.
[more]
|
74
|
We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, web, other
No platform restriction found in libraries.
Fix lib/src/v3/schema.dart
. (-1 points)
Analysis of lib/src/v3/schema.dart
reported 2 hints:
line 25 col 74: Use =
to separate a named parameter from its default value.
line 46 col 45: Use =
to separate a named parameter from its default value.
Fix lib/src/object.dart
. (-0.50 points)
Analysis of lib/src/object.dart
reported 1 hint:
line 23 col 9: Use isNotEmpty instead of length
Fix lib/src/v2/security.dart
. (-0.50 points)
Analysis of lib/src/v2/security.dart
reported 1 hint:
line 50 col 94: Use =
to separate a named parameter from its default value.
Fix additional 14 files with analysis or formatting issues. (-1.50 points)
Additional issues in the following files:
lib/src/v3/components.dart
(1 hint)lib/src/v3/request_body.dart
(1 hint)lib/src/v3/response.dart
(1 hint)lib/src/v2/document.dart
(Run dartfmt
to format lib/src/v2/document.dart
.)lib/src/v2/schema.dart
(Run dartfmt
to format lib/src/v2/schema.dart
.)lib/src/v3/callback.dart
(Run dartfmt
to format lib/src/v3/callback.dart
.)lib/src/v3/document.dart
(Run dartfmt
to format lib/src/v3/document.dart
.)lib/src/v3/encoding.dart
(Run dartfmt
to format lib/src/v3/encoding.dart
.)lib/src/v3/metadata.dart
(Run dartfmt
to format lib/src/v3/metadata.dart
.)lib/src/v3/operation.dart
(Run dartfmt
to format lib/src/v3/operation.dart
.)lib/src/v3/parameter.dart
(Run dartfmt
to format lib/src/v3/parameter.dart
.)lib/src/v3/path.dart
(Run dartfmt
to format lib/src/v3/path.dart
.)lib/src/v3/security.dart
(Run dartfmt
to format lib/src/v3/security.dart
.)lib/src/v3/server.dart
(Run dartfmt
to format lib/src/v3/server.dart
.)Maintain an example. (-10 points)
Create a short demo in the example/
directory to show how to use this package.
Common filename patterns include main.dart
, example.dart
, and open_api.dart
. Packages with multiple examples should provide example/README.md
.
For more information see the pub package layout conventions.