Skip to content
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

Matching done in db_models for datatype needs to be stricter. #595

Closed
1 task
chrizandr opened this issue Jul 6, 2021 · 3 comments
Closed
1 task

Matching done in db_models for datatype needs to be stricter. #595

chrizandr opened this issue Jul 6, 2021 · 3 comments

Comments

@chrizandr
Copy link
Member

I'm submitting a

  • bug report.
  • [ x] feature request.

Current Behaviour:

Right now, the matching for datatype in db_models.py uses a split and just checks if the ending of the URI is integer. This needs to be made stricter so that we only match "https://www.w3.org/TR/xmlschema-2/#integer" or "https://www.w3.org/TR/xmlschema-2/#float". Right now we will also match "https://myserver.com/someendpoint#integer" which need not necessarily point to integer.

Expected Behaviour:

Match strictly only for "https://www.w3.org/TR/xmlschema-2/#integer" or "https://www.w3.org/TR/xmlschema-2/#float". This can be complemented by HTTP-APIs/hydra-python-core#92 so that users do not make errors when adding these URIs in the keyword args.

Steps to reproduce:

Snapshot:

Environment:

  • python version
  • pip version
  • OS details

Do you want to work on this issue?

@farazkhanfk7
Copy link
Member

farazkhanfk7 commented Jul 8, 2021

Can't figure out how we are going to match the whole string https://www.w3.org/TR/xmlschema-2/#integer in hydrus . Obviously we can't hardcode these things or get it from context to check it with multiple if conditions. To fix this I think we can make a change in hydra-python-core which will allow users to add range like :

HydraClassProp(prop_uri, prop_title, required=True, read=True, write=True, range="float")  // instead of "xsd:float"

Later we'll add this in supported property's dict as "range": "xsd:float". This can be used to make sure no such URI like "https://myserver.com/someendpoint#integer" can be passed in hydrus because everytime it'll have to pass through doc_maker.create_doc() first and it'll will only allow datatypes that are defined using xsd:

@chrizandr
Copy link
Member Author

Yes this is why I created both issues together. Your approach is what I had in mind as well.

@Mec-iS
Copy link
Contributor

Mec-iS commented Jul 27, 2021

merged in #599

@Mec-iS Mec-iS closed this as completed Jul 27, 2021
@farazkhanfk7 farazkhanfk7 removed this from To do in GSoC-2021-Month-2 Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants