-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added
--enum-name-mappings
support
This allows to change names of enum properties. Especially needed for enums that has `name` as a property which is reserved in `dio` etc Also fixes #91
- Loading branch information
Showing
9 changed files
with
348 additions
and
58 deletions.
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
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
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
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,6 +1,7 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:openapi_generator/src/process_runner.dart'; | ||
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart'; | ||
import 'package:path/path.dart' as path; | ||
import 'package:test/expect.dart'; | ||
import 'package:test/scaffolding.dart'; | ||
|
@@ -26,6 +27,53 @@ void main() { | |
// } | ||
// }); | ||
|
||
group('#91', () { | ||
var issueNumber = '91'; | ||
var parentFolder = path.join(testSpecPath, 'issue', issueNumber); | ||
var workingDirectory = path.join(parentFolder, 'output'); | ||
setUpAll( | ||
() { | ||
var workingDirectory = path.join(parentFolder, 'output'); | ||
cleanup(workingDirectory); | ||
}, | ||
); | ||
test( | ||
'[dart] Test that broken code is not generated for OPENAPI tictactoe example', | ||
() async { | ||
var inputSpecFile = | ||
File('$parentFolder/github_issue_#$issueNumber.json'); | ||
var generatedOutput = await generateFromAnnotation( | ||
Openapi( | ||
additionalProperties: AdditionalProperties( | ||
pubName: 'tictactoe_api', | ||
pubAuthor: 'Jon Doe', | ||
pubAuthorEmail: '[email protected]'), | ||
inputSpec: InputSpec(path: inputSpecFile.path), | ||
generatorName: Generator.dart, | ||
cleanSubOutputDirectory: [ | ||
'./test/specs/issue/$issueNumber/output' | ||
], | ||
cachePath: './test/specs/issue/$issueNumber/output/cache.json', | ||
outputDirectory: './test/specs/issue/$issueNumber/output'), | ||
process: processRunner, | ||
); | ||
|
||
expect(generatedOutput, | ||
contains('Skipping source gen because generator does not need it.'), | ||
reason: generatedOutput); | ||
expect(generatedOutput, contains('Successfully formatted code.'), | ||
reason: generatedOutput); | ||
var analyzeResult = await Process.run( | ||
'dart', | ||
['analyze'], | ||
workingDirectory: workingDirectory, | ||
); | ||
expect(analyzeResult.exitCode, 0, | ||
reason: '${analyzeResult.stdout}\n\n${analyzeResult.stderr}'); | ||
cleanup(workingDirectory); | ||
}); | ||
}); | ||
|
||
group('#114', () { | ||
var issueNumber = '114'; | ||
var parentFolder = path.join(testSpecPath, 'issue', issueNumber); | ||
|
Oops, something went wrong.