From 90834f64e11392e1a5ca4c0fc186c9d0ebff26ba Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Fri, 22 Dec 2023 09:12:59 +0100 Subject: [PATCH] feat(dynamite_petstore_example): add linting Signed-off-by: Nikolas Rimikis --- .../analysis_options.yaml | 1 + .../lib/petstore.openapi.dart | 32 +++++++++---------- .../dynamite_petstore_example/pubspec.yaml | 6 ++++ .../pubspec_overrides.yaml | 4 ++- 4 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 packages/dynamite/dynamite_petstore_example/analysis_options.yaml diff --git a/packages/dynamite/dynamite_petstore_example/analysis_options.yaml b/packages/dynamite/dynamite_petstore_example/analysis_options.yaml new file mode 100644 index 00000000000..4db3c296b81 --- /dev/null +++ b/packages/dynamite/dynamite_petstore_example/analysis_options.yaml @@ -0,0 +1 @@ +include: package:neon_lints/dart.yaml diff --git a/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.dart b/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.dart index 6988e85139e..d74333b9e7b 100644 --- a/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.dart +++ b/packages/dynamite/dynamite_petstore_example/lib/petstore.openapi.dart @@ -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, 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, ); @@ -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( - response: this.executeRequest( + response: executeRequest( 'post', _path, _headers, _body, const {200}, ), - bodyType: FullType(Pet), + bodyType: const FullType(Pet), headersType: null, serializers: jsonSerializers, ); @@ -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( - response: this.executeRequest( + response: executeRequest( 'get', _path, _headers, null, const {200}, ), - bodyType: FullType(Pet), + bodyType: const FullType(Pet), headersType: null, serializers: jsonSerializers, ); @@ -281,12 +281,12 @@ class $Client extends DynamiteClient { final _parameters = {}; final _headers = {}; - 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( - response: this.executeRequest( + response: executeRequest( 'delete', _path, _headers, @@ -377,13 +377,13 @@ abstract class Error implements $ErrorInterface, Built { // coverage:ignore-start @visibleForTesting final Serializers serializers = (Serializers().toBuilder() - ..addBuilderFactory(FullType(BuiltList, [FullType(String)]), ListBuilder.new) - ..addBuilderFactory(FullType(Pet), PetBuilder.new) + ..addBuilderFactory(const FullType(BuiltList, [FullType(String)]), ListBuilder.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.new) - ..addBuilderFactory(FullType(Error), ErrorBuilder.new) + ..addBuilderFactory(const FullType(BuiltList, [FullType(Pet)]), ListBuilder.new) + ..addBuilderFactory(const FullType(Error), ErrorBuilder.new) ..add(Error.serializer)) .build(); diff --git a/packages/dynamite/dynamite_petstore_example/pubspec.yaml b/packages/dynamite/dynamite_petstore_example/pubspec.yaml index 28b3e062653..d7954034e09 100644 --- a/packages/dynamite/dynamite_petstore_example/pubspec.yaml +++ b/packages/dynamite/dynamite_petstore_example/pubspec.yaml @@ -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: @@ -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 diff --git a/packages/dynamite/dynamite_petstore_example/pubspec_overrides.yaml b/packages/dynamite/dynamite_petstore_example/pubspec_overrides.yaml index b0b6cc9f5f9..6271ab73042 100644 --- a/packages/dynamite/dynamite_petstore_example/pubspec_overrides.yaml +++ b/packages/dynamite/dynamite_petstore_example/pubspec_overrides.yaml @@ -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