open_api 2.0.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 80

open_api_dart

Reads and writes OpenAPI (Swagger) specifications.

Example

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

Changelog

2.0.1

  • Fix bug when merging APIResponse bodies

2.0.0

  • Update for Dart 2

1.0.2

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

1.0.1

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

1.0.0

  • 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'.

0.9.1

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

0.9.0

  • 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:


dependencies:
  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...

Popularity:
Describes how popular the package is relative to other packages. [more]
64
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

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.

Dependencies

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