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
[SDL-0234] Proxy Library RPC Generation #1273
Conversation
@theresalech @joeljfischer @joeygrover FunctionID.RESERVED
AppInterfaceUnregisteredReason.UNSUPPORTED_HMI_RESOURCE
Result.CHAR_LIMIT_EXCEEDED This leads to the failed result when we try to check the generated code with existing unit tests. Because they are part of the current MOBILE API specification, it seems missing parameters should be included in the current RPC code and unit tests should be adjusted. |
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.
Found a few items but nothing important. I was looking for an exception of GenericResponse
in the README but couldn't find anything.
Co-Authored-By: Kujtim Shala <kshala@ford.com>
@kshala-ford |
@theresalech I approve this pull request. |
@vladmu, if this is ready for Livio review, can you please update the PR description from |
@theresalech done, the PR is ready for Livio review. Thank you! |
Thanks, @vladmu for implementing the PR. I am just wondering if there is a specific reason for making the files in |
Hello, @bilal-alsharifi I completely agree with your point. Will do this now. |
Thanks, @ksologubov for making the changes. |
As it was discussed in the iOS issue, no mappings for corner cases should be specified in the generator. Generic rules are fine (like replacing “sync” with “sdl” for example). The script should use the RPC specs without any case by case handling. Even if that would generate a different code than what the Java Suite currently has. Handling RPCs on case by case basis will make the scripts hard to maintain. Some examples of how things in the current mappings can be removed are:
The previous list just gives some examples and it is not comprehensive. But the important part is to avoid making special cases for each item. |
@theresalech Please add an agenda item about SDL-0234 implementation to the next steering committee meeting. The requested changes here and the discussion in sdl_ios are not compliant to the accepted proposal. |
…ration # Conflicts: # generator/rpc_spec
@bilal-alsharifi Keywords logic was applied to PR. Could you please check from your side? |
Thanks, @ksologubov for making the changes. It looks like at some point in the recent updates to the PR. The script stopped setting the default
I get this message:
It should always default to the correct |
@ksologubov While I am testing the new changes, I found that in a lot of cases, the generator appends "Param" when it shouldn't. Here are a few examples: Example 1:
Note: The JSON values should never change: Example 2:
Example 3:
The aforementioned snippets are just samples and not a comprehensive list. I recommend using a directory comparison tool (I use Meld) to compare the RPC output before the reserved keywords changes and after them to confirm that only cases that actually need to be changed have changed. |
@bilal-alsharifi Bilal, get/setSuccess and get/setResultCode both explicitly specified in keywords list. And the same is for success and resultCode params. Thats why Param is appended in all cases here. From what you said it should not be there in keywords list. What should we do in this case? I believe better to remove them from keywords list. |
I understand the confusion. In that example, they are calling APIs from the base class. The reserved keywords rules apply to APIs in the subclasses (RPCs) but don't apply to APIs in base classes (
|
@bilal-alsharifi but according to smartdevicelink/rpc_spec#232
In this case generator working exactly as proposal says by replacing setSuccess keyword in method name with setSuccessParam and so on. "super" was not used in original library implementation so I'm not sure why you provided it above. Please clarify why setSuccess/setResultCode/success/resultCode should not be removed from keyword list if it should not be replaced. I don't see how it's used in any other cases except calling methods from RPCResponse base class from response type functions. From my side I can exclude replacement of setSuccess/setResultCode/success/resultCode keywords in response functions which will also fix this case. Please approve this solution. |
@ksologubov I think you are right. I removed |
@ksologubov I see |
Can we pull the latest changes for the rpc_spec submodule after removing the response keywords?
will be helpful to guarantee that the latest changes for the submodule are always pulled. |
return re.sub(r'^([sS])ync(.+)$', r'\1dl\2', name) | ||
return name | ||
|
||
def replace_keywords(self, name: str = '') -> str: |
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 comparison in this method seems to be case sensitive. It should be insensitive.
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.
@bilal-alsharifi restored case insensitive matching, and also fixed functionID parameter replacement, thanks
@bilal-alsharifi thanks for removing extra keywords. All above problems was fixed, and suggestions was applied, I checked classes diff with Meld and they looking good from my side, could you please check from your side? |
@ksologubov Thanks for making the changes. I have reviewed and tested the PR. It looks good now. |
@bilal-alsharifi thank you very much for reviews |
Fixes #1090
This PR is [ready] for review.
Risk
This PR makes [no] API changes.
Testing Plan
Unit Tests
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
utils/generator/rpc_spec
submodule pointed todevelop
branch ofsmartdevicelink/rpc_spec
repositoryProxy RPC Generator
based on Python 3.5 and linked with parser from theutils/generator/rpc_spec
submoduleREADME.md
with usage description and transformation rules for Proxy RPC GeneratorCLA