mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-19 23:30:56 +00:00
* copy mustache templates from dart generator * Start with generator by copying the DartClientCodegen for now * at least we know this is not for a browser.. * First working version for a simple swagger configuration * remove browserClient parameter, since it doesn't make sense for flutter * Take care of complex types to support object hierarchies * add null safety * add small test for options * add flutter-petstore scripts * generate flutter petstore output * Add new flutter test project * move generated client to make it usable * use generated swagger petstore plugin * add support for lists of objects * add DateTime support * fix listFromJson implementation * fix NPEs in DateTime operations + place order in sample * Small readme changes * bugfixes * Use flutter-compatible implementation as default dart implementation * fix generated samples * Make lists serializable, now all dart test cases are working again * better list implementation * use StringBuffer * removed FlutterClientCodegen * fix browser client * fix dependencies * swagger-browser-client for browserClient testcases * fix scripts * removed flutter scripts * add map support and simplify code via using .toJson contract * remove unneeded devDependencies * Regenerated samples * fix call to mapFromJson, it is not a constructor * remove pointless string serialization * regenerated dart samples
To run these tests:
Simply start the dart server: pub serve
then open http://127.0.0.1:8080/tests.html
This already starts the tests. There is NO feedback!
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
changenew BrowserClient()
tonew Client()
- in
lib/api.dart
remove the lineimport 'package:http/browser_client.dart';
Then run test/tests.dart
.
Have fun.