discoveryapis_generator 0.9.5

  • Installing
  • Versions
  • 85


Build Status


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.


$ 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


  • More type annotations for Dart 2.


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


  • Minor cleanups.


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


  • Widen dependency constraint on package:args.


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


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


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


  • Make package:discoveryapis_generator strong mode clean.


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


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


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


  • Make findPackageRoot handle 'file:' paths.


  • Fix bug in windows path handling.


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


  • Updated README


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


  • 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









1. Depend on it

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

  discoveryapis_generator: "^0.9.5"

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:discoveryapis_generator/discoveryapis_generator.dart';
Version Uploaded Documentation Archive
0.9.5 Apr 19, 2018 Go to the documentation of discoveryapis_generator 0.9.5 Download discoveryapis_generator 0.9.5 archive
0.9.4 Feb 19, 2018 Go to the documentation of discoveryapis_generator 0.9.4 Download discoveryapis_generator 0.9.4 archive
0.9.3 Jan 26, 2018 Go to the documentation of discoveryapis_generator 0.9.3 Download discoveryapis_generator 0.9.3 archive
0.9.2 Oct 17, 2017 Go to the documentation of discoveryapis_generator 0.9.2 Download discoveryapis_generator 0.9.2 archive
0.9.1+2 Oct 5, 2017 Go to the documentation of discoveryapis_generator 0.9.1+2 Download discoveryapis_generator 0.9.1+2 archive
0.9.1+1 Oct 5, 2017 Go to the documentation of discoveryapis_generator 0.9.1+1 Download discoveryapis_generator 0.9.1+1 archive
0.9.1 Sep 11, 2017 Go to the documentation of discoveryapis_generator 0.9.1 Download discoveryapis_generator 0.9.1 archive
0.9.0 Jun 12, 2017 Go to the documentation of discoveryapis_generator 0.9.0 Download discoveryapis_generator 0.9.0 archive
0.8.0+2 May 23, 2017 Go to the documentation of discoveryapis_generator 0.8.0+2 Download discoveryapis_generator 0.8.0+2 archive
0.8.0+1 Apr 26, 2016 failed Download discoveryapis_generator 0.8.0+1 archive

All 17 versions...


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

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


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


Detected platforms: Flutter, other

Primary library: package:discoveryapis_generator/discoveryapis_generator.dart with components: io, isolate.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 13 hints.

    Strong-mode analysis of lib/src/generated_googleapis/src/common_internal.dart failed with the following error:

    line: 303 col: 7
    Missing concrete implementations of 'StreamTransformer.cast' and 'StreamTransformer.retype'.

    Strong-mode analysis of lib/discoveryapis_generator.dart gave the following hint:

    line: 56 col: 9
    'JSON' is deprecated and shouldn't be used.

    Similar analysis of the following files failed:

    • lib/src/apis_files_generator.dart (hint)
  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use discoveryapis_generator.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.21.0 <2.0.0
args >=0.12.1 <2.0.0 1.4.2
dart_style >=1.0.7 <=1.0.9+1 1.0.9+1 1.0.10
http >=0.11.1 <0.12.0 0.11.3+16
path >=1.3.3 <2.0.0 1.5.1
yaml >=2.0.0 <3.0.0 2.1.13
Transitive dependencies
analyzer 0.31.1 0.31.2-alpha.1
async 2.0.6
charcode 1.1.1
cli_util 0.1.2+1
collection 1.14.9
convert 2.0.1
crypto 2.0.2+1
csslib 0.14.1
front_end 0.1.0-alpha.9 0.1.0-alpha.11
glob 1.1.5
html 0.13.3
http_parser 3.1.1
isolate 1.1.0 2.0.0
kernel 0.3.0-alpha.9 0.3.0-alpha.11
logging 0.11.3+1
meta 1.1.2
package_config 1.0.3
plugin 0.2.0+2
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
Dev dependencies
_discoveryapis_commons any
test ^0.12.0