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

Remove dependency of class collection #45

Conversation

priyanshunayan
Copy link
Member

Fixes #44

Checklist

  • My branch is up-to-date with upstream/develop branch.
  • Everything works and tested for Python 3.5.2 and above.

Description

This PR removes the dependency of collections on classes. Earlier, one had to use add_supported_class(classname, collection=True)
Now the writers have flexibility to tweak collections as per their preferences. They can create collections and then add to HydraDoc via apidoc.add_supported_collection(collection_name)
In other words, now there is no forced dependency of classes on collection

Change logs

  • in the doc_writer_sample.py, passed full URI instead of passing one word URIs
  • added method to add collections to Hydradoc
  • some compact URIs were not expanding when used expansion algorithm was used, for eg: _:singleclass_retrieve. Replaced them with proper URIs.

samples/doc_writer_sample_output.py Outdated Show resolved Hide resolved
samples/doc_writer_sample_output.py Outdated Show resolved Hide resolved
samples/doc_writer_sample_output.py Outdated Show resolved Hide resolved
@@ -276,7 +288,7 @@
},
{
"@type": "SupportedProperty",
"property": "vocab:anotherSingleClass",
"property": "https://hydrus.com/api/anotherSingleClass",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to expand this here because this is for doc_writer, but make sure that we are able to change this when we parse the same document with doc_maker and we change the URI and API name in that. Not sure how you can ensure that. I would suggest not giving outputs in expanded form, and instead use expanded forms only internally in python.

@priyanshunayan priyanshunayan force-pushed the remove_dependency_of_class_collection branch from ac3cf33 to 90c374d Compare July 31, 2020 14:32
@priyanshunayan
Copy link
Member Author

@chrizandr I have made required changes. Please take a look.

@chrizandr chrizandr merged commit 5d574dc into HTTP-APIs:develop Aug 1, 2020
chrizandr added a commit that referenced this pull request Aug 11, 2020
* add collections array to the entrypoint

* add default manages block

* allow configurable collection names

* fix tests and pep8 format

* add entrypoint property to the apidoc

* add example of manages block in sample

* fix id literal

* fix id literal and generate sample doc

* Add support for POST and DELETE on collection classes (#46)

* Add support for POST and DELETE on collection classes

As the collection will now be treated as a resource,
we need to add support for POST and DELETE on collection/:uuid endpoint

* Default readable and writable attributes of member property to True

* Fix PEP8 errors

* Discover collections in doc_maker.py (#41)

* remove hardcoding of Collection keyword

Remove hardcoding of "Collection" keyword for checking if
a class is a collection. Check either using 'collection'
property defined in 'EntryPoint' or 'manages' property defined
in that class

* Fix tests

Use get_endpoint_and_path function instead of class_in_endpoint
or collection_in_endpoint as they are changed to get_endpoint_and_path
function

* Remove dependency of class collection (#45)

* add method for adding HydraCollection

* Remove dependency of collection on classes 🎉

* Remove unnecessary comments

* add missing context

* Bring class uris to the apidoc url namespace
* Give user option to chose the location of the apidoc
* Make sure identifiers are inside the apidoc namespace

* fix ids of supported Operations

* Expansion of JSONLD and parsing of API DOC (#42)

* [WIP] expand jsonld and use hydra namespace

* Extract endpoint classes and collections

* add comments

* Store Link ids in the endpoints.

* make HydraClass for classes endpoints

* finish parsing of expanded apidoc 🎉

* Write new tests

* resolve conflicts, make minor changes

* add ids for base classes,

* Add Docs (#47)

* add docs with sphinx

* add readthedocs yml and requirements.txt

* change version

* change sys.path

* Bug Fixes (#48)

* Add the namespace test and fix test due to adding of new manages block

* Add base classes just once

* place instantation at the right place

* Case sensitive URLs

* fix tests

* avoid rewriting of the collections array

* Parse HydraLinks in context

* entrypoint uri correct

Co-authored-by: Priyanshu Nayan <priyanshunayan456@gmail.com>
Co-authored-by: Samesh Lakhotia <43701530+sameshl@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants