diff --git a/bin/dart-petstore.sh b/bin/dart-petstore.sh index 9f59540a5a76..357cbac45fff 100755 --- a/bin/dart-petstore.sh +++ b/bin/dart-petstore.sh @@ -26,9 +26,16 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart" -# for dart vm lib generation: -#ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart --additional-properties browserClient=false" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger" +# then options to generate the library for vm would be: +#ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l dart -o samples/client/petstore/dart/swagger_vm -DbrowserClient=false -DpubName=swagger_vm" 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/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java index a70c5c4c692a..4ad6e85d772e 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/DartClientCodegen.java @@ -140,6 +140,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { final String libFolder = sourceFolder + File.separator + "lib"; supportingFiles.add(new SupportingFile("pubspec.mustache", "", "pubspec.yaml")); + supportingFiles.add(new SupportingFile("analysis_options.mustache", "", ".analysis_options")); supportingFiles.add(new SupportingFile("api_client.mustache", libFolder, "api_client.dart")); supportingFiles.add(new SupportingFile("api_exception.mustache", libFolder, "api_exception.dart")); supportingFiles.add(new SupportingFile("api_helper.mustache", libFolder, "api_helper.dart")); diff --git a/modules/swagger-codegen/src/main/resources/dart/analysis_options.mustache b/modules/swagger-codegen/src/main/resources/dart/analysis_options.mustache new file mode 100644 index 000000000000..518eb901a6ff --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/dart/analysis_options.mustache @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/dart/api.mustache b/modules/swagger-codegen/src/main/resources/dart/api.mustache index 9fcd13914061..cff22ffecf92 100644 --- a/modules/swagger-codegen/src/main/resources/dart/api.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/api.mustache @@ -36,9 +36,13 @@ class {{classname}} { Map headerParams = {}; Map formParams = {}; {{#queryParams}} - if("null" != {{paramName}}) { + {{^required}} + if({{paramName}} != null) { + {{/required}} queryParams.addAll(_convertParametersForCollectionFormat("{{collectionFormat}}", "{{baseName}}", {{paramName}})); + {{^required}} } + {{/required}} {{/queryParams}} {{#headerParams}}headerParams["{{baseName}}"] = {{paramName}}; {{/headerParams}} @@ -84,7 +88,7 @@ class {{classname}} { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return {{#returnType}} apiClient.deserialize(response.body, '{{{returnType}}}') {{/returnType}}; + return {{#returnType}}apiClient.deserialize(response.body, '{{{returnType}}}') as {{{returnType}}} {{/returnType}}; } else { return {{#returnType}}null{{/returnType}}; } diff --git a/modules/swagger-codegen/src/main/resources/dart/api_client.mustache b/modules/swagger-codegen/src/main/resources/dart/api_client.mustache index 075dbab135d2..dcbd731d2af6 100644 --- a/modules/swagger-codegen/src/main/resources/dart/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/api_client.mustache @@ -15,7 +15,8 @@ class ApiClient { Map _defaultHeaderMap = {}; Map _authentications = {}; - final dson = new Dartson.JSON(); + final dson = new Dartson.JSON() + ..addTransformer(new DateTimeParser(), DateTime); final DateFormat _dateFormatter = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); final _RegList = new RegExp(r'^List<(.*)>$'); @@ -72,20 +73,18 @@ class ApiClient { Match match; if (value is List && (match = _RegList.firstMatch(targetType)) != null) { - var valueL = value as List; var newTargetType = match[1]; - return valueL.map((v) => _deserialize(v, newTargetType)).toList(); + return value.map((v) => _deserialize(v, newTargetType)).toList(); } else if (value is Map && (match = _RegMap.firstMatch(targetType)) != null) { - var valueM = value as Map; var newTargetType = match[1]; - return new Map.fromIterables(valueM.keys, - valueM.values.map((v) => _deserialize(v, newTargetType))); + return new Map.fromIterables(value.keys, + value.values.map((v) => _deserialize(v, newTargetType))); } } } - } catch(e) { - // Just throw the ApiException below + } catch (e, stack) { + throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack); } throw new ApiException(500, 'Could not find a suitable class for deserialization'); } @@ -116,7 +115,7 @@ class ApiClient { // If collectionFormat is 'multi' a key might appear multiple times. Future invokeAPI(String path, String method, - List queryParams, + Iterable queryParams, Object body, Map headerParams, Map formParams, @@ -152,6 +151,8 @@ class ApiClient { return client.put(url, headers: headerParams, body: msgBody); case "DELETE": return client.delete(url, headers: headerParams); + case "PATCH": + return client.patch(url, headers: headerParams, body: msgBody); default: return client.get(url, headers: headerParams); } diff --git a/modules/swagger-codegen/src/main/resources/dart/api_exception.mustache b/modules/swagger-codegen/src/main/resources/dart/api_exception.mustache index b0130dc61f59..b86af8d954c5 100644 --- a/modules/swagger-codegen/src/main/resources/dart/api_exception.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/api_exception.mustache @@ -3,7 +3,21 @@ part of {{pubName}}.api; class ApiException implements Exception { int code = 0; String message = null; + Exception innerException = null; + StackTrace stackTrace = null; ApiException(this.code, this.message); -} \ No newline at end of file + ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + + String toString() { + if (message == null) return "ApiException"; + + if (innerException == null) { + return "ApiException $code: $message"; + } + + return "ApiException $code: $message (Inner exception: ${innerException})\n\n" + + stackTrace.toString(); + } +} diff --git a/modules/swagger-codegen/src/main/resources/dart/api_helper.mustache b/modules/swagger-codegen/src/main/resources/dart/api_helper.mustache index 9e2c30228a84..6052dfb312b4 100644 --- a/modules/swagger-codegen/src/main/resources/dart/api_helper.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/api_helper.mustache @@ -3,19 +3,19 @@ part of {{pubName}}.api; const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; // port from Java version -List _convertParametersForCollectionFormat( +Iterable _convertParametersForCollectionFormat( String collectionFormat, String name, dynamic value) { - var params = []; + var params = []; // preconditions if (name == null || name.isEmpty || value == null) return params; if (value is! List) { - params.add(new QueryParam(name, value as String)); + params.add(new QueryParam(name, '$value')); return params; } - List values = value as List; + List values = value as List; // get the collection format collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) @@ -23,7 +23,7 @@ List _convertParametersForCollectionFormat( : collectionFormat; // default: csv if (collectionFormat == "multi") { - return values.map((v) => new QueryParam(name, v)); + return values.map((v) => new QueryParam(name, '$v')); } String delimiter = _delimiters[collectionFormat] ?? ","; diff --git a/modules/swagger-codegen/src/main/resources/dart/apilib.mustache b/modules/swagger-codegen/src/main/resources/dart/apilib.mustache index 2ff574432f7a..f608cf214e01 100644 --- a/modules/swagger-codegen/src/main/resources/dart/apilib.mustache +++ b/modules/swagger-codegen/src/main/resources/dart/apilib.mustache @@ -5,6 +5,7 @@ import 'dart:convert';{{#browserClient}} import 'package:http/browser_client.dart';{{/browserClient}} import 'package:http/http.dart'; import 'package:dartson/dartson.dart'; +import 'package:dartson/transformers/date_time.dart'; import 'package:intl/intl.dart'; part 'api_client.dart'; diff --git a/samples/client/petstore/dart/.analysis_options b/samples/client/petstore/dart/.analysis_options new file mode 100644 index 000000000000..518eb901a6ff --- /dev/null +++ b/samples/client/petstore/dart/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart/.swagger-codegen-ignore b/samples/client/petstore/dart/.swagger-codegen-ignore new file mode 100644 index 000000000000..c5fa491b4c55 --- /dev/null +++ b/samples/client/petstore/dart/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/dart/lib/api_exception.dart b/samples/client/petstore/dart/lib/api_exception.dart deleted file mode 100644 index c168fb512da4..000000000000 --- a/samples/client/petstore/dart/lib/api_exception.dart +++ /dev/null @@ -1,9 +0,0 @@ -part of api; - -class ApiException implements Exception { - int code = 0; - String message = null; - - ApiException(this.code, this.message); - -} \ No newline at end of file diff --git a/samples/client/petstore/dart/petstore/.analysis_options b/samples/client/petstore/dart/petstore/.analysis_options new file mode 100644 index 000000000000..a10d4c5a05c9 --- /dev/null +++ b/samples/client/petstore/dart/petstore/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true diff --git a/samples/client/petstore/dart/LICENSE b/samples/client/petstore/dart/petstore/LICENSE similarity index 100% rename from samples/client/petstore/dart/LICENSE rename to samples/client/petstore/dart/petstore/LICENSE diff --git a/samples/client/petstore/dart/README.md b/samples/client/petstore/dart/petstore/README.md similarity index 100% rename from samples/client/petstore/dart/README.md rename to samples/client/petstore/dart/petstore/README.md diff --git a/samples/client/petstore/dart/petstore/pubspec.yaml b/samples/client/petstore/dart/petstore/pubspec.yaml new file mode 100644 index 000000000000..26f7d22205db --- /dev/null +++ b/samples/client/petstore/dart/petstore/pubspec.yaml @@ -0,0 +1,9 @@ +name: petstore_client +version: 1.0.0 +description: Petstore client using swagger API library +dependencies: + swagger: + path: ../swagger + +dev_dependencies: + guinness: '^0.1.17' \ No newline at end of file diff --git a/samples/client/petstore/dart/petstore/test/browser/packages b/samples/client/petstore/dart/petstore/test/browser/packages new file mode 120000 index 000000000000..4b727bf68897 --- /dev/null +++ b/samples/client/petstore/dart/petstore/test/browser/packages @@ -0,0 +1 @@ +../../packages \ No newline at end of file diff --git a/samples/client/petstore/dart/test/packages b/samples/client/petstore/dart/petstore/test/packages similarity index 100% rename from samples/client/petstore/dart/test/packages rename to samples/client/petstore/dart/petstore/test/packages diff --git a/samples/client/petstore/dart/test/pet_test.dart b/samples/client/petstore/dart/petstore/test/pet_test.dart similarity index 75% rename from samples/client/petstore/dart/test/pet_test.dart rename to samples/client/petstore/dart/petstore/test/pet_test.dart index e9a7ccd5fa75..213396f29cb2 100644 --- a/samples/client/petstore/dart/test/pet_test.dart +++ b/samples/client/petstore/dart/petstore/test/pet_test.dart @@ -71,34 +71,6 @@ testPetApi() { }); }); - it('finds pets by tag', () async { - var snowyId = newId(); - var grumpyId = newId(); - var snowyTags = [ - new Tag() - ..id = newId() - ..name = 'terrier' - ]; - var grumpyTags = [ - new Tag() - ..id = newId() - ..name = 'grumpy' - ]; - await petApi.addPet(new Pet() - ..id = snowyId - ..name = 'Snowy' - ..tags = snowyTags); - await petApi.addPet(new Pet() - ..id = grumpyId - ..name = 'Grumpy Cat' - ..tags = grumpyTags); - - var pets = await petApi.findPetsByTags(['grumpy']); - var petIds = pets.map((pet) => pet.id).toList(); - expect(petIds).toContain(grumpyId); - expect(petIds).not.toContain(snowyId); - }); - it('uploads a pet image', () async { var id = newId(); await petApi.addPet(new Pet()..id = id); diff --git a/samples/client/petstore/dart/test/store_test.dart b/samples/client/petstore/dart/petstore/test/store_test.dart similarity index 100% rename from samples/client/petstore/dart/test/store_test.dart rename to samples/client/petstore/dart/petstore/test/store_test.dart diff --git a/samples/client/petstore/dart/test/tests.dart b/samples/client/petstore/dart/petstore/test/tests.dart similarity index 100% rename from samples/client/petstore/dart/test/tests.dart rename to samples/client/petstore/dart/petstore/test/tests.dart diff --git a/samples/client/petstore/dart/test/tests.html b/samples/client/petstore/dart/petstore/test/tests.html similarity index 100% rename from samples/client/petstore/dart/test/tests.html rename to samples/client/petstore/dart/petstore/test/tests.html diff --git a/samples/client/petstore/dart/test/user_test.dart b/samples/client/petstore/dart/petstore/test/user_test.dart similarity index 100% rename from samples/client/petstore/dart/test/user_test.dart rename to samples/client/petstore/dart/petstore/test/user_test.dart diff --git a/samples/client/petstore/dart/pubspec.lock b/samples/client/petstore/dart/pubspec.lock deleted file mode 100644 index b816620fa905..000000000000 --- a/samples/client/petstore/dart/pubspec.lock +++ /dev/null @@ -1,178 +0,0 @@ -# Generated by pub -# See http://pub.dartlang.org/doc/glossary.html#lockfile -packages: - analyzer: - description: - name: analyzer - url: "https://pub.dartlang.org" - source: hosted - version: "0.26.4" - args: - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.4+2" - async: - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.0" - barback: - description: - name: barback - url: "https://pub.dartlang.org" - source: hosted - version: "0.15.2+8" - browser: - description: - name: browser - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.0+2" - charcode: - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - collection: - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.0" - csslib: - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.2" - dartson: - description: - name: dartson - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.5" - glob: - description: - name: glob - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.3" - guinness: - description: - name: guinness - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.18" - html: - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.2+2" - http: - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.11.3+8" - http_parser: - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.2" - intl: - description: - name: intl - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.7+1" - logging: - description: - name: logging - url: "https://pub.dartlang.org" - source: hosted - version: "0.11.3" - package_config: - description: - name: package_config - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.5" - path: - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.9" - petitparser: - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.3" - plugin: - description: - name: plugin - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.0" - pool: - description: - name: pool - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.4" - source_maps: - description: - name: source_maps - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.1+1" - source_span: - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.3" - stack_trace: - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.6" - string_scanner: - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - unittest: - description: - name: unittest - url: "https://pub.dartlang.org" - source: hosted - version: "0.11.6+4" - utf: - description: - name: utf - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.0+3" - watcher: - description: - name: watcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.7+2" - yaml: - description: - name: yaml - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.10" -sdk: ">=1.14.0 <2.0.0" diff --git a/samples/client/petstore/dart/swagger/.analysis_options b/samples/client/petstore/dart/swagger/.analysis_options new file mode 100644 index 000000000000..518eb901a6ff --- /dev/null +++ b/samples/client/petstore/dart/swagger/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart/swagger/.gitignore b/samples/client/petstore/dart/swagger/.gitignore new file mode 100644 index 000000000000..7c2804416498 --- /dev/null +++ b/samples/client/petstore/dart/swagger/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/client/petstore/dart/swagger/LICENSE b/samples/client/petstore/dart/swagger/LICENSE new file mode 100644 index 000000000000..8dada3edaf50 --- /dev/null +++ b/samples/client/petstore/dart/swagger/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/dart/git_push.sh b/samples/client/petstore/dart/swagger/git_push.sh similarity index 100% rename from samples/client/petstore/dart/git_push.sh rename to samples/client/petstore/dart/swagger/git_push.sh diff --git a/samples/client/petstore/dart/lib/api.dart b/samples/client/petstore/dart/swagger/lib/api.dart similarity index 90% rename from samples/client/petstore/dart/lib/api.dart rename to samples/client/petstore/dart/swagger/lib/api.dart index 1a0b0c84cc6b..db95000d614d 100644 --- a/samples/client/petstore/dart/lib/api.dart +++ b/samples/client/petstore/dart/swagger/lib/api.dart @@ -1,10 +1,11 @@ -library api; +library swagger.api; import 'dart:async'; import 'dart:convert'; import 'package:http/browser_client.dart'; import 'package:http/http.dart'; import 'package:dartson/dartson.dart'; +import 'package:dartson/transformers/date_time.dart'; import 'package:intl/intl.dart'; part 'api_client.dart'; diff --git a/samples/client/petstore/dart/lib/api/pet_api.dart b/samples/client/petstore/dart/swagger/lib/api/pet_api.dart similarity index 92% rename from samples/client/petstore/dart/lib/api/pet_api.dart rename to samples/client/petstore/dart/swagger/lib/api/pet_api.dart index 694ec340d464..45c203c51ef3 100644 --- a/samples/client/petstore/dart/lib/api/pet_api.dart +++ b/samples/client/petstore/dart/swagger/lib/api/pet_api.dart @@ -1,9 +1,8 @@ -part of api; +part of swagger.api; class PetApi { - String basePath = "http://petstore.swagger.io/v2"; final ApiClient apiClient; PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; @@ -46,8 +45,7 @@ class PetApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'POST', queryParams, postBody, @@ -103,8 +101,7 @@ class PetApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, postBody, @@ -143,9 +140,7 @@ class PetApi { List queryParams = []; Map headerParams = {}; Map formParams = {}; - if("null" != status) { queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status)); - } List contentTypes = []; @@ -162,8 +157,7 @@ class PetApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, @@ -175,7 +169,7 @@ class PetApi { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'List') ; + return apiClient.deserialize(response.body, 'List') as List ; } else { return null; } @@ -202,9 +196,7 @@ class PetApi { List queryParams = []; Map headerParams = {}; Map formParams = {}; - if("null" != tags) { queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); - } List contentTypes = []; @@ -221,8 +213,7 @@ class PetApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, @@ -234,7 +225,7 @@ class PetApi { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'List') ; + return apiClient.deserialize(response.body, 'List') as List ; } else { return null; } @@ -277,8 +268,7 @@ class PetApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, @@ -290,7 +280,7 @@ class PetApi { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'Pet') ; + return apiClient.deserialize(response.body, 'Pet') as Pet ; } else { return null; } @@ -333,8 +323,7 @@ class PetApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, @@ -403,8 +392,7 @@ if (status != null) formParams['status'] = apiClient.parameterToString(status); } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'POST', queryParams, postBody, @@ -473,8 +461,7 @@ if (status != null) } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'POST', queryParams, postBody, @@ -486,7 +473,7 @@ if (status != null) if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'ApiResponse') ; + return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse ; } else { return null; } diff --git a/samples/client/petstore/dart/lib/api/store_api.dart b/samples/client/petstore/dart/swagger/lib/api/store_api.dart similarity index 91% rename from samples/client/petstore/dart/lib/api/store_api.dart rename to samples/client/petstore/dart/swagger/lib/api/store_api.dart index 0e42d5346032..a2bf1bb68b90 100644 --- a/samples/client/petstore/dart/lib/api/store_api.dart +++ b/samples/client/petstore/dart/swagger/lib/api/store_api.dart @@ -1,9 +1,8 @@ -part of api; +part of swagger.api; class StoreApi { - String basePath = "http://petstore.swagger.io/v2"; final ApiClient apiClient; StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; @@ -46,8 +45,7 @@ class StoreApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, postBody, @@ -99,8 +97,7 @@ class StoreApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, @@ -112,7 +109,7 @@ class StoreApi { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'Map') ; + return apiClient.deserialize(response.body, 'Map') as Map ; } else { return null; } @@ -155,8 +152,7 @@ class StoreApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, @@ -168,7 +164,7 @@ class StoreApi { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'Order') ; + return apiClient.deserialize(response.body, 'Order') as Order ; } else { return null; } @@ -211,8 +207,7 @@ class StoreApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'POST', queryParams, postBody, @@ -224,7 +219,7 @@ class StoreApi { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'Order') ; + return apiClient.deserialize(response.body, 'Order') as Order ; } else { return null; } diff --git a/samples/client/petstore/dart/lib/api/user_api.dart b/samples/client/petstore/dart/swagger/lib/api/user_api.dart similarity index 93% rename from samples/client/petstore/dart/lib/api/user_api.dart rename to samples/client/petstore/dart/swagger/lib/api/user_api.dart index 34481806b955..10fecbf80f0c 100644 --- a/samples/client/petstore/dart/lib/api/user_api.dart +++ b/samples/client/petstore/dart/swagger/lib/api/user_api.dart @@ -1,9 +1,8 @@ -part of api; +part of swagger.api; class UserApi { - String basePath = "http://petstore.swagger.io/v2"; final ApiClient apiClient; UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; @@ -46,8 +45,7 @@ class UserApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'POST', queryParams, postBody, @@ -102,8 +100,7 @@ class UserApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'POST', queryParams, postBody, @@ -158,8 +155,7 @@ class UserApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'POST', queryParams, postBody, @@ -214,8 +210,7 @@ class UserApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, postBody, @@ -270,8 +265,7 @@ class UserApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, @@ -283,7 +277,7 @@ class UserApi { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'User') ; + return apiClient.deserialize(response.body, 'User') as User ; } else { return null; } @@ -313,12 +307,8 @@ class UserApi { List queryParams = []; Map headerParams = {}; Map formParams = {}; - if("null" != username) { queryParams.addAll(_convertParametersForCollectionFormat("", "username", username)); - } - if("null" != password) { queryParams.addAll(_convertParametersForCollectionFormat("", "password", password)); - } List contentTypes = []; @@ -335,8 +325,7 @@ class UserApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, @@ -348,7 +337,7 @@ class UserApi { if(response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); } else if(response.body != null) { - return apiClient.deserialize(response.body, 'String') ; + return apiClient.deserialize(response.body, 'String') as String ; } else { return null; } @@ -388,8 +377,7 @@ class UserApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, @@ -447,8 +435,7 @@ class UserApi { else { } - var response = await apiClient.invokeAPI(basePath, - path, + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, diff --git a/samples/client/petstore/dart/lib/api_client.dart b/samples/client/petstore/dart/swagger/lib/api_client.dart similarity index 87% rename from samples/client/petstore/dart/lib/api_client.dart rename to samples/client/petstore/dart/swagger/lib/api_client.dart index 3014e7deadef..9087a80d8cc0 100644 --- a/samples/client/petstore/dart/lib/api_client.dart +++ b/samples/client/petstore/dart/swagger/lib/api_client.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; class QueryParam { String name; @@ -9,18 +9,20 @@ class QueryParam { class ApiClient { + String basePath; var client = new BrowserClient(); Map _defaultHeaderMap = {}; Map _authentications = {}; - final dson = new Dartson.JSON(); + final dson = new Dartson.JSON() + ..addTransformer(new DateTimeParser(), DateTime); final DateFormat _dateFormatter = new DateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); final _RegList = new RegExp(r'^List<(.*)>$'); final _RegMap = new RegExp(r'^Map$'); - ApiClient() { + ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) { // Setup authentications (key: authentication name, value: authentication). _authentications['petstore_auth'] = new OAuth(); _authentications['api_key'] = new ApiKeyAuth("header", "api_key"); @@ -76,20 +78,18 @@ class ApiClient { Match match; if (value is List && (match = _RegList.firstMatch(targetType)) != null) { - var valueL = value as List; var newTargetType = match[1]; - return valueL.map((v) => _deserialize(v, newTargetType)).toList(); + return value.map((v) => _deserialize(v, newTargetType)).toList(); } else if (value is Map && (match = _RegMap.firstMatch(targetType)) != null) { - var valueM = value as Map; var newTargetType = match[1]; - return new Map.fromIterables(valueM.keys, - valueM.values.map((v) => _deserialize(v, newTargetType))); + return new Map.fromIterables(value.keys, + value.values.map((v) => _deserialize(v, newTargetType))); } } } - } catch(e) { - // Just throw the ApiException below + } catch (e, stack) { + throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack); } throw new ApiException(500, 'Could not find a suitable class for deserialization'); } @@ -118,10 +118,9 @@ class ApiClient { // We don't use a Map for queryParams. // If collectionFormat is 'multi' a key might appear multiple times. - Future invokeAPI(String host, - String path, + Future invokeAPI(String path, String method, - List queryParams, + Iterable queryParams, Object body, Map headerParams, Map formParams, @@ -135,7 +134,7 @@ class ApiClient { '?' + ps.join('&') : ''; - String url = host + path + queryString; + String url = basePath + path + queryString; headerParams.addAll(_defaultHeaderMap); headerParams['Content-Type'] = contentType; @@ -157,6 +156,8 @@ class ApiClient { return client.put(url, headers: headerParams, body: msgBody); case "DELETE": return client.delete(url, headers: headerParams); + case "PATCH": + return client.patch(url, headers: headerParams, body: msgBody); default: return client.get(url, headers: headerParams); } diff --git a/samples/client/petstore/dart/swagger/lib/api_exception.dart b/samples/client/petstore/dart/swagger/lib/api_exception.dart new file mode 100644 index 000000000000..b861591bec01 --- /dev/null +++ b/samples/client/petstore/dart/swagger/lib/api_exception.dart @@ -0,0 +1,23 @@ +part of swagger.api; + +class ApiException implements Exception { + int code = 0; + String message = null; + Exception innerException = null; + StackTrace stackTrace = null; + + ApiException(this.code, this.message); + + ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + + String toString() { + if (message == null) return "ApiException"; + + if (innerException == null) { + return "ApiException $code: $message"; + } + + return "ApiException $code: $message (Inner exception: ${innerException})\n\n" + + stackTrace.toString(); + } +} diff --git a/samples/client/petstore/dart/lib/api_helper.dart b/samples/client/petstore/dart/swagger/lib/api_helper.dart similarity index 73% rename from samples/client/petstore/dart/lib/api_helper.dart rename to samples/client/petstore/dart/swagger/lib/api_helper.dart index fb25306d2600..ad73218ab403 100644 --- a/samples/client/petstore/dart/lib/api_helper.dart +++ b/samples/client/petstore/dart/swagger/lib/api_helper.dart @@ -1,21 +1,21 @@ -part of api; +part of swagger.api; const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; // port from Java version -List _convertParametersForCollectionFormat( +Iterable _convertParametersForCollectionFormat( String collectionFormat, String name, dynamic value) { - var params = []; + var params = []; // preconditions if (name == null || name.isEmpty || value == null) return params; if (value is! List) { - params.add(new QueryParam(name, value as String)); + params.add(new QueryParam(name, '$value')); return params; } - List values = value as List; + List values = value as List; // get the collection format collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) @@ -23,7 +23,7 @@ List _convertParametersForCollectionFormat( : collectionFormat; // default: csv if (collectionFormat == "multi") { - return values.map((v) => new QueryParam(name, v)); + return values.map((v) => new QueryParam(name, '$v')); } String delimiter = _delimiters[collectionFormat] ?? ","; diff --git a/samples/client/petstore/dart/lib/auth/api_key_auth.dart b/samples/client/petstore/dart/swagger/lib/auth/api_key_auth.dart similarity index 96% rename from samples/client/petstore/dart/lib/auth/api_key_auth.dart rename to samples/client/petstore/dart/swagger/lib/auth/api_key_auth.dart index d80d6a6a213e..d46fa15e9b84 100644 --- a/samples/client/petstore/dart/lib/auth/api_key_auth.dart +++ b/samples/client/petstore/dart/swagger/lib/auth/api_key_auth.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; class ApiKeyAuth implements Authentication { diff --git a/samples/client/petstore/dart/lib/auth/authentication.dart b/samples/client/petstore/dart/swagger/lib/auth/authentication.dart similarity index 89% rename from samples/client/petstore/dart/lib/auth/authentication.dart rename to samples/client/petstore/dart/swagger/lib/auth/authentication.dart index c0b1f92a42d1..3d6b6aadcda0 100644 --- a/samples/client/petstore/dart/lib/auth/authentication.dart +++ b/samples/client/petstore/dart/swagger/lib/auth/authentication.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; abstract class Authentication { diff --git a/samples/client/petstore/dart/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart/swagger/lib/auth/http_basic_auth.dart similarity index 94% rename from samples/client/petstore/dart/lib/auth/http_basic_auth.dart rename to samples/client/petstore/dart/swagger/lib/auth/http_basic_auth.dart index 0645d4358f53..7a118d6cdad8 100644 --- a/samples/client/petstore/dart/lib/auth/http_basic_auth.dart +++ b/samples/client/petstore/dart/swagger/lib/auth/http_basic_auth.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; class HttpBasicAuth implements Authentication { diff --git a/samples/client/petstore/dart/lib/auth/oauth.dart b/samples/client/petstore/dart/swagger/lib/auth/oauth.dart similarity index 89% rename from samples/client/petstore/dart/lib/auth/oauth.dart rename to samples/client/petstore/dart/swagger/lib/auth/oauth.dart index e514dd85738a..405c5119a45e 100644 --- a/samples/client/petstore/dart/lib/auth/oauth.dart +++ b/samples/client/petstore/dart/swagger/lib/auth/oauth.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; class OAuth implements Authentication { diff --git a/samples/client/petstore/dart/lib/model/api_response.dart b/samples/client/petstore/dart/swagger/lib/model/api_response.dart similarity index 93% rename from samples/client/petstore/dart/lib/model/api_response.dart rename to samples/client/petstore/dart/swagger/lib/model/api_response.dart index e8ffe7378612..b2ac2c2577e3 100644 --- a/samples/client/petstore/dart/lib/model/api_response.dart +++ b/samples/client/petstore/dart/swagger/lib/model/api_response.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; @Entity() diff --git a/samples/client/petstore/dart/lib/model/category.dart b/samples/client/petstore/dart/swagger/lib/model/category.dart similarity index 91% rename from samples/client/petstore/dart/lib/model/category.dart rename to samples/client/petstore/dart/swagger/lib/model/category.dart index e39966555fbc..9ab2a96fc371 100644 --- a/samples/client/petstore/dart/lib/model/category.dart +++ b/samples/client/petstore/dart/swagger/lib/model/category.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; @Entity() diff --git a/samples/client/petstore/dart/lib/model/order.dart b/samples/client/petstore/dart/swagger/lib/model/order.dart similarity index 96% rename from samples/client/petstore/dart/lib/model/order.dart rename to samples/client/petstore/dart/swagger/lib/model/order.dart index 1d908629b06c..d7ea97b3bad6 100644 --- a/samples/client/petstore/dart/lib/model/order.dart +++ b/samples/client/petstore/dart/swagger/lib/model/order.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; @Entity() diff --git a/samples/client/petstore/dart/lib/model/pet.dart b/samples/client/petstore/dart/swagger/lib/model/pet.dart similarity index 96% rename from samples/client/petstore/dart/lib/model/pet.dart rename to samples/client/petstore/dart/swagger/lib/model/pet.dart index 8ad328b78be4..03e137437634 100644 --- a/samples/client/petstore/dart/lib/model/pet.dart +++ b/samples/client/petstore/dart/swagger/lib/model/pet.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; @Entity() diff --git a/samples/client/petstore/dart/lib/model/tag.dart b/samples/client/petstore/dart/swagger/lib/model/tag.dart similarity index 91% rename from samples/client/petstore/dart/lib/model/tag.dart rename to samples/client/petstore/dart/swagger/lib/model/tag.dart index 0541e12fb6f7..485de92a6158 100644 --- a/samples/client/petstore/dart/lib/model/tag.dart +++ b/samples/client/petstore/dart/swagger/lib/model/tag.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; @Entity() diff --git a/samples/client/petstore/dart/lib/model/user.dart b/samples/client/petstore/dart/swagger/lib/model/user.dart similarity index 97% rename from samples/client/petstore/dart/lib/model/user.dart rename to samples/client/petstore/dart/swagger/lib/model/user.dart index fd99a51ee584..f529d9432c1c 100644 --- a/samples/client/petstore/dart/lib/model/user.dart +++ b/samples/client/petstore/dart/swagger/lib/model/user.dart @@ -1,4 +1,4 @@ -part of api; +part of swagger.api; @Entity() diff --git a/samples/client/petstore/dart/pubspec.yaml b/samples/client/petstore/dart/swagger/pubspec.yaml similarity index 100% rename from samples/client/petstore/dart/pubspec.yaml rename to samples/client/petstore/dart/swagger/pubspec.yaml