discoveryapis_generator 0.9.11

discoveryapis_generator #

Build Status

Description #

Dart application to generate Dart API Client Libraries based on discovery documents.

This package is used to generate client libraries for packages exposing a REST API using the package:rpc package.

Usage #

$ dart bin/generate.dart -h
The discovery generator supports the following subcommands:


The 'package' subcommand generates an API package from already downloaded
discovery documents. It takes the following options:

-i, --input-dir              Input directory of discovery documents.
                             (defaults to "googleapis-discovery-documents")

-o, --output-dir             Output directory of the generated API package.
                             (defaults to "googleapis")

    --package-name           Name of the generated API package.
                             (defaults to "googleapis")

    --package-version        Version of the generated API package.
                             (defaults to "0.1.0-dev")

    --package-description    Description of the generated API package.
                             (defaults to "Auto-generated client libraries.")

    --package-author         Author of the generated API package.
    --package-homepage       Homepage of the generated API package.

The 'files' subcommand generates API files into an existing package from already
downloaded discovery documents. One file per API. It takes the following

-i, --input-dir             Input directory of discovery documents.
-o, --output-dir            Output directory of the generated API files.
-u, --update-pubspec        Update the pubspec.yaml file with required dependencies. This will remove comments and might change the layout of the pubspec.yaml file.
                            (defaults to "false")

    --[no-]core-prefixes    Use or remove an import prefix for dart:core
                            (defaults to on)

Changelog - discoveryapis_generator #

v0.9.11 #

  • Support methods that have uploadMedia, but are not resumable.
  • Fixed test generator adding dataWrapper support.

v0.9.10 #

  • Widen constraint on package:http to allow version 0.12.0

v0.9.9 #

  • Generate packages with pubspecs that accept sdk 2.0.0 and above.

v0.9.8 #

  • Make the generator Dart 2.0 clean.

v0.9.7 #

  • Support data-wrapping of response bodies. This is a deprecated feature, but it is being used by the Translate v2 API.
  • Ignore unnecessary_cast lint in generated files.
  • Add .toDouble() conversion where necessary.

v0.9.6 #

  • More Dart 2 fixes. Add .map() and .cast() to Lists and Maps to get the types right at runtime.

v0.9.5 #

  • More type annotations for Dart 2.

v0.9.4 #

  • Use type arguments for Map, since dynamic is no longer bottom.
  • Avoid unnecessary imports of dart:convert.

v0.9.3 #

  • Minor cleanups.

v0.9.2 #

  • Add support for global request parameters, currently whitelisted to only allow "fields".

v0.9.1+2 #

  • Widen dependency constraint on package:args.

v0.9.1+1 #

  • Use < 2.0.0 sdk constraint in generated pubspec.yaml files (following the new guideline).

v0.9.1 #

  • Avoid unused imports in generated tests.
  • Use new-style /// comments for generated code.
  • Use package:dart_style for formatting the generated code.
  • Use < 2.0.0-dev.infinity sdk constraint in generated pubspec.yaml files.

v0.9.0 #

  • Make generated code strong mode clean.
  • Make generated code use package:test instead of package:unittest.

v0.8.0+2 #

  • Make package:discoveryapis_generator strong mode clean.

v0.8.0+1 #

  • Require at least Dart 1.14 for generated libraries. Code requires dart:convert BASE64 which was added to that release.

v0.8.0 #

  • Remove crypto dependency from generated libraries and upgrade sdk dependency to dart 1.13

v0.7.2 #

  • Update the code generator to only generate imports for libraries that are used (this avoids having analysis warnings for unused imports in the generate code).
  • Add a command-line option to not generate library prefixes for the dart:core and dart:async libraries (--no-core-prefixes).

v0.7.1+1 #

  • Make findPackageRoot handle 'file:' paths.

v0.7.1 #

  • Fix bug in windows path handling.

v0.7.0 #

  • Add support for generating API files inside an existing package instead of generating an entirely new package.
  • Changed the generators command names to 'package' and 'files' respectively to make it clear what is being generated.
  • Added support for generating a client stub API using the same message classes as used on the server.

v0.6.1 #

  • Updated README

v0.6.0 #

  • Change generator to use the discoveryapis_commons package for generated code
  • Remove googleapis commands and split out separate googleapis library

v0.5.0 #

  • Merged new generator implementation from experimental branch to master

0.4.5 2014-05-16 (SDK 1.4.0-dev.6.7 r36210) #

  • Set uploadType as multipart by default
  • Rev up bot_io

0.4.4 2014-03-22 (SDK 1.3.0-dev.5.2 r34229) #

  • Added Geo JSON support
  • Added support for schema array object
  • Added support for schema any object
  • Updated generated dependencies
  • Cleaned up hop runner

v0.4.3 #

v0.4.2 #

v0.4.1 #

v0.4.0 #

v0.3.0 #

v0.2.8 #

v0.2.6 #

v0.2.5 #

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate discoveryapis_generator

2. Use it

The package has the following executables:

$ discoveryapis_generator

Use this package as a library

1. Depend on it

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

  discoveryapis_generator: ^0.9.11

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:discoveryapis_generator/discoveryapis_generator.dart';
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 Feb 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/src/dart_schemas.dart. (-25 points)

Analysis of lib/src/dart_schemas.dart reported 78 hints, including:

line 29 col 22: Unnecessary new keyword.

line 30 col 23: Unnecessary new keyword.

line 31 col 29: Unnecessary new keyword.

line 32 col 22: Unnecessary new keyword.

line 33 col 23: Unnecessary new keyword.

Fix lib/src/generated_googleapis/discovery/v1.dart. (-25 points)

Analysis of lib/src/generated_googleapis/discovery/v1.dart reported 63 hints, including:

line 23 col 31: Unnecessary new keyword.

line 26 col 27: Use = to separate a named parameter from its default value.

line 27 col 30: Use = to separate a named parameter from its default value.

line 29 col 13: Unnecessary new keyword.

line 57 col 9: Don't explicitly initialize variables to null.

Fix lib/src/generated_googleapis/src/clients.dart. (-25 points)

Analysis of lib/src/generated_googleapis/src/clients.dart reported 70 hints, including:

line 17 col 1: Prefer using /// for doc comments.

line 32 col 3: Prefer using /// for doc comments.

line 53 col 54: Use = to separate a named parameter from its default value.

line 57 col 13: Unnecessary new keyword.

line 84 col 17: Unnecessary new keyword.

Fix additional 15 files with analysis or formatting issues. (-107.04 points)

Additional issues in the following files:

  • lib/src/dart_api_test_library.dart (41 hints)
  • lib/src/dart_resources.dart (41 hints)
  • lib/src/generated_googleapis/src/requests.dart (36 hints)
  • lib/src/namer.dart (24 hints)
  • lib/src/apis_files_generator.dart (18 hints)
  • lib/src/client/client_schemas.dart (13 hints)
  • lib/src/uri_template.dart (10 hints)
  • lib/src/apis_package_generator.dart (9 hints)
  • lib/discoveryapis_generator.dart (8 hints)
  • lib/src/utils.dart (7 hints)
  • lib/src/dart_api_library.dart (6 hints)
  • lib/src/dart_comments.dart (5 hints)
  • bin/generate.dart (4 hints)
  • lib/src/client/client_api_library.dart (4 hints)
  • lib/clientstub_generator.dart (2 hints)

Maintenance suggestions

Package is getting outdated. (-3.29 points)

The package was last published 53 weeks ago.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and discoveryapis_generator.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.22.0 <3.0.0
args >=0.12.1 <2.0.0 1.5.2
dart_style >=1.0.7 <=2.0.0 1.3.3
http >=0.11.1 <0.13.0 0.12.0+4
path >=1.3.3 <2.0.0 1.6.4
yaml >=2.0.0 <3.0.0 2.2.0
Transitive dependencies
_fe_analyzer_shared 1.0.3
analyzer 0.39.4
async 2.4.0
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
glob 1.2.0
html 0.14.0+3
http_parser 3.1.3
js 0.6.1+1
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
pedantic 1.9.0
pub_semver 1.4.3
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+13
Dev dependencies
_discoveryapis_commons >=0.1.0 <0.2.0
test >0.12.0 <2.0.0