open_api 2.0.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 79

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 pub get

Alternatively, your editor might support pub get or flutter pub 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]
63
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]
79
Learn more about scoring.

We analyzed this package on Jun 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.1
  • pana: 0.12.17

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in libraries.

Health suggestions

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.)

Maintenance suggestions

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.

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.7
Dev dependencies
test ^1.3.0