Skip to content

Commit 024dcb2

Browse files
Merge pull request #262 from lohanidamodar/fix-realtime-and-doc-comments
Fix-realtime-and-doc-comments
2 parents a370eda + ff85dc1 commit 024dcb2

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/Spec/Swagger2.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,14 @@ public function getDefinitions() {
295295
$sch = [
296296
"name" => $key,
297297
"properties"=> $schema['properties'] ?? [],
298+
"description"=> $schema['description'] ?? [],
298299
"required" => $schema['required'] ?? [],
299300
"additionalProperties" => $schema['additionalProperties'] ?? []
300301
];
301302
if(isset($sch['properties'])) {
302303
foreach($sch['properties'] as $name => $def) {
303304
$sch['properties'][$name]['name'] = $name;
305+
$sch['properties'][$name]['description'] = $def['description'];
304306
$sch['properties'][$name]['required'] = in_array($name,$sch['required']);
305307
if(isset($def['items']['$ref'])) {
306308
//nested model

templates/flutter/lib/package.dart.twig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'src/redirect_stub.dart'
88
if (dart.library.html) 'src/redirect_browser.dart';
99
import 'src/enums.dart';
1010
import 'src/client.dart';
11-
import 'src/response.dart';
1211
import 'src/service.dart';
1312
import 'models.dart' as models;
1413

templates/flutter/lib/src/models/model.dart.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{{property.type | typeName}}{% endif %}{% endmacro %}
22
part of {{ language.params.packageName }}.models;
33

4+
/// {{ definition.description }}
45
class {{ definition.name | caseUcfirst }} {
56
{% for property in definition.properties %}
7+
/// {{ property.description }}
68
final {% if not property.required %}{{_self.sub_schema(property)}}? {{ property.name | escapeKeyword }}{% else %}{{_self.sub_schema(property)}} {{ property.name | escapeKeyword }}{% endif %};
79
{% endfor %}
810
{% if definition.additionalProperties %}

templates/flutter/lib/src/realtime_mixin.dart.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ mixin RealtimeMixin {
2020
late WebSocketFactory getWebSocket;
2121
GetFallbackCookie? getFallbackCookie;
2222

23-
_closeConnection() {
24-
_websok?.sink.close(normalClosure);
23+
Future<dynamic> _closeConnection() async {
24+
return await _websok?.sink.close(normalClosure);
2525
}
2626

2727
_createSocket() async {
@@ -32,7 +32,7 @@ mixin RealtimeMixin {
3232
if (_lastUrl == uri.toString() && _websok?.closeCode == null) {
3333
return;
3434
}
35-
_closeConnection();
35+
await _closeConnection();
3636
_lastUrl = uri.toString();
3737
print('subscription: $_lastUrl');
3838
_websok = await getWebSocket(uri);
@@ -112,7 +112,7 @@ mixin RealtimeMixin {
112112
Future.delayed(Duration.zero, () => _createSocket());
113113
RealtimeSubscription subscription = RealtimeSubscription(
114114
stream: controller.stream,
115-
close: () {
115+
close: () async {
116116
controller.close();
117117
channels.forEach((channel) {
118118
this._channels[channel]!.remove(controller);
@@ -121,9 +121,9 @@ mixin RealtimeMixin {
121121
}
122122
});
123123
if(this._channels.isNotEmpty) {
124-
Future.delayed(Duration.zero, () => _createSocket());
124+
await Future.delayed(Duration.zero, () => _createSocket());
125125
} else {
126-
_closeConnection();
126+
await _closeConnection();
127127
}
128128
});
129129
return subscription;

templates/flutter/lib/src/realtime_subscription.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'realtime_message.dart';
22

33
class RealtimeSubscription {
44
final Stream<RealtimeMessage> stream;
5-
final Function() close;
5+
final Future<void> Function() close;
66

77
RealtimeSubscription({required this.stream, required this.close});
88
}

0 commit comments

Comments
 (0)