Open julie-sullivan opened 4 years ago
Here are the changes I made so far:
# java_client_generator.py
+ 'Admin': 'Admin',
+ 'Clinical': 'Clinical',
+ 'Gene': 'Gene',
+ 'Chromosome': 'Genome Sequence',
+ 'Protein': 'Protein',
+ 'Region': 'Region',
+ 'Regulation': 'Regulation',
+ 'Species': 'Species',
+ 'TFBS': 'TF',
+ 'Transcript': 'Transcript',
+ 'Variant': 'Variant',
+ 'Xref': 'Id'
The version number is hardcoded:
# rest_client_generator.py
- server_url + '/webservices/rest/v2/meta/about'
+ server_url + '/webservices/rest/v5/meta/about'
- for category in requests.get(self.server_url + '/webservices/rest/v2/meta/api').json()['responses'][0]['results'][0]:
+ for category in requests.get(self.server_url + '/webservices/rest/v5/meta/api').json()['responses'][0]['results'][0]:
Also CellBase uses version instead of apiVersion
- return category['path'].replace('/{apiVersion}/', '')
+ return category['path'].replace('/{apiVersion}/', '').replace('/{version}/', '')
- return endpoint['path'].replace('/{apiVersion}/', '')
+ return endpoint['path'].replace('/{apiVersion}/', '').replace('/{version}/', '')
The error I am working on now is that CellBase has /{species}
prepended to most end points, OpenCGA does not have this.
~/git/opencga/opencga-app/app/misc/clients (develop) $ python3 java_client_generator.py http://127.0.1.1:9090/cellbase /tmp
Processing {species}/clinical/variant/search
Traceback (most recent call last):
File "java_client_generator.py", line 307, in <module>
sys.exit(main())
File "java_client_generator.py", line 304, in main
client_generator.create_rest_clients()
File "/home/julie/git/opencga/opencga-app/app/misc/clients/rest_client_generator.py", line 199, in create_rest_clients
text.append(self.get_method_definition(category, endpoint))
File "java_client_generator.py", line 126, in get_method_definition
typed_parameters.append(self.get_parameter_type(parameter) + ' ' + parameter)
File "java_client_generator.py", line 206, in get_parameter_type
param_type = super().get_parameter_type(parameter)
File "/home/julie/git/opencga/opencga-app/app/misc/clients/rest_client_generator.py", line 83, in get_parameter_type
return self.parameters[parameter]['type']
KeyError: 'species'
I've added the scripts to CellBase (with the changes I listed above):
https://github.com/opencb/cellbase/tree/develop/cellbase-app/app/clients
species
is in each path, and is needed by each method. How should this be handled?Just worth mentioning the clients to be generated include Java, Python, R and Javascript, is this right?
Yes! That is correct.
I'd like to use the opencga script to autogenerate the clients for CellBase.
Can we use the same script, or do we need to modify the current one?