graphql_starwars_test_server 0.0.4

A simple starwars schema server adapted from the angel starwars example for use in testing graphql clients, such as graphql_flutter.

The schema it aims to implement is in schema.graphql, and the seed data is mostly in data.json. The server is heavily limited:

  • recursive relationships aren't supported
  • it doesn't serve a schema
  • a lot of mutations seem broken

To run, add as a dependency and

pub run graphql_starwars_test_server
  # --host 127.0.0.1
  # --port 3000

Here are some working test operations:

mutation {
  modifyHuman(id: "1001", data:{ name: "Anikin" } ){
     id, name, friends { name }
  }
}

{
  humans {
    id, name, friends { name }
  }
}

subscription reviewAdded {
  reviewAdded {
    stars, commentary, episode
  }
}

The server will generate a fake review for testing streams every 10 seconds, unless the env variable GENERATE_REVIEWS=false

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate graphql_starwars_test_server

2. Use it

The package has the following executables:


$ serve

Use this package as a library

1. Depend on it

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


dependencies:
  graphql_starwars_test_server: ^0.0.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:graphql_starwars_test_server/graphql_starwars_test_server.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
73
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
77
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: other

Primary library: package:graphql_starwars_test_server/graphql_starwars_test_server.dart with components: io, mirrors.

Health issues and suggestions

Document public APIs. (-1 points)

10 out of 10 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/pretty_logging.dart. (-1.99 points)

Analysis of lib/src/pretty_logging.dart reported 4 hints:

line 26 col 5: DO use curly braces for all flow control structures.

line 28 col 5: DO use curly braces for all flow control structures.

line 30 col 5: DO use curly braces for all flow control structures.

line 32 col 5: DO use curly braces for all flow control structures.

Fix lib/graphql_starwars_test_server.dart. (-1 points)

Analysis of lib/graphql_starwars_test_server.dart reported 2 hints:

line 217 col 25: The for, if, and spread elements weren't supported until version 2.2.2, but this code is required to be able to run on earlier versions.

line 217 col 44: The for, if, and spread elements weren't supported until version 2.2.2, but this code is required to be able to run on earlier versions.

Fix lib/src/models.dart. (-0.50 points)

Analysis of lib/src/models.dart reported 1 hint:

line 131 col 21: Use = to separate a named parameter from its default value.

Format lib/src/data.dart.

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

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

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 graphql_starwars_test_server.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
angel_framework ^2.0.1 2.0.4+1 2.0.5-beta
angel_graphql ^1.0.0 1.0.0
angel_http_exception ^1.0.1 1.1.0
angel_model ^1.0.0 1.0.3
angel_serialize ^2.0.0 2.2.3+3
angel_typed_service ^1.0.1 1.0.1
args ^1.5.1 1.5.2
async ^2.2.0 2.4.0
graphql_parser ^1.1.4 1.1.4
graphql_schema ^1.0.4 1.0.4
graphql_server ^1.0.2 1.0.2
io ^0.3.2 0.3.3
logging ^0.11.3 0.11.3+2
Transitive dependencies
angel_auth 2.1.5+1
angel_client 2.0.2
angel_container 1.1.0
angel_file_service 2.0.1
angel_route 3.0.6
angel_validate 2.0.2 3.0.0-alpha
angel_websocket 2.0.3
charcode 1.1.2
code_buffer 1.0.1
collection 1.14.12
combinator 1.1.0
convert 2.1.1
crypto 2.1.3
dart2_constant 1.0.2+dart2
file 5.1.0
http 0.12.0+2
http2 1.0.0
http_parser 3.1.3
http_server 0.9.8+3
intl 0.16.0
json_god 2.0.0-beta+3
matcher 0.12.6
merge_map 1.0.2
meta 1.1.7
mime 0.9.6+3
mock_request 1.0.6
path 1.6.4
pedantic 1.8.0+1
pool 1.4.0
quiver 2.0.5
quiver_hashcode 2.0.0
recase 2.0.1
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
tuple 1.0.3
typed_data 1.1.6
uuid 2.0.2
web_socket_channel 1.1.0
Dev dependencies
angel_serialize_generator ^2.0.0
build_runner ^1.0.0
graphql_generator ^1.0.0