-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Generate for spec changes #96
Merged
gibahjoe
merged 20 commits into
gibahjoe:master
from
Nexushunter:generate-for-spec-changes
Aug 19, 2023
Merged
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
39a7aa1
Provide Yaml and Json version of test spec
Nexushunter d317ed9
Refactor spec loading, comment out the dependency on the flutter sdk,…
Nexushunter 49a96e2
Provide support for nested lists, reorganize some tests
Nexushunter a17d7bb
Provide support for nested lists, reorganize some tests, refine some …
Nexushunter 0f833d7
(WIP) Large refactor to get things moving in a nicer way. Adds ~80 te…
Nexushunter 985de8b
(WIP) FMT, fix up remaining tests for Generator Arguments. TODO: Twea…
Nexushunter b2f03f2
(WIP) Address failing original tests. Add tests for NextGen path.
Nexushunter a619f4d
All tests passing
Nexushunter 763f115
Add more tests for the annotations library
Nexushunter f7d5737
Add example builder annotation tests
Nexushunter 4e1898d
Fix the dart ci not being run in the working dirs
Nexushunter 0df70e1
doc: Add next gen documentation to readme
Nexushunter 90a1b90
fix: Tweak the processing of the builder to handle how process.run re…
Nexushunter 37f862c
fix: fix gitignore, readd api/petstore_api/pubspec
Nexushunter 4643a0c
fix: fix tests now that the generator is running correctly
Nexushunter 5003ea1
fix: use bool.tryParse instead of casting
Nexushunter c229767
fix: Use API within SDK bounds (will change in future release), fix t…
Nexushunter 12c138a
fix: Last few tweaks
Nexushunter 523f169
fix: Add work around to be able to always be able to regenerate when …
Nexushunter 8d59613
fix: Use Dart 2 API
Nexushunter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 13 additions & 10 deletions
23
openapi-generator-annotations/test/openapi_generator_annotations_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import 'package:openapi_generator_annotations/src/openapi_generator_annotations_base.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('A group of tests', () { | ||
// Awesome awesome; | ||
// | ||
// setUp(() { | ||
// awesome = Awesome(); | ||
// }); | ||
// | ||
// test('First Test', () { | ||
// expect(awesome.isAwesome, isTrue); | ||
// }); | ||
group('OpenApi', () { | ||
group('NextGen', (){ | ||
|
||
test('Sets cachePath',(){ | ||
final api =Openapi(inputSpecFile: '', generatorName: Generator.dart, cachePath: 'somePath'); | ||
expect(api.cachePath, 'somePath'); | ||
}); | ||
test('Sets useNextGenFlag',(){ | ||
final api =Openapi(inputSpecFile: '', generatorName: Generator.dart, useNextGen: true); | ||
expect(api.useNextGen, isTrue); | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,3 +166,6 @@ Temporary Items | |
.apdisk | ||
.idea/ | ||
example/.dart_tool | ||
|
||
# Generated test output | ||
test/specs/test-cached.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
openapi-generator/lib/src/determine_flutter_project_status.dart
gibahjoe marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import 'dart:async'; | ||
import 'dart:io'; | ||
|
||
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart'; | ||
import 'package:yaml/yaml.dart'; | ||
|
||
/// Determines whether a project has a dependency on the Flutter sdk. | ||
/// | ||
/// If a wrapper annotation is provided that is not null or [Wrapper.none] and | ||
/// is one of [Wrapper.flutterw] or [Wrapper.fvm] it is safe to assume the project | ||
/// requires the Flutter sdk. | ||
/// | ||
/// As a fallback we check the pubspec at the root of the current directory, which | ||
/// will be where the build_runner command will have been called from, and check | ||
/// the Pubspec's dependency list for the 'flutter' key. | ||
/// | ||
/// Note: This has support for providing a custom path to a pubspec but there isn't | ||
/// any current implementation to receive it via the generator itself. | ||
FutureOr<bool> checkPubspecAndWrapperForFlutterSupport( | ||
{Wrapper? wrapper = Wrapper.none, String? providedPubspecPath}) async { | ||
if ([Wrapper.flutterw, Wrapper.fvm].contains(wrapper)) { | ||
return true; | ||
} else { | ||
// Use the path provided or default the directory the command was called from. | ||
final pubspecPath = providedPubspecPath ?? | ||
'${Directory.current.path}${Platform.pathSeparator}pubspec.yaml'; | ||
|
||
final pubspecFile = File(pubspecPath); | ||
|
||
if (!pubspecFile.existsSync()) { | ||
return Future.error('Pubspec doesn\'t exist at path: $pubspecPath'); | ||
} | ||
|
||
final contents = await pubspecFile.readAsString(); | ||
if (contents.isEmpty) { | ||
return Future.error('Invalid pubspec.yaml'); | ||
} | ||
|
||
final pubspec = loadYaml(contents) as YamlMap; | ||
|
||
return pubspec.containsKey('dependencies') && | ||
(pubspec.nodes['dependencies'] as YamlMap).containsKey('flutter'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new config options, added deprecations