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
[SYNPY-1199] Implement low-level functions for JSON Schema API #894
[SYNPY-1199] Implement low-level functions for JSON Schema API #894
Conversation
Hello @BrunoGrandePhD! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2022-02-10 17:57:27 UTC |
@milen-sage are you still able to review this by EOD today? |
It has come to my attention that the Shout-out to @afwillia for finding the bug! |
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.
Some linting issues and comments.
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.
In Slack, @BrunoGrandePhD and I discussed adding attribute validation to the API so that users are aware of invalid values as soon as possible, e.g. organizationName should be at least 6 characters long. The current behavior does not catch this after a user tries to create:
>>> foo = js.JsonSchemaOrganization("foo")
>>> foo.create()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/services/json_schema.py", line 288, in create
already_exists = self.get()
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/services/json_schema.py", line 257, in get
raise e
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/services/json_schema.py", line 251, in get
response = self.service.get_organization(self.name)
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/services/json_schema.py", line 428, in wrapper
result = func(self, *args, **kwargs)
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/services/json_schema.py", line 446, in get_organization
response = self.synapse.restGET(
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/client.py", line 4091, in restGET
response = self._rest_call('get', uri, None, endpoint, headers, retryPolicy, requests_session, **kwargs)
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/client.py", line 4075, in _rest_call
self._handle_synapse_http_error(response)
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/client.py", line 4045, in _handle_synapse_http_error
exceptions._raise_for_status(response, verbose=self.debug)
File "/Users/vchung/Desktop/synapsePythonClient/synapseclient/core/exceptions.py", line 160, in _raise_for_status
raise SynapseHTTPError(message, response=response)
synapseclient.core.exceptions.SynapseHTTPError: 400 Client Error:
Organization name must be at least 6 characters
This is currently in my backlog TODOs.
Example usage: https://gist.github.com/BrunoGrandePhD/481249a94196cbdd47e8524dab7ddbbc
Install using:
pip install --force-reinstall git+https://github.com/Sage-Bionetworks/synapsePythonClient@bgrande/SYNPY-1199/json-schemas-low-level