Add command-line option for ConnectedService.json file#363
Conversation
cca12e3 to
17f5344
Compare
| /// <param name="configValue">Source value to use if not null or empty</param> | ||
| /// <param name="alternateValue">Alternate value to use if <paramref name="configValue"/> is null or empty</param> | ||
| /// <returns><paramref name="configValue"/> if not null or empty, otherwise <paramref name="alternateValue"/></returns> | ||
| private static string GetConfigValue(string configValue, string alternateValue) |
There was a problem hiding this comment.
Is this method necessary? I don't see how it's any better than the statement var value = string.IsNullOrEmpty(configValue) ? configValue : alternateValue. Also the name of the method is confusing given what it actually does. I thought it retrieving a value from a config store.
There was a problem hiding this comment.
Method removed and replaced with ternary conditional.
| { | ||
| CliConnectedServiceJsonFileData configFileData = null; | ||
|
|
||
| if (!string.IsNullOrWhiteSpace(fileName)) |
There was a problem hiding this comment.
Maybe we should throw an exception when the fileName is null, instead of returning null.
There was a problem hiding this comment.
The ConnectedServiceFile is not a required parameter and can be null/empty and that should not be an exception. If there is no ConnectedServiceFile parameter on the command-line, all of the configuration for the code generation will come from other command-line parameters.
There was a problem hiding this comment.
nitpick: If the fileName is null, maybe we shouldn't call this method in the first place then?
There was a problem hiding this comment.
Refactored GenerateCommand to avoid calling ReadConfigFile with a null fileName in f561b4c
17f5344 to
a38b036
Compare
| { | ||
| CliConnectedServiceJsonFileData configFileData = null; | ||
|
|
||
| if (!string.IsNullOrWhiteSpace(fileName)) |
There was a problem hiding this comment.
nitpick: If the fileName is null, maybe we shouldn't call this method in the first place then?
| { | ||
| [DataContract] | ||
| public class UserSettings : INotifyPropertyChanged | ||
| public class UserSettings : CliUserSettings |
There was a problem hiding this comment.
nit: maybe: public class ConnectedServiceUserSettings : UserSettings
f561b4c to
02dba47
Compare
|
Rebased to resolve conflicts in GenerateCommand.cs |
02dba47 to
f510319
Compare
f510319 to
d894d1b
Compare
There was a problem hiding this comment.
@gregwinterstein Thank you for your pull request contribution. Sorry it took a bit of time to get round to doing a thorough review. Please take a look at my review comments at your earliest convenience.
|
@gregwinterstein Kindly look into review comments by @gathogojr |
Hello @KenitoInc , I wlll respond as soon as I can. You all have caught me at an extremely busy time |
Hello @kentoinc & @gathogojr, I have reviewed your comments and updated the pull request as requested. |
|
Hi! What is the situation of this PR? I'd really like to get the |
|
Could we add some tests to this Pr ? |
This pull request adds a command-line option for reading generation configuration from ConnectedService.json file The overwhelming majority of the changes are in src/Microsoft.OData.Cli/GenerateCommand.cs, inside private methods. What would you like to see tested in this pull request? |
5b4b1fd to
92e6788
Compare
|
We do need to improve the test setup for the CLI, not just this PR (cc @ElizabethOkerio). See: #254 What would be a good starting point in testing the CLI is that the CLI options are correctly transformed into the expected |
…ed in pull request comments
…unction with config-file option
…thogojr Co-authored-by: John Gathogo <john.gathogo@gmail.com>
Co-authored-by: John Gathogo <john.gathogo@gmail.com>
Co-authored-by: John Gathogo <john.gathogo@gmail.com>
Co-authored-by: John Gathogo <john.gathogo@gmail.com>
Co-authored-by: John Gathogo <john.gathogo@gmail.com>
Co-authored-by: John Gathogo <john.gathogo@gmail.com>
Co-authored-by: John Gathogo <john.gathogo@gmail.com>
Co-authored-by: John Gathogo <john.gathogo@gmail.com>
2ef77c7 to
46da013
Compare
|
@gregwinterstein Please take note of the following two review comments. Not sure you saw them since they were collapsed: |
@gathogojr Thank you for the reminder. I have replied to both of the comments you mentioned above. Please review. |
gathogojr
left a comment
There was a problem hiding this comment.
Looks good. Thank you for your contribution @gregwinterstein
Add command-line option for reading generation configuration from ConnectedService.json file
Command-line option: --connected-service-file <connected_service_file_name> or -c <connected_service_file_name>
Fixes #338
Fixes #327