Repository navigation
Changed DocUrl for fragments - #61
raoashish10 wants to merge 5 commits into
Conversation
|
Could you generate an API Doc with this and show? I still don't think that the IDs of individual resources would be updated with the new format. |
|
Here is a sample of the generated API doc. I have removed the context because it remains the same, if you see the id's for the classes have been changed, I tried this with the hydrus hydra_doc_sample.py doc. |
|
Here is another example. I am posting it as a different comment for clarity: Please let me know if there is anything wrong or missing. Also I had a doubt regarding what should be returned when calling the URI |
|
The Entrypoint object should have contexts of its own. That needs to be returned. You can add it to the same PR. |
|
@chrizandr I want to confirm something. Is something like this expected on clicking the links in |
|
No, that is wrong. I don't know why that is being generated. You can see an example of what the context for EntryPoint looks like here: http://www.markus-lanthaler.com/hydra/event-api/contexts/EntryPoint.jsonld This is already there in The dictionary in context variable needs to be returned. It might be an issue with the getcontext function here: Maybe we should open a separate issue for this in hydrus? I'll approve this for now. |
|
@chrizandr I tried to replicate the example provided by you and I saw that in Markus Lanthaler's Entrypoint.jsonld, the names of the classes are keys and the id's referred to the information about the class in the vocab. So I made a few changes and this is what you get on accessing the link Let me know if this makes sense and if it does then I will add the changes to the PR |
|
I have some doubts related to this. Please correct me if I am getting it wrong.
Currently, these URIs are like this |
|
@farazkhanfk7 What you have pointed out is right. That is why I have changed the code locally so that temporarily the links at entrypoint.jsonld return the vocabs for the classes and the collections ( I agree that Entrypoint/Class or Entrypoint/Collection is necessary but for now I have just pointed to the vocabs. I might make an another PR just to solve the issues with the Entrypoints because previously no such link on dereferencing gave the intended output so I am not exactly sure how the output should be but by the example mentioned by Chris, I thought the closest thing would be to call the vocab for the resource. I used regex because for some reason I couldn't get the result by using |
|
I think the example you pointed out is wrong. The URL http://localhost:8080/serverapi/contexts/EntryPoint.jsonld should return those resources that have an endpoint that is present in the EntryPoint object. In the example you provided you are pointing it to the definition of the class in the API doc itself, we instead need it to point to the entry in the EnytrPoiny class. Think of EntryPoint as a class, where the properties of the class are the endpoints that are available in the API. Not all classes in the API documentation will have endpoints, please see the context that is created for the entrypoint object here here The URIs returned here need to be modified with the new format. Also /api/vocab?resource=EntryPoint/classname, should point to the supportedProperty in the Entrypoint class definition instead. |
chrizandr
left a comment
There was a problem hiding this comment.
See my comment about the Entrypoint context changes.
|
Thank you for the explanation @chrizandr. I think I have a better understanding of the Entrypoints now. I hope these were the changes required. Please let me know if I am wrong. On accessing http://localhost:8080/serverapi/contexts/EntryPoint.jsonld: On accessing http://localhost:8080/serverapi/vocab?resource=EntryPoint/Area: On accessing http://localhost:8080/serverapi/vocab?resource=EntryPoint/StateCollection: I apologise for taking time with this PR as I have been having some trouble understanding certain concepts and I appreciate your patience. I had to make some changes in the hydrus repo as well which I have now done. |
339f7b7 to
18f800b
Compare
74476bb to
18f800b
Compare
18f800b to
28e3948
Compare
|
Thanks for the great piece of work to both. @raoashish10 please remember that we cannot merge without having proper testing in place. We need to have some test cases in place for the new feature and be sure that the whole test unit runs smoothly. |
|
@Mec-iS Sure I can add some test cases in this repo as well. Though I had already added test cases in the hydrus repo for checking the format of the links but if its necessary to add tests in this repo as well then I will do that. Also I am sorry for a late reply |
|
tests for anything should be with the target code. we can expect another repo to test the code for this repo. |
|
@Mec-iS This is what I was thinking, currently the tests for doc_writer are failing. We might have to update the tests. How about creating a CI pipeline on Travis for core repo as well ? |
|
successful tests are a pre-condition not dependant by the fact that there is or not a CI. |
|
@raoashish10 This looks great. I just had one small doubt. In HydraEntryPoint's get function a line was changed from The format of new links ( |
|
@Mec-iS I have added a test which checks for the new format of links in id's for classes as well as collections. Please let me know if anything is missing or needed |
|
This LGTM 👍 but I think there are some pending changes requested by @chrizandr |
|
@raoashish10 I tested this locally by installing Steps to reproduce :
I believe this is related to the same question I raised before. Please cross-check and let me know if I am wrong. |
| else: | ||
| self.id_ = "{}EntryPoint/{}".format(DocUrl.doc_url, quote(self.name, safe='')) | ||
|
|
||
| self.id_ = "{}EntryPoint/{}".format(DocUrl.doc_url, quote(collection.path, safe='')) |
There was a problem hiding this comment.
Just a minor typo. If collection.path isn't available , self.name should be used.
|
@farazkhanfk7 please approve the PR |
|
@Mec-iS The last time I checked the tests in hydrus were failing due to some changes. I'll review it again ASAP. |
|
moved to #79 for additions |
There is in reference to a PR in the hydrus repo
Checklist
Description
This PR is added so that fragments of vocab can be identified. I have changed the DocUrl.
Old format of ids:
http//petstore.swagger.io/vocab#UserCollectionNew format of ids:
http//petstore.swagger.io/vocab?resource=UserCollectionI also found that there were some errors with the EntryPoint id's so I tried fixing that using regex as you can see. The error was that the entrypoints were shown as
http//petstore.swagger.io/vocab?resource=EntryPoint/UserCollectionwhich I tried changing tohttp//petstore.swagger.io/vocab/EntryPoint/UserCollection. I am not entirely sure if this solves every problem but I did go through the doc returned and tried solving as many issues I could. Let me know if my solution needs to be changed.Change logs
Changed
DocUrl.doc_url = "{}/{}#".format(urljoin(base_url, api_name), doc_name)to
DocUrl.doc_url = "{}/{}?resource=".format(urljoin(base_url, api_name), doc_name)