Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class {{classname}} {

List<String> contentTypes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}{{/consumes}}];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [{{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}}];

if(contentType.startsWith("multipart/form-data")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ApiClient {
final _regList = RegExp(r'^List<(.*)>$');
final _regMap = RegExp(r'^Map<String,(.*)>$');

ApiClient({this.basePath: "{{{basePath}}}"}) {
ApiClient({this.basePath = "{{{basePath}}}"}) {
// Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}}
_authentications['{{name}}'] = HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
_authentications['{{name}}'] = ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class {{classname}} {

static Map<String, {{classname}}> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, {{classname}}>();
if (json != null && json.length > 0) {
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new {{classname}}.fromJson(value));
}
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Please follow the [installation procedure](#installation--usage) and then run th
import 'package:openapi/api.dart';

// TODO Configure OAuth2 access token for authorization: petstore_auth
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';

var api_instance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PetApi {

List<String> contentTypes = ["application/json","application/xml"];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -78,7 +78,7 @@ class PetApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -128,7 +128,7 @@ class PetApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -179,7 +179,7 @@ class PetApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -229,7 +229,7 @@ class PetApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["api_key"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -279,7 +279,7 @@ class PetApi {

List<String> contentTypes = ["application/json","application/xml"];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -328,7 +328,7 @@ class PetApi {

List<String> contentTypes = ["application/x-www-form-urlencoded"];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -389,7 +389,7 @@ class PetApi {

List<String> contentTypes = ["multipart/form-data"];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class StoreApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -74,7 +74,7 @@ class StoreApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["api_key"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -125,7 +125,7 @@ class StoreApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -175,7 +175,7 @@ class StoreApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UserApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -77,7 +77,7 @@ class UserApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -126,7 +126,7 @@ class UserApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -175,7 +175,7 @@ class UserApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -224,7 +224,7 @@ class UserApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -279,7 +279,7 @@ class UserApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -326,7 +326,7 @@ class UserApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -378,7 +378,7 @@ class UserApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ApiResponse {

static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, ApiResponse>();
if (json != null && json.length > 0) {
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new ApiResponse.fromJson(value));
}
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Category {

static Map<String, Category> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, Category>();
if (json != null && json.length > 0) {
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new Category.fromJson(value));
}
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Order {

static Map<String, Order> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, Order>();
if (json != null && json.length > 0) {
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new Order.fromJson(value));
}
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Pet {

static Map<String, Pet> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, Pet>();
if (json != null && json.length > 0) {
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new Pet.fromJson(value));
}
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Tag {

static Map<String, Tag> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, Tag>();
if (json != null && json.length > 0) {
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new Tag.fromJson(value));
}
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class User {

static Map<String, User> mapFromJson(Map<String, dynamic> json) {
var map = new Map<String, User>();
if (json != null && json.length > 0) {
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = new User.fromJson(value));
}
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Please follow the [installation procedure](#installation--usage) and then run th
import 'package:openapi/api.dart';

// TODO Configure OAuth2 access token for authorization: petstore_auth
//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
//defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';

var api_instance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PetApi {

List<String> contentTypes = ["application/json","application/xml"];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -78,7 +78,7 @@ class PetApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -128,7 +128,7 @@ class PetApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -179,7 +179,7 @@ class PetApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -229,7 +229,7 @@ class PetApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["api_key"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -279,7 +279,7 @@ class PetApi {

List<String> contentTypes = ["application/json","application/xml"];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -328,7 +328,7 @@ class PetApi {

List<String> contentTypes = ["application/x-www-form-urlencoded"];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -389,7 +389,7 @@ class PetApi {

List<String> contentTypes = ["multipart/form-data"];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["petstore_auth"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class StoreApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -74,7 +74,7 @@ class StoreApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = ["api_key"];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -125,7 +125,7 @@ class StoreApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down Expand Up @@ -175,7 +175,7 @@ class StoreApi {

List<String> contentTypes = [];

String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String contentType = contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
List<String> authNames = [];

if(contentType.startsWith("multipart/form-data")) {
Expand Down
Loading