Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code generation for Dart #5966

Open
wants to merge 216 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 204 commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
4cd9ec1
Added dart placeholder files
ricardoboss Jan 27, 2024
ffff17d
Implemented some methods for testing generation, added run config
ricardoboss Jan 27, 2024
5480847
Use CSharp as a baseline
ricardoboss Jan 28, 2024
1570b5c
Fix getter generation
ricardoboss Jan 29, 2024
451ebde
Remove public access modifier from class declarations
ricardoboss Jan 29, 2024
9fe17cf
Generate namespace as library part of
ricardoboss Jan 29, 2024
37fb3f2
Adjusted properties and type translations
ricardoboss Jan 29, 2024
15bec8a
Merge remote-tracking branch 'upstream/main' into features/dart
Kees-Schotanus Aug 27, 2024
78cb806
started working on code generation
Kees-Schotanus Sep 3, 2024
50c59c6
Don't add nullable properties twice
joanne-ter-maat Sep 4, 2024
31c42ca
Write opening line of method only once, avoid to many closing parenth…
joanne-ter-maat Sep 4, 2024
6fd1b18
Added generics to BaseRequestBuilder
Kees-Schotanus Sep 4, 2024
6fbff09
simple form of enum generation
joanne-ter-maat Sep 4, 2024
ae55584
Remove function
joanne-ter-maat Sep 4, 2024
efd5094
Imports in ApiClient are now correct
Kees-Schotanus Sep 5, 2024
78b7c55
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 5, 2024
20152e3
Workaround for clone method that should be implemented
joanne-ter-maat Sep 5, 2024
01633cb
Remove nested configuration classes, replace base with super, no new
joanne-ter-maat Sep 6, 2024
b9a7453
Solved merge conflict
Kees-Schotanus Sep 6, 2024
837cada
Use correct namespaces in defaultUsingEvaluators
joanne-ter-maat Sep 6, 2024
f9092cf
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 6, 2024
36074a1
api_client.dart compiles after generation
Kees-Schotanus Sep 6, 2024
18bfcea
Improved generation of import statements
joanne-ter-maat Sep 6, 2024
178e302
Lists of integers now use the proper type.
Kees-Schotanus Sep 6, 2024
973c926
extends and implements are properly generated
Kees-Schotanus Sep 9, 2024
02e9676
Start with morer dynamic generation of import statements
joanne-ter-maat Sep 9, 2024
bcfb91b
Fix generating generics in inheritance
Kees-Schotanus Sep 9, 2024
7c2e2ee
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 9, 2024
7e50b41
Property names should start with lowercase, import all types from met…
joanne-ter-maat Sep 10, 2024
9a32802
Property for additional data is overriden from abstract class
joanne-ter-maat Sep 10, 2024
dd28ad1
move override one line up for methods
joanne-ter-maat Sep 10, 2024
0c4ebfd
Now generates an api client that compiles
Kees-Schotanus Sep 10, 2024
b354796
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 10, 2024
5654a95
Relative imports now work
Kees-Schotanus Sep 11, 2024
5fe2fa7
use different syntax for constructors of model classes that need to i…
joanne-ter-maat Sep 11, 2024
fe848f4
changes to creation of requestgenerator method, simple form of method…
joanne-ter-maat Sep 11, 2024
44f7248
getFieldDeserializers works for simple case
Kees-Schotanus Sep 12, 2024
85870f2
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 12, 2024
c7524b6
Changes to make requestexecutor method compile
joanne-ter-maat Sep 12, 2024
8b0f41e
Use dynamic instead of object for pathparameter
joanne-ter-maat Sep 12, 2024
1599e98
Corrected requestbuilder arguments
joanne-ter-maat Sep 12, 2024
debbc43
Use named constructor for requestbuilders with raw url parameter
joanne-ter-maat Sep 12, 2024
ee10fab
Remove unneccesary void
joanne-ter-maat Sep 12, 2024
409b7e2
For simple cases (de)serializers work
Kees-Schotanus Sep 12, 2024
9aabed7
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 12, 2024
bdf2ea7
Filter imports
joanne-ter-maat Sep 12, 2024
1d8ecd3
Remove redundant method
joanne-ter-maat Sep 13, 2024
b28e0b2
void should be void instead of empty
joanne-ter-maat Sep 13, 2024
4e3fa89
Replace indexer methods
joanne-ter-maat Sep 13, 2024
0732876
Added imports for discriminator types
Kees-Schotanus Sep 16, 2024
db7495d
Pretty close to having a working generator
Kees-Schotanus Sep 17, 2024
2324933
Correct type for datetime, fix missing enum importsg
joanne-ter-maat Sep 17, 2024
a7e2d32
Arrays should be lists in dart
joanne-ter-maat Sep 17, 2024
c12e490
Fix double >>
joanne-ter-maat Sep 17, 2024
0899156
Fix imports of subclasses in different directories
joanne-ter-maat Sep 17, 2024
7f5f4d5
Small fixes to field deserializer method
joanne-ter-maat Sep 18, 2024
accc199
Enum values named according to conventions
joanne-ter-maat Sep 18, 2024
9bde37f
Might be Uint8List in the future
Kees-Schotanus Sep 18, 2024
f652986
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 18, 2024
8faad2c
added type to requestconfiguration
joanne-ter-maat Sep 19, 2024
e689de9
Move queryparameterclasses
joanne-ter-maat Sep 19, 2024
51a4510
Write implementation of getQueryParameters method
joanne-ter-maat Sep 19, 2024
dabf69e
Types for RequestConfiguration generics should also be imported
joanne-ter-maat Sep 19, 2024
2ffeedb
Use Uuids, escape propertynames
joanne-ter-maat Sep 20, 2024
e8fdb47
Compiling requestexecutor for binary data
joanne-ter-maat Sep 20, 2024
e45c144
Added value to generated enums and corrected method call for enum ser…
joanne-ter-maat Sep 20, 2024
2c9e85e
Booleans are written correctly
Kees-Schotanus Sep 20, 2024
d4e2e5c
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 20, 2024
0d05268
Imports for discrimiator types work better
Kees-Schotanus Sep 20, 2024
3effb0f
deserialization of enum values
joanne-ter-maat Sep 20, 2024
c75c2e7
Deserialize collections of enums
joanne-ter-maat Sep 20, 2024
5a2ba18
raw url constructors don't have a body
Kees-Schotanus Sep 20, 2024
43860b6
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 20, 2024
f843ad6
Change all Guid properties to UuidValues
joanne-ter-maat Sep 20, 2024
f35c8b2
Bringing down compiler warnings to 218
Kees-Schotanus Sep 23, 2024
4592ba6
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Sep 23, 2024
c200a87
Corrected names containing an underscore.
Kees-Schotanus Sep 23, 2024
2bce885
Almost all consructors are generated properly
Kees-Schotanus Sep 23, 2024
792e1c8
Still bringing down the number of compiler warnings
Kees-Schotanus Sep 23, 2024
2d15035
Adding ASync to async getters.
Kees-Schotanus Sep 23, 2024
aa96c8c
Adding code from original DartRefiner
Kees-Schotanus Sep 24, 2024
fa9c2b0
getAsync now has on optional positional parameter
Kees-Schotanus Sep 24, 2024
74a74be
Integers should not become doubles
joanne-ter-maat Sep 24, 2024
e40ad0b
Error classes should extend ApiException
joanne-ter-maat Sep 24, 2024
82bd98c
add error message
joanne-ter-maat Sep 25, 2024
f5fad2f
deduplicate error mappings
joanne-ter-maat Sep 25, 2024
c59695a
Remove unnecessary methods
joanne-ter-maat Sep 25, 2024
13d05de
Add the clone method to the refiner
joanne-ter-maat Sep 25, 2024
05a843a
Don't snakecase whole path, filename is already snakecased
joanne-ter-maat Sep 25, 2024
fbe5927
Escape dollar sign in default value urltemplate
joanne-ter-maat Sep 25, 2024
76a51bd
Correct (de)serialization of iterable int
joanne-ter-maat Sep 25, 2024
4eb7e54
Use existing method for adding imports
joanne-ter-maat Sep 26, 2024
0d19c77
Escape dollar sign in more string values
joanne-ter-maat Sep 30, 2024
6d1441c
improved method generation, better handling of nullable/optional para…
joanne-ter-maat Oct 3, 2024
8245968
Corrected some types
joanne-ter-maat Oct 4, 2024
2e4a471
Fixes some wrong method names, invalid enum values and correct deprec…
joanne-ter-maat Oct 4, 2024
5227b3d
Use named imports when necessary
joanne-ter-maat Oct 8, 2024
fafe3b9
changed generation of error classes to work with copyWith method
joanne-ter-maat Oct 9, 2024
58d1fce
some fixes to intersection and union models
joanne-ter-maat Oct 10, 2024
f0b7b75
More fixes to generated model classes for intersection and union models
joanne-ter-maat Oct 15, 2024
2eab539
Added Dart language to GenerateSample
Kees-Schotanus Oct 16, 2024
bf56f41
Copied Dart refiner code over original refiner
Kees-Schotanus Oct 17, 2024
6b2cb3b
Some fixes to intersection and union model and corrected an issue wit…
joanne-ter-maat Oct 17, 2024
d9d056f
Type for errormapping to avoid compile errors for custom error classes
joanne-ter-maat Oct 17, 2024
86abc1c
Method was renamed
joanne-ter-maat Oct 18, 2024
31bc7dd
Use serialization name for enums, untypednodes should also have facto…
joanne-ter-maat Oct 18, 2024
b6cf365
Requestexecutur should always return await
joanne-ter-maat Oct 18, 2024
11721b8
Use single quotes instead of double, simplified escaping dollar sign …
joanne-ter-maat Oct 18, 2024
5a121a2
Added refiner test for dart
joanne-ter-maat Oct 22, 2024
2bebbc6
Merge branch 'main' into features/dart
joanne-ter-maat Oct 22, 2024
134b762
Fix compile errors after update with main
joanne-ter-maat Oct 22, 2024
48e7298
Add dart to code generation it
joanne-ter-maat Oct 22, 2024
f9edf02
Run dart analyze or test
joanne-ter-maat Oct 23, 2024
0cc8d4b
Remove unused import and incorrect override
joanne-ter-maat Oct 23, 2024
f7e1050
only analyze code in src dir
joanne-ter-maat Oct 23, 2024
61580d2
Only requestconfiguration parameter should be optional
joanne-ter-maat Oct 23, 2024
5ccb0da
Fix writing boolean values in serializer methods, added data types to…
joanne-ter-maat Oct 23, 2024
7b6f1ce
Replace methods before type correction, different check in factory m…
joanne-ter-maat Oct 23, 2024
c6c6345
Stream should be escaped, some fixes to writing of default values
joanne-ter-maat Oct 23, 2024
3921363
Error classes should have a constructor
joanne-ter-maat Oct 23, 2024
0a97948
mappingvalue was being written without being used, index in enums sho…
joanne-ter-maat Oct 24, 2024
d636313
Better check for writing additionaldata
joanne-ter-maat Oct 24, 2024
5d113cc
Moved and fixed the apiclienttest
joanne-ter-maat Oct 24, 2024
4eab0b0
Changes to generate compiling code with backingstore
joanne-ter-maat Oct 25, 2024
612cc00
Merge branch 'main' into features/dart
Kees-Schotanus Oct 28, 2024
f1cbb0f
Use defaultvalue if property cannot be null
joanne-ter-maat Oct 29, 2024
8d8a8fe
First attempt to solve name mangling
Kees-Schotanus Oct 30, 2024
d4a4300
Removed changing the case of enums/properties
Kees-Schotanus Oct 30, 2024
29c9dab
Added writer tests for dart
joanne-ter-maat Oct 30, 2024
ecdb3ef
Merge branch 'features/dart' into naming
Kees-Schotanus Oct 30, 2024
2ffaee3
Added enumwriter test
joanne-ter-maat Oct 30, 2024
11cdb6c
More and more naming moved into DartRefiner
Kees-Schotanus Oct 31, 2024
4b82519
Added tests for codemethodwriter and misc fixes
joanne-ter-maat Oct 31, 2024
1ead0a9
All properties use camel case now.
Kees-Schotanus Oct 31, 2024
3764ec0
Added tests for codepropertywriter
joanne-ter-maat Nov 1, 2024
04e182c
Enum options are now translated in DartRefiner
Kees-Schotanus Nov 1, 2024
1fe9ff8
Enum writer assumes options are already correct
Kees-Schotanus Nov 1, 2024
e061f74
Cosmetic change
Kees-Schotanus Nov 1, 2024
0116032
Removed debug output
Kees-Schotanus Nov 1, 2024
4c4a30b
Enum naming is now part of DartRefiner
Kees-Schotanus Nov 1, 2024
8b5f44f
Merged features/dart into namin
Kees-Schotanus Nov 4, 2024
b13fad7
Fixed enum option names
Kees-Schotanus Nov 5, 2024
6edbedd
Added index as a reserved name
Kees-Schotanus Nov 5, 2024
5b45472
Avoiding duplicate options in enums
Kees-Schotanus Nov 5, 2024
b2418f8
Fixed unit tests
Kees-Schotanus Nov 5, 2024
47cfdda
Fixed case of enum option
Kees-Schotanus Nov 6, 2024
205bc09
Corrected enum names
Kees-Schotanus Nov 6, 2024
6028016
Removed unused imports
Kees-Schotanus Nov 8, 2024
ca26c4e
Moved call to CorrectCommonNames
Kees-Schotanus Nov 8, 2024
038d64f
Fixed enums with symbols only
Kees-Schotanus Nov 8, 2024
59d42cd
Small changes in order .
Kees-Schotanus Nov 8, 2024
e807b21
Moved updating serialization names to writer
Kees-Schotanus Nov 8, 2024
e3fff8e
Added dart to the language matrix
joanne-ter-maat Nov 12, 2024
880026d
Add setup for Dart
joanne-ter-maat Nov 12, 2024
a0201e0
Ran dotnet format
joanne-ter-maat Nov 12, 2024
375bfcd
dart pub get needs to be run every time before analyze
joanne-ter-maat Nov 12, 2024
1f4cc01
Added dart to language matrix for idempotency tests
joanne-ter-maat Nov 12, 2024
a4076a6
Merge branch 'features/dart' into naming
joanne-ter-maat Nov 12, 2024
d2a3850
Replace methods before correcting types, don't normalize enum names w…
joanne-ter-maat Nov 12, 2024
ad6d032
Remove toCamelCase from CodePropertyWriter
joanne-ter-maat Nov 12, 2024
0568dc3
Fix broken unit test
joanne-ter-maat Nov 12, 2024
5baa691
Remove some unused methods
joanne-ter-maat Nov 12, 2024
0051887
Added dart to appsettings and launch
joanne-ter-maat Nov 12, 2024
4183cd1
Fix unit test
joanne-ter-maat Nov 13, 2024
bd73dd6
Fix issue found with unit test
joanne-ter-maat Nov 13, 2024
2e7341b
Merge pull request #2 from kiota-community/naming
joanne-ter-maat Nov 13, 2024
afdf41e
Merge branch 'main' into features/dart
joanne-ter-maat Nov 13, 2024
4e0f7ca
Activated multipart serialization
Kees-Schotanus Nov 13, 2024
323e99e
Merge branch 'features/dart' of github.com:ricardoboss/kiota into fea…
Kees-Schotanus Nov 13, 2024
2c2457e
Fix typo in multipart and add multipart for integration tests
joanne-ter-maat Nov 14, 2024
8af7f25
Moved some naming logic to refiner
joanne-ter-maat Nov 15, 2024
453ff8b
Stream is not a reserved word
joanne-ter-maat Nov 15, 2024
9865ca9
Revert "Stream is not a reserved word"
joanne-ter-maat Nov 15, 2024
9d43563
Remove deduplication logic for enum options from enum writer
joanne-ter-maat Nov 15, 2024
385953d
Update .github/workflows/integration-tests.yml
Kees-Schotanus Nov 18, 2024
1698836
Update .vscode/launch.json
Kees-Schotanus Nov 18, 2024
4120006
Update src/Kiota.Builder/Writers/Dart/CodeMethodWriter.cs
Kees-Schotanus Nov 18, 2024
3010434
Processed review comments.
Kees-Schotanus Nov 18, 2024
a13aa4e
Use main branch
joanne-ter-maat Nov 18, 2024
62ff9f9
Replace double quotes with single
joanne-ter-maat Nov 19, 2024
68e41c8
Updated forEach as part of review comments
Kees-Schotanus Nov 19, 2024
e220edf
Merge branch 'features/dart' of github.com:kiota-community/kiota-dart…
Kees-Schotanus Nov 19, 2024
ee8bb0b
Urltemplates back to double quotes, map type to righthand side
joanne-ter-maat Nov 19, 2024
33fd755
Put back void before requestconfiguration functions
joanne-ter-maat Nov 19, 2024
2314180
Changes to comments for method parameters
joanne-ter-maat Nov 19, 2024
7b74c1d
Check if segment at index 1 exists
joanne-ter-maat Nov 19, 2024
4b28b99
Added void as Function returntype in some more places
joanne-ter-maat Nov 19, 2024
50dea25
use _ instead of escaped
joanne-ter-maat Nov 20, 2024
c1e813e
Corrected unit test for checking for _ instead of escaped, added comm…
joanne-ter-maat Nov 20, 2024
95a753a
also add autogenerated and linting messages to enums
joanne-ter-maat Nov 20, 2024
7aeb5f6
Changed package names
joanne-ter-maat Nov 21, 2024
5fef7e4
Change package name in unit test
joanne-ter-maat Nov 21, 2024
c5600c1
Added bundle to appsettings
joanne-ter-maat Nov 22, 2024
79ddf75
Fix casing for stream, use static in lambda's where possible
joanne-ter-maat Nov 22, 2024
ad8cb48
Update src/Kiota.Builder/Writers/Dart/CodePropertyWriter.cs
joanne-ter-maat Nov 22, 2024
4a91217
Update src/Kiota.Builder/Writers/Dart/CodeClassDeclarationWriter.cs
joanne-ter-maat Nov 22, 2024
8fde406
Update src/Kiota.Builder/Writers/Dart/CodeMethodWriter.cs
joanne-ter-maat Nov 22, 2024
a054ae1
Use startblock where possible in codemethodwriter, some cleanup of un…
joanne-ter-maat Nov 22, 2024
727f17a
Updated to version 0.0.2 of the abstractions
Kees-Schotanus Nov 22, 2024
92be3f8
Update src/kiota/appsettings.json
joanne-ter-maat Nov 25, 2024
1a2e0c1
Update src/Kiota.Builder/Writers/Dart/CodeMethodWriter.cs
Kees-Schotanus Nov 27, 2024
cf2f21d
Undo last commit as it fails the tests
Kees-Schotanus Nov 27, 2024
48c83e4
Changes after review comment
Kees-Schotanus Nov 27, 2024
d369c1f
Merge branch 'main' into features/dart
ricardoboss Jan 7, 2025
1d9b268
Use minimum Dart SDK 3.6
ricardoboss Jan 7, 2025
80e06a5
Changed dependencies to use new repository location
ricardoboss Jan 7, 2025
90d40ce
Updated documentation; descriptionUrl is now also required
ricardoboss Jan 7, 2025
1862d62
Need to use hosted versions as their transitive dependencies would pr…
ricardoboss Jan 7, 2025
17e9922
Use `lib` instead of `src` as is custom for Dart
ricardoboss Jan 7, 2025
39406cd
Restore test structure for basic tests
ricardoboss Jan 7, 2025
5bdf99e
Always use the latest stable version of Dart SDK
ricardoboss Jan 8, 2025
4f64689
Always run analyze for Dart
ricardoboss Jan 8, 2025
8e81020
Fix request build using wrong path parameter name
ricardoboss Jan 7, 2025
50bb9aa
Merge branch 'main' into features/dart
ricardoboss Jan 8, 2025
98e7919
Apply suggestions from code review
ricardoboss Jan 8, 2025
fc6cb76
Removed method call with no side-effects
ricardoboss Jan 8, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/idempotency-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
- ruby
- php
- python
- dart
description:
- "./tests/Kiota.Builder.IntegrationTests/InheritingErrors.yaml"
- "./tests/Kiota.Builder.IntegrationTests/NoUnderscoresInModel.yaml"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
- ruby
- php
- python
- dart
description:
- "./tests/Kiota.Builder.IntegrationTests/InheritingErrors.yaml"
- "./tests/Kiota.Builder.IntegrationTests/EnumHandling.yaml"
Expand Down Expand Up @@ -109,6 +110,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Setup Dart
if: matrix.language == 'dart'
uses: dart-lang/setup-dart@v1
with:
sdk: "3.5"

- name: Check if test is suppressed
id: check-suppressed
Expand Down
23 changes: 22 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,27 @@
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Launch Dart",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll",
"args": [
"generate",
"--openapi",
"https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml",
"--language",
"dart",
"-o",
"${workspaceFolder}/samples/msgraph-mail/java/utilities/src/main/java/graphjavav4/utilities",
"-n",
"graphdart4.utilities"
],
"cwd": "${workspaceFolder}/src/kiota",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Launch CLI (CSharp)",
"type": "coreclr",
Expand Down Expand Up @@ -385,4 +406,4 @@
"processId": "${command:pickProcess}"
}
]
}
}
3 changes: 3 additions & 0 deletions it/dart/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pubspec.lock
.dart_tool/
src/
24 changes: 24 additions & 0 deletions it/dart/basic/test/api_client_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'package:microsoft_kiota_abstractions/microsoft_kiota_abstractions.dart';
import 'package:microsoft_kiota_http/microsoft_kiota_http.dart';
import 'package:test/test.dart';
import '../src/api_client.dart';
import '../src/models/error.dart';

void main() {
group('apiclient', () {
test('basic endpoint test', () {
final requestAdapter = HttpClientRequestAdapter(
client: KiotaClientFactory.createClient(),
authProvider: AnonymousAuthenticationProvider(),
pNodeFactory: ParseNodeFactoryRegistry.defaultInstance,
sWriterFactory: SerializationWriterFactoryRegistry.defaultInstance,
);
requestAdapter.baseUrl = "http://localhost:1080";
var client = ApiClient(requestAdapter);
expect(
() => client.api.v1.topics.getAsync(),
throwsA(predicate(
(e) => e is Error && e.id == 'my-sample-id' && e.code == 123)));
});
});
}
46 changes: 46 additions & 0 deletions it/dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: kiota_dart_generate
description: api generation
version: 0.0.1
publish_to: none

environment:
sdk: ^3.4.4

# Add regular dependencies here.
dependencies:
microsoft_kiota_abstractions:
git:
url: https://github.com/kiota-community/dart_kiota.git
ref: main
path: packages/microsoft_kiota_abstractions
microsoft_kiota_http:
git:
url: https://github.com/kiota-community/dart_kiota.git
ref: main
path: packages/microsoft_kiota_http
microsoft_kiota_serialization_form:
git:
url: https://github.com/kiota-community/dart_kiota.git
ref: main
path: packages/microsoft_kiota_serialization_form
microsoft_kiota_serialization_text:
git:
url: https://github.com/kiota-community/dart_kiota.git
ref: main
path: packages/microsoft_kiota_serialization_text
microsoft_kiota_serialization_json:
git:
url: https://github.com/kiota-community/dart_kiota.git
ref: main
path: packages/microsoft_kiota_serialization_json
microsoft_kiota_serialization_multipart:
git:
url: https://github.com/kiota-community/dart_kiota.git
ref: main
path: packages/microsoft_kiota_serialization_multipart
http: ^1.2.2
uuid: ^4.5.1

dev_dependencies:
lints: ^3.0.0
test: ^1.25.2
24 changes: 24 additions & 0 deletions it/exec-cmd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,30 @@ elseif ($language -eq "python") {
Pop-Location
}
}
elseif ($language -eq "dart") {
if ($mockServerTest) {
Push-Location $itTestPath

$itTestPathSources = Join-Path -Path $testPath -ChildPath "src"
$itTestPathDest = Join-Path -Path $itTestPath -ChildPath "src"
if (Test-Path $itTestPathDest) {
Remove-Item $itTestPathDest -Force -Recurse
}
Copy-Item -Path $itTestPathSources -Destination $itTestPathDest -Recurse

Invoke-Call -ScriptBlock {
dart test
} -ErrorAction Stop

Pop-Location
}
else {
Invoke-Call -ScriptBlock {
dart pub get
dart analyze src/
} -ErrorAction Stop
}
}
Pop-Location

if (!([string]::IsNullOrEmpty($mockSeverITFolder))) {
Expand Down
3 changes: 3 additions & 0 deletions it/get-additional-arguments.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ if ($language -eq "csharp") {
elseif ($language -eq "java") {
$command = " --output `"./it/$language/src/apisdk`""
}
elseif ($language -eq "dart") {
$command = " --output `"./it/$language/src`""
}
elseif ($language -eq "go") {
$command = " --output `"./it/$language/client`" --namespace-name `"integrationtest/client`""
}
Expand Down
3 changes: 2 additions & 1 deletion src/Kiota.Builder/GenerationLanguage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ public enum GenerationLanguage
Go,
Swift,
Ruby,
CLI
CLI,
Dart,
}
20 changes: 20 additions & 0 deletions src/Kiota.Builder/PathSegmenters/DartPathSegmenter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using Kiota.Builder.CodeDOM;
using Kiota.Builder.Extensions;
using Kiota.Builder.Writers.Go;

namespace Kiota.Builder.PathSegmenters;

public class DartPathSegmenter(string rootPath, string clientNamespaceName) : CommonPathSegmenter(rootPath, clientNamespaceName)
{
public override string FileSuffix => ".dart";

public override string NormalizeNamespaceSegment(string segmentName) => segmentName.ToCamelCase();

public override string NormalizeFileName(CodeElement currentElement) => GetLastFileNameSegment(currentElement).ToSnakeCase();

internal string GetRelativeFileName(CodeNamespace @namespace, CodeElement element)
{
return NormalizeFileName(element);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;

namespace Kiota.Builder.Refiners;
public class DartExceptionsReservedNamesProvider : IReservedNamesProvider
{
private readonly Lazy<HashSet<string>> _reservedNames = new(static () => new(StringComparer.OrdinalIgnoreCase)
{
"toString"
});
public HashSet<string> ReservedNames => _reservedNames.Value;
}
Loading
Loading