diff --git a/.github/.test/samples.json b/.github/.test/samples.json index 86f0d8d410e8..7c1fa1e23353 100644 --- a/.github/.test/samples.json +++ b/.github/.test/samples.json @@ -145,12 +145,6 @@ "Documentation: Cwiki" ] }, - { - "input": "dart-flutter-petstore.sh", - "matches": [ - "Client: Dart" - ] - }, { "input": "dart-jaguar-petstore.sh", "matches": [ diff --git a/bin/dart-flutter-petstore.sh b/bin/dart-flutter-petstore.sh deleted file mode 100755 index af3aaca2bec8..000000000000 --- a/bin/dart-flutter-petstore.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -SCRIPT="$0" - -while [ -h "$SCRIPT" ] ; do - ls=`ls -ld "$SCRIPT"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - SCRIPT="$link" - else - SCRIPT=`dirname "$SCRIPT"`/"$link" - fi -done - -if [ ! -d "${APP_DIR}" ]; then - APP_DIR=`dirname "$SCRIPT"`/.. - APP_DIR=`cd "${APP_DIR}"; pwd` -fi - -executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" - -if [ ! -f "$executable" ] -then - mvn -B clean package -fi - -# if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" - -## Generate non-browserClient -#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger --additional-properties hideGenerationTimestamp=true,browserClient=false $@" -# -## then options to generate the library for vm would be: -##ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger_vm --additional-properties browserClient=false,pubName=swagger_vm $@" -#java $JAVA_OPTS -jar $executable $ags -# -## Generate browserClient -#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@" -#java $JAVA_OPTS -jar $executable $ags - -# Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/swagger --additional-properties hideGenerationTimestamp=true,browserClient=false $@" -java $JAVA_OPTS -jar $executable $ags - -# There is a proposal to allow importing different libraries depending on the environment: -# https://github.com/munificent/dep-interface-libraries -# When this is implemented there will only be one library. - -# The current petstore test will then work for both: the browser library and the vm library. - diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index 66e2fca4b528..f31a7601fa2c 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -59,7 +59,6 @@ declare -a scripts=( "./bin/apex-petstore.sh" "./bin/perl-petstore-all.sh" "./bin/dart-jaguar-petstore.sh" -"./bin/dart-flutter-petstore.sh" "./bin/dart-petstore.sh" "./bin/dart2-petstore.sh" "./bin/java-play-framework-petstore-server-all.sh" diff --git a/modules/openapi-generator/src/main/resources/dart2/README.mustache b/modules/openapi-generator/src/main/resources/dart2/README.mustache index eab8ee0ea7ac..adb290777ac1 100644 --- a/modules/openapi-generator/src/main/resources/dart2/README.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/README.mustache @@ -19,24 +19,20 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Requirements -Dart 1.20.0 or later OR Flutter 0.0.20 or later +Dart 2.0 or later ## Installation & Usage ### Github -If this Dart package is published to Github, please include the following in pubspec.yaml +If this Dart package is published to Github, add the following dependency to your pubspec.yaml ``` -name: {{pubName}} -version: {{pubVersion}} -description: {{pubDescription}} dependencies: {{pubName}}: git: https://github.com/{{gitUserId}}/{{gitRepoId}}.git - version: 'any' ``` ### Local -To use the package in your local drive, please include the following in pubspec.yaml +To use the package in your local drive, add the following dependency to your pubspec.yaml ``` dependencies: {{pubName}}: diff --git a/samples/client/petstore/dart2/openapi/README.md b/samples/client/petstore/dart2/openapi/README.md index e78e0e3e6978..a32c667b4ee4 100644 --- a/samples/client/petstore/dart2/openapi/README.md +++ b/samples/client/petstore/dart2/openapi/README.md @@ -8,24 +8,20 @@ This Dart package is automatically generated by the [OpenAPI Generator](https:// ## Requirements -Dart 1.20.0 or later OR Flutter 0.0.20 or later +Dart 2.0 or later ## Installation & Usage ### Github -If this Dart package is published to Github, please include the following in pubspec.yaml +If this Dart package is published to Github, add the following dependency to your pubspec.yaml ``` -name: openapi -version: 1.0.0 -description: OpenAPI API client dependencies: openapi: git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git - version: 'any' ``` ### Local -To use the package in your local drive, please include the following in pubspec.yaml +To use the package in your local drive, add the following dependency to your pubspec.yaml ``` dependencies: openapi: diff --git a/samples/client/petstore/dart2/petstore/README.md b/samples/client/petstore/dart2/petstore/README.md index 17343a5c026a..2adfc09c8a36 100644 --- a/samples/client/petstore/dart2/petstore/README.md +++ b/samples/client/petstore/dart2/petstore/README.md @@ -1,58 +1,11 @@ -# To run these tests: +## If not already done, resolve dependencies -Simply start the dart server: `pub serve` +`pub get` -then open http://127.0.0.1:8080/tests.html +## To run tests in a single file: +`pub run test test/pet_test.dart` -This already starts the tests. There is _NO_ feedback! +## To run all tests in the test folder: -Open the javascript / dart console of your browser to verify all tests -passed successfully. - -You should have the following output: -``` -Observatory listening at http://127.0.0.1:39067/ -unittest-suite-wait-for-done -GET http://petstore.swagger.io/v2/pet/957639 404 (Not Found) -GET http://petstore.swagger.io/v2/pet/525946 404 (Not Found) -GET http://petstore.swagger.io/v2/store/order/29756 404 (Not Found) -GET http://petstore.swagger.io/v2/user/Riddlem325 404 (Not Found) -PASS: Pet API adds a new pet and gets it by id -PASS: Pet API doesn't get non-existing pet by id -PASS: Pet API deletes existing pet by id -PASS: Pet API updates pet with form -PASS: Pet API updates existing pet -PASS: Pet API finds pets by status -PASS: Pet API finds pets by tag -PASS: Pet API uploads a pet image -PASS: Store API places an order and gets it by id -PASS: Store API deletes an order -PASS: Store API gets the store inventory -PASS: User API creates a user -PASS: User API creates users with list input -PASS: User API updates a user -PASS: User API deletes a user -PASS: User API logs a user in - -All 16 tests passed. -unittest-suite-success -``` - - -You may also run the tests in the dart vm. - -Either generate the test-package for a vm: -- change bin/dart-petstore.sh and uncomment the vm options line -- run bin/dart-petstore.sh - -or - -- in `lib/api_client.dart` change `new BrowserClient()` to `new Client()` -- in `lib/api.dart` remove the line `import 'package:http/browser_client.dart';` - - - -Then run `test/tests.dart`. - -Have fun. \ No newline at end of file +`pub run test test` \ No newline at end of file diff --git a/samples/client/petstore/dart2/petstore/pubspec.yaml b/samples/client/petstore/dart2/petstore/pubspec.yaml index d84c7ac32024..1d77c96e46af 100644 --- a/samples/client/petstore/dart2/petstore/pubspec.yaml +++ b/samples/client/petstore/dart2/petstore/pubspec.yaml @@ -6,8 +6,5 @@ environment: dependencies: openapi: path: ../openapi - test: ^1.3.0 dev_dependencies: - build_runner: ^0.10.1+1 - build_test: ^0.10.3+1 - build_web_compilers: ^0.4.2+2 + test: ^1.6.8