open_api 1.0.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 75

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

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

1. Depend on it

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


dependencies:
  open_api: "^1.0.2"

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

Analysis

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

  • Dart: 2.0.0-dev.46.0
  • pana: 0.10.6

Scores

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

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in libraries.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 warning 16 hints.

    Strong-mode analysis of lib/src/v3/callback.dart gave the following warning:

    line: 21 col: 20
    A function of type '(String, JSONObject) → Null' can't be assigned to a location of type '(String, dynamic) → void'.

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

    Similar analysis of the following files failed:

    • lib/src/util.dart (hint)
    • lib/src/v2/document.dart (hint)
    • lib/src/v3/components.dart (hint)
    • lib/src/v3/document.dart (hint)
    • lib/src/v3/encoding.dart (hint)
    • lib/src/v3/metadata.dart (hint)
    • lib/src/v3/operation.dart (hint)
    • lib/src/v3/parameter.dart (hint)
    • lib/src/v3/path.dart (hint)
    • lib/src/v3/request_body.dart (hint)
    • lib/src/v3/response.dart (hint)
    • lib/src/v3/schema.dart (hint)
    • lib/src/v3/security.dart (hint)
    • lib/src/v3/server.dart (hint)
  • Maintain an example.

    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 >=1.20.1 <2.0.0
meta ^1.1.2 1.1.2
Dev dependencies
test ^0.12.0