Skip to content

Commit

Permalink
feat(dynamite_petstore_example): add linting
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolas Rimikis <[email protected]>
  • Loading branch information
Leptopoda committed Dec 22, 2023
1 parent 827d505 commit 90834f6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:neon_lints/dart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,22 @@ class $Client extends DynamiteClient {
'Accept': 'application/json',
};

var $tags = jsonSerializers.serialize(tags, specifiedType: const FullType(BuiltList, [FullType(String)]));
final $tags = jsonSerializers.serialize(tags, specifiedType: const FullType(BuiltList, [FullType(String)]));
_parameters['tags'] = $tags;

var $limit = jsonSerializers.serialize(limit, specifiedType: const FullType(int));
final $limit = jsonSerializers.serialize(limit, specifiedType: const FullType(int));
_parameters['limit'] = $limit;

final _path = UriTemplate('/pets{?tags*,limit*}').expand(_parameters);
return DynamiteRawResponse<BuiltList<Pet>, void>(
response: this.executeRequest(
response: executeRequest(
'get',
_path,
_headers,
null,
const {200},
),
bodyType: FullType(BuiltList, [FullType(Pet)]),
bodyType: const FullType(BuiltList, [FullType(Pet)]),
headersType: null,
serializers: jsonSerializers,
);
Expand Down Expand Up @@ -162,14 +162,14 @@ class $Client extends DynamiteClient {
_body = utf8.encode(json.encode(jsonSerializers.serialize(newPet, specifiedType: const FullType(NewPet))));
const _path = '/pets';
return DynamiteRawResponse<Pet, void>(
response: this.executeRequest(
response: executeRequest(
'post',
_path,
_headers,
_body,
const {200},
),
bodyType: FullType(Pet),
bodyType: const FullType(Pet),
headersType: null,
serializers: jsonSerializers,
);
Expand Down Expand Up @@ -220,19 +220,19 @@ class $Client extends DynamiteClient {
'Accept': 'application/json',
};

var $id = jsonSerializers.serialize(id, specifiedType: const FullType(int));
final $id = jsonSerializers.serialize(id, specifiedType: const FullType(int));
_parameters['id'] = $id;

final _path = UriTemplate('/pets/{id}').expand(_parameters);
return DynamiteRawResponse<Pet, void>(
response: this.executeRequest(
response: executeRequest(
'get',
_path,
_headers,
null,
const {200},
),
bodyType: FullType(Pet),
bodyType: const FullType(Pet),
headersType: null,
serializers: jsonSerializers,
);
Expand Down Expand Up @@ -281,12 +281,12 @@ class $Client extends DynamiteClient {
final _parameters = <String, dynamic>{};
final _headers = <String, String>{};

var $id = jsonSerializers.serialize(id, specifiedType: const FullType(int));
final $id = jsonSerializers.serialize(id, specifiedType: const FullType(int));
_parameters['id'] = $id;

final _path = UriTemplate('/pets/{id}').expand(_parameters);
return DynamiteRawResponse<void, void>(
response: this.executeRequest(
response: executeRequest(
'delete',
_path,
_headers,
Expand Down Expand Up @@ -377,13 +377,13 @@ abstract class Error implements $ErrorInterface, Built<Error, ErrorBuilder> {
// coverage:ignore-start
@visibleForTesting
final Serializers serializers = (Serializers().toBuilder()
..addBuilderFactory(FullType(BuiltList, [FullType(String)]), ListBuilder<String>.new)
..addBuilderFactory(FullType(Pet), PetBuilder.new)
..addBuilderFactory(const FullType(BuiltList, [FullType(String)]), ListBuilder<String>.new)
..addBuilderFactory(const FullType(Pet), PetBuilder.new)
..add(Pet.serializer)
..addBuilderFactory(FullType(NewPet), NewPetBuilder.new)
..addBuilderFactory(const FullType(NewPet), NewPetBuilder.new)
..add(NewPet.serializer)
..addBuilderFactory(FullType(BuiltList, [FullType(Pet)]), ListBuilder<Pet>.new)
..addBuilderFactory(FullType(Error), ErrorBuilder.new)
..addBuilderFactory(const FullType(BuiltList, [FullType(Pet)]), ListBuilder<Pet>.new)
..addBuilderFactory(const FullType(Error), ErrorBuilder.new)
..add(Error.serializer))
.build();

Expand Down
6 changes: 6 additions & 0 deletions packages/dynamite/dynamite_petstore_example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ dependencies:
git:
url: https://github.com/nextcloud/neon
path: packages/dynamite/dynamite_runtime
meta: ^1.0.0
universal_io: ^2.0.0
uri: ^1.0.0

dev_dependencies:
Expand All @@ -22,3 +24,7 @@ dev_dependencies:
git:
url: https://github.com/nextcloud/neon
path: packages/dynamite/dynamite
neon_lints:
git:
url: https://github.com/nextcloud/neon
path: packages/neon_lints
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# melos_managed_dependency_overrides: dynamite,dynamite_runtime
# melos_managed_dependency_overrides: dynamite,dynamite_runtime,neon_lints
dependency_overrides:
dynamite:
path: ../dynamite
dynamite_runtime:
path: ../dynamite_runtime
neon_lints:
path: ../../neon_lints

0 comments on commit 90834f6

Please sign in to comment.