Skip to content

Commit 3be1196

Browse files
nickmeinholdwing328
authored andcommitted
[Dart] Fix README template and update testing doco (#3809)
* [Dart] Fix README template and update testing doco - deleted redundant shell script - fixed and updated README template - updated test package and moved to a dev_dependency - removed old unused dev_dependency packages - updated testing documentation in petstore sample * Remove references to dart-flutter-petstore.sh * Fix typos * Fix typo
1 parent 911cdd8 commit 3be1196

File tree

7 files changed

+13
-128
lines changed

7 files changed

+13
-128
lines changed

.github/.test/samples.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@
145145
"Documentation: Cwiki"
146146
]
147147
},
148-
{
149-
"input": "dart-flutter-petstore.sh",
150-
"matches": [
151-
"Client: Dart"
152-
]
153-
},
154148
{
155149
"input": "dart-jaguar-petstore.sh",
156150
"matches": [

bin/dart-flutter-petstore.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

bin/utils/ensure-up-to-date

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ declare -a scripts=(
5959
"./bin/apex-petstore.sh"
6060
"./bin/perl-petstore-all.sh"
6161
"./bin/dart-jaguar-petstore.sh"
62-
"./bin/dart-flutter-petstore.sh"
6362
"./bin/dart-petstore.sh"
6463
"./bin/dart2-petstore.sh"
6564
"./bin/java-play-framework-petstore-server-all.sh"

modules/openapi-generator/src/main/resources/dart2/README.mustache

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,20 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
1919

2020
## Requirements
2121

22-
Dart 1.20.0 or later OR Flutter 0.0.20 or later
22+
Dart 2.0 or later
2323

2424
## Installation & Usage
2525

2626
### Github
27-
If this Dart package is published to Github, please include the following in pubspec.yaml
27+
If this Dart package is published to Github, add the following dependency to your pubspec.yaml
2828
```
29-
name: {{pubName}}
30-
version: {{pubVersion}}
31-
description: {{pubDescription}}
3229
dependencies:
3330
{{pubName}}:
3431
git: https://github.com/{{gitUserId}}/{{gitRepoId}}.git
35-
version: 'any'
3632
```
3733

3834
### Local
39-
To use the package in your local drive, please include the following in pubspec.yaml
35+
To use the package in your local drive, add the following dependency to your pubspec.yaml
4036
```
4137
dependencies:
4238
{{pubName}}:

samples/client/petstore/dart2/openapi/README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,20 @@ This Dart package is automatically generated by the [OpenAPI Generator](https://
88

99
## Requirements
1010

11-
Dart 1.20.0 or later OR Flutter 0.0.20 or later
11+
Dart 2.0 or later
1212

1313
## Installation & Usage
1414

1515
### Github
16-
If this Dart package is published to Github, please include the following in pubspec.yaml
16+
If this Dart package is published to Github, add the following dependency to your pubspec.yaml
1717
```
18-
name: openapi
19-
version: 1.0.0
20-
description: OpenAPI API client
2118
dependencies:
2219
openapi:
2320
git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git
24-
version: 'any'
2521
```
2622

2723
### Local
28-
To use the package in your local drive, please include the following in pubspec.yaml
24+
To use the package in your local drive, add the following dependency to your pubspec.yaml
2925
```
3026
dependencies:
3127
openapi:
Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,11 @@
1-
# To run these tests:
1+
## If not already done, resolve dependencies
22

3-
Simply start the dart server: `pub serve`
3+
`pub get`
44

5-
then open http://127.0.0.1:8080/tests.html
5+
## To run tests in a single file:
66

7+
`pub run test test/pet_test.dart`
78

8-
This already starts the tests. There is _NO_ feedback!
9+
## To run all tests in the test folder:
910

10-
Open the javascript / dart console of your browser to verify all tests
11-
passed successfully.
12-
13-
You should have the following output:
14-
```
15-
Observatory listening at http://127.0.0.1:39067/
16-
unittest-suite-wait-for-done
17-
GET http://petstore.swagger.io/v2/pet/957639 404 (Not Found)
18-
GET http://petstore.swagger.io/v2/pet/525946 404 (Not Found)
19-
GET http://petstore.swagger.io/v2/store/order/29756 404 (Not Found)
20-
GET http://petstore.swagger.io/v2/user/Riddlem325 404 (Not Found)
21-
PASS: Pet API adds a new pet and gets it by id
22-
PASS: Pet API doesn't get non-existing pet by id
23-
PASS: Pet API deletes existing pet by id
24-
PASS: Pet API updates pet with form
25-
PASS: Pet API updates existing pet
26-
PASS: Pet API finds pets by status
27-
PASS: Pet API finds pets by tag
28-
PASS: Pet API uploads a pet image
29-
PASS: Store API places an order and gets it by id
30-
PASS: Store API deletes an order
31-
PASS: Store API gets the store inventory
32-
PASS: User API creates a user
33-
PASS: User API creates users with list input
34-
PASS: User API updates a user
35-
PASS: User API deletes a user
36-
PASS: User API logs a user in
37-
38-
All 16 tests passed.
39-
unittest-suite-success
40-
```
41-
42-
43-
You may also run the tests in the dart vm.
44-
45-
Either generate the test-package for a vm:
46-
- change bin/dart-petstore.sh and uncomment the vm options line
47-
- run bin/dart-petstore.sh
48-
49-
or
50-
51-
- in `lib/api_client.dart` change `new BrowserClient()` to `new Client()`
52-
- in `lib/api.dart` remove the line `import 'package:http/browser_client.dart';`
53-
54-
55-
56-
Then run `test/tests.dart`.
57-
58-
Have fun.
11+
`pub run test test`

samples/client/petstore/dart2/petstore/pubspec.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,5 @@ environment:
66
dependencies:
77
openapi:
88
path: ../openapi
9-
test: ^1.3.0
109
dev_dependencies:
11-
build_runner: ^0.10.1+1
12-
build_test: ^0.10.3+1
13-
build_web_compilers: ^0.4.2+2
10+
test: ^1.6.8

0 commit comments

Comments
 (0)