diff --git a/lib/screens/common_widgets/auth/api_key_auth_fields.dart b/lib/screens/common_widgets/auth/api_key_auth_fields.dart index 1cc1c176..e3878adc 100644 --- a/lib/screens/common_widgets/auth/api_key_auth_fields.dart +++ b/lib/screens/common_widgets/auth/api_key_auth_fields.dart @@ -29,7 +29,7 @@ class _ApiKeyAuthFieldsState extends State { super.initState(); final apiAuth = widget.authData?.apikey; _keyController = TextEditingController(text: apiAuth?.key ?? ''); - _nameController = TextEditingController(text: apiAuth?.name ?? ''); + _nameController = TextEditingController(text: apiAuth?.name ?? 'x-api-key'); _addKeyTo = apiAuth?.location ?? 'header'; } diff --git a/packages/apidash_core/lib/models/auth/api_auth_model.dart b/packages/apidash_core/lib/models/auth/api_auth_model.dart index c38a566e..c9b19607 100644 --- a/packages/apidash_core/lib/models/auth/api_auth_model.dart +++ b/packages/apidash_core/lib/models/auth/api_auth_model.dart @@ -10,7 +10,10 @@ part 'api_auth_model.freezed.dart'; @freezed class AuthModel with _$AuthModel { - @JsonSerializable(explicitToJson: true) + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory AuthModel({ required APIAuthType type, AuthApiKeyModel? apikey, diff --git a/packages/apidash_core/lib/models/auth/api_auth_model.freezed.dart b/packages/apidash_core/lib/models/auth/api_auth_model.freezed.dart index 3ff7badf..28ceaec6 100644 --- a/packages/apidash_core/lib/models/auth/api_auth_model.freezed.dart +++ b/packages/apidash_core/lib/models/auth/api_auth_model.freezed.dart @@ -227,7 +227,7 @@ class __$$AuthModelImplCopyWithImpl<$Res> /// @nodoc -@JsonSerializable(explicitToJson: true) +@JsonSerializable(explicitToJson: true, anyMap: true) class _$AuthModelImpl implements _AuthModel { const _$AuthModelImpl( {required this.type, this.apikey, this.bearer, this.basic, this.jwt}); diff --git a/packages/apidash_core/lib/models/auth/api_auth_model.g.dart b/packages/apidash_core/lib/models/auth/api_auth_model.g.dart index 8235bc7b..fdbd6e09 100644 --- a/packages/apidash_core/lib/models/auth/api_auth_model.g.dart +++ b/packages/apidash_core/lib/models/auth/api_auth_model.g.dart @@ -6,21 +6,24 @@ part of 'api_auth_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$AuthModelImpl _$$AuthModelImplFromJson(Map json) => - _$AuthModelImpl( +_$AuthModelImpl _$$AuthModelImplFromJson(Map json) => _$AuthModelImpl( type: $enumDecode(_$APIAuthTypeEnumMap, json['type']), apikey: json['apikey'] == null ? null - : AuthApiKeyModel.fromJson(json['apikey'] as Map), + : AuthApiKeyModel.fromJson( + Map.from(json['apikey'] as Map)), bearer: json['bearer'] == null ? null - : AuthBearerModel.fromJson(json['bearer'] as Map), + : AuthBearerModel.fromJson( + Map.from(json['bearer'] as Map)), basic: json['basic'] == null ? null - : AuthBasicAuthModel.fromJson(json['basic'] as Map), + : AuthBasicAuthModel.fromJson( + Map.from(json['basic'] as Map)), jwt: json['jwt'] == null ? null - : AuthJwtModel.fromJson(json['jwt'] as Map), + : AuthJwtModel.fromJson( + Map.from(json['jwt'] as Map)), ); Map _$$AuthModelImplToJson(_$AuthModelImpl instance) =>