-
Notifications
You must be signed in to change notification settings - Fork 12
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
#2 [SDL-0234] Proxy Library RPC Generation #105
#2 [SDL-0234] Proxy Library RPC Generation #105
Conversation
* Added `lib/rpc_spec` submodule pointed to `master` branch of `smartdevicelink/rpc_spec` repository * Created `Proxy RPC Generator` based on Python 3.5 and linked with parser from the `lib/rpc_spec` submodule * Added `README.md` with usage description and transformation rules for Proxy RPC Generator
@theresalech please review |
.gitmodules
Outdated
@@ -0,0 +1,4 @@ | |||
[submodule "lib/rpc_spec"] | |||
path = lib/rpc_spec | |||
url = [email protected]:vladmu/rpc_spec.git |
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.
As a reminder, this was agreed upon and is only temporary. The PR should not be merged until this is updated to reflect the correct remote. The rest of this PR can be reviewed as normal.
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.
changed to:
[submodule "lib/rpc_spec"]
path = lib/rpc_spec
url = https://github.com/smartdevicelink/rpc_spec.git
branch = develop
We would appreciate if developers did not force push to a PR that is in review. Force pushing makes it difficult to review a PR because we cannot tell what was changed since the last commit. In general, please do not rebase and do not force push against the SDL repositories. Instead, you can merge the current develop branch into your PR branch. Thank you. |
@crokita got it, thank you for advice. We will do |
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.
ESLint overrides should be added to parts of the files specifically for camelcase naming violations from RPC spec data. See here: https://eslint.org/docs/user-guide/configuring.html#disabling-rules-with-inline-comments
All other lint checks should pass. Our linter rules are in the .eslintrc file.
The example apps break as a result of the generator's changes. Therefore, the affected parts of the library and the example apps will need to be fixed before merging this PR. We can make those fixes ourselves.
@nickschwab can also answer questions regarding the feedback.
generator/README.md
Outdated
The class should have the next JSDoc comment: | ||
```javascript | ||
/** | ||
* [decription] |
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.
change to "description"
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.
done
generator/README.md
Outdated
The getter should have the next JSDoc comment: | ||
```javascript | ||
/** | ||
* [decription] |
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.
change to "description"
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.
done
generator/README.md
Outdated
The class should have the next JSDoc comment: | ||
```javascript | ||
/** | ||
* [decription] |
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.
change to "description"
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.
done
generator/README.md
Outdated
The setter should have the next JSDoc comment: | ||
```javascript | ||
/** | ||
* @param {[param_type]} [value_name] [decription] |
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.
change to "description"
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.
done
generator/README.md
Outdated
The class should have the next JSDoc comment: | ||
```javascript | ||
/** | ||
* [decription] |
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.
change to "description"
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.
done
generator/README.md
Outdated
The setter should have the next JSDoc comment: | ||
```javascript | ||
/** | ||
* @param {[param_type]} [value_name] [decription] |
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.
change to "description"
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.
done
generator/mapping.json
Outdated
{ | ||
"enums": { | ||
"DisplayType": { | ||
"params_additional": [ |
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.
The TESTING enum was mistakenly added to the DisplayType enums. This can be removed.
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.
done
@@ -0,0 +1,140 @@ | |||
{ |
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.
There isn't documentation for the effect of each key-value pair that appears in this file, ex. params_additional and the array value it has. This would be useful information to add to the README of how each override rule works, as we may need to make changes to this file in future releases.
There should be a clearer distinction as to whether properties under a struct/enum/message are attributes of that class, or whether they are doing some modification to that class. Ex. under RegisterAppInterfaceRequest there is appID and fullAppID which are properties of RegisterAppInterfaceRequest, but there is also the params_additional property on the same level which wouldn't actually be a property of RegisterAppInterfaceRequest. Another example is PutFileRequest, where syncFileName is a property of the class, but script is not and it performs another effect.
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.
The documentation added into readme b30da93
generator/mapping.json
Outdated
}, | ||
"script": "templates/scripts/PutFileRequest.js" | ||
}, | ||
"OnHMIStatus": { |
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.
This object can be removed. We will keep the naming convention from the spec as OnHMIStatus.
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.
done
@crokita Question about camelcase naming violations. Do we need to add these 30 parameters as exceptions to .eslintrc? Or is it better to add processing to the parser for such cases? We have now camelcase naming violations for these parameters/functions: setTz_minute enum: messages: GetVehicleDataResponse.js OnVehicleData.js SubscribeVehicleData.js unsubscribeVehicleData.js SubscribeVehicleDataResponce.js UnsubscribeVehicleDataResponce.js |
@BorisTm Thanks for asking! Instead of placing the overrides in the e.g.
|
@nickschwab thank you for advice, from the perspective of the manual changes it is the best approach, but it seems this requires additional code for auto-checking names on the fly during the generation process and mark invalid lines with the corresponding comment, which could be slightly complicated than the adjusting of |
@vladmu I recommend either applying the in-line override to all entities (rather than performing a check to determine whether or not each entity actually violates the rule), or we can use a file-scoped override to specifically ignore camelcase violations for the entire file (e.g. |
@nickschwab the last recommendation is simplest, but in this case, all RPC names will not be validated, is that suitable? |
@vladmu Yes 👍 |
Hello! Thank you for making some of the requested revisions. After a more thorough review of the code we only have a few additional changes to suggest before approval.
|
@vladmu please let us know once all feedback has been addressed and this PR is ready for Livio's re-review. Thanks! |
@theresalech We've done all the requested changes. So this PR is now ready for Livio's review again. Thank you! |
@vladmu Below are change requests to the mappings.json file:
Here are other notes:
|
@crokita thank you, all points are fixed. Please review. |
@vladmu Looks good 👍 |
@@ -1,4 +1,4 @@ | |||
[submodule "lib/rpc_spec"] | |||
path = lib/rpc_spec | |||
url = git@github.com:vladmu/rpc_spec.git | |||
url = https://github.com/smartdevicelink/rpc_spec.git |
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.
@crokita you pointed the submodule to the correct repository, but please take into account the master
branch of rpc_spec
doesn't contain the parser code yet. The corresponding PR is not merged yet. It would be good if you notify @JackLivio in answer to this comment that JS generator passed your checks and rpc_spec
could be merged too.
Fixes #2
This PR is [ready] for review.
Risk
This PR makes [no] API changes.
Testing Plan
Covered by unit tests and PyLint
Summary
According to
[SDL-0234] Proxy Library RPC Generation
proposal, this PR adds the Python generator script based on XML Parser fromsmartdevicelink/rpc_spec
linked to the repository as Git submoduleChangelog
Enhancements
lib/rpc_spec
submodule pointed tomaster
branch ofsmartdevicelink/rpc_spec
repositoryProxy RPC Generator
based on Python 3.5 and linked with parser from thelib/rpc_spec
submoduleREADME.md
with usage description and transformation rules for Proxy RPC GeneratorCLA