open_api 2.0.1

  • Installing
  • Versions
  • 79


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());



  • Fix bug when merging APIResponse bodies


  • Update for Dart 2


  • Adds APIResponse.addHeader and APIResponse.addContent.
  • Adds APIOperation.addResponse.


  • Adds APISchemaObject.isFreeForm and related support for free-form schema objects.


  • Adds support for OpenAPI 3.0
  • Splits Swagger (2.0) and OpenAPI (3.0) into 'package:open_api/v2.dart' and 'package:open_api/v3.dart'.


  • Moves shared properties from APISchema, APIHeader and APIParameter into APIProperty.


  • Initial data structures
  • Parsing specifications
  • Writing specifications to disk

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  open_api: ^2.0.1

2. Install it

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.

3. Import it

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 Go to the documentation of open_api 2.0.1 Download open_api 2.0.1 archive
2.0.0 Aug 6, 2018 Go to the documentation of open_api 2.0.0 Download open_api 2.0.0 archive
1.0.2 Feb 14, 2018 Go to the documentation of open_api 1.0.2 Download open_api 1.0.2 archive
1.0.1 Feb 3, 2018 Go to the documentation of open_api 1.0.1 Download open_api 1.0.1 archive
1.0.0 Jan 29, 2018 Go to the documentation of open_api 1.0.0 Download open_api 1.0.0 archive
0.9.1 Oct 11, 2017 Go to the documentation of open_api 0.9.1 Download open_api 0.9.1 archive
0.9.0 Oct 8, 2017 Go to the documentation of open_api 0.9.0 Download open_api 0.9.0 archive
2.0.0-beta.4 Jul 11, 2018 Go to the documentation of open_api 2.0.0-beta.4 Download open_api 2.0.0-beta.4 archive
2.0.0-beta.3 May 29, 2018 Go to the documentation of open_api 2.0.0-beta.3 Download open_api 2.0.0-beta.3 archive
2.0.0-beta.2 May 29, 2018 Go to the documentation of open_api 2.0.0-beta.2 Download open_api 2.0.0-beta.2 archive

All 12 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7


Detected platforms: Flutter, web, other

No platform restriction found in libraries.

Health suggestions

Format lib/src/object.dart.

Run dartfmt to format lib/src/object.dart.

Format lib/src/v2/document.dart.

Run dartfmt to format lib/src/v2/document.dart.

Format lib/src/v2/schema.dart.

Run dartfmt to format lib/src/v2/schema.dart.

Fix additional 14 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/v2/security.dart (Run dartfmt to format lib/src/v2/security.dart.)
  • lib/src/v3/callback.dart (Run dartfmt to format lib/src/v3/callback.dart.)
  • lib/src/v3/components.dart (Run dartfmt to format lib/src/v3/components.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/request_body.dart (Run dartfmt to format lib/src/v3/request_body.dart.)
  • lib/src/v3/response.dart (Run dartfmt to format lib/src/v3/response.dart.)
  • lib/src/v3/schema.dart (Run dartfmt to format lib/src/v3/schema.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.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use open_api.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
codable ^1.0.0 1.0.0
meta ^1.1.5 1.1.6
Dev dependencies
test ^1.3.0