-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add an endpoint to dereference a schema #9
Conversation
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.
Approved with comments.
pandas~=1.1.1 | ||
PyYAML~=5.1 | ||
mock~=3.0.5 | ||
dataclasses~=0.6 | ||
argparse~=1.4.0 | ||
|
||
jsonref~=0.2 |
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 project looks like it hasn't been touched in a good while, and it hasn't even reached a major release. This could cause issues in the future, so keep an eye on this.
broker/service/schema_service.py
Outdated
def __init__(self): | ||
self.json_loader = jsonref.JsonLoader() | ||
|
||
def dereference_schema(self, json_schema): |
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.
Might be a good idea to annotate method declarations with types, like def dereference_schema(self, json_schema: dict) -> JsonRef
or something.
|
||
def dereference_schema(self, json_schema): | ||
json_ref_obj = jsonref.loads(json.dumps(json_schema), loader=self.json_loader) | ||
return json_ref_obj |
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.
Probably not a good idea to return an object type from a third party library. Might be best to keep usage of jsonref
internal so it's easy to replace it with something if ever.
@@ -178,8 +183,52 @@ def get_spreadsheet(job_id: str): | |||
) | |||
|
|||
|
|||
# http://0.0.0.0:5000/schemas?high_level_entity=type&domain_entity=biomaterial&concrete_entity=donor_organism&latest&json | |||
# http://0.0.0.0:5000/schemas?url=${schemaUrl}&json&deref | |||
@app.route('/schemas', methods=['GET']) |
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.
Why are we implementing this here and not in core where we have the schemas endpoint?
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.
yeah i'll probably remove the retrieving of latest schema here 🤔 i actually want to remove the schema endpoints from core, and have a separate schema service. Or i can just put the dereferencing in Core. Let me think about this a bit more...
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.
Unfortunately, given the time remaining for the sprint, i won't be able implement this in Core or separate schema service. I will keep take note of this for now. And track this in zenhub.
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.
I added this issue for now ebi-ait/hca-ebi-dev-team#345
ebi-ait/dcp-ingest-central#35