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

Expansion of JSONLD and parsing of API DOC #42

Merged
merged 9 commits into from
Aug 2, 2020

Conversation

priyanshunayan
Copy link
Member

Related #38, #37

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 expands the JSONLD to extract the required properties to make HydraDoc. This is more robust solution while parsing external APIDOCs.

Change logs

  • Added hydra namespace
  • Expanded jsonld

@chrizandr
Copy link
Member

@priyanshunayan Is this ready for review?

@priyanshunayan priyanshunayan marked this pull request as ready for review July 27, 2020 14:48
@priyanshunayan priyanshunayan changed the title [WIP] expand jsonld and use hydra namespace Expansion of JSONLD and parsing of API DOC Jul 27, 2020
@priyanshunayan
Copy link
Member Author

Please review #45 first before reviewing this one. After #45 is merged, this PR needs to be rebased in order to work properly.

hydra_python_core/doc_maker.py Outdated Show resolved Hide resolved
for title in item[hydra['title']]:
_title = title['@value']
if hydra['description'] in item:
for description in item[hydra['description']]:
Copy link
Member

Choose a reason for hiding this comment

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

Why are there for loops here? The root dictionary will have only one key with hydra:description right? Is this a limitation of pyld?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not the limitation of pyld. The expansion algorithm itself returns everything as list. Hence, have to loop even though there is one element in the list.

tests/test_doc_maker.py Show resolved Hide resolved
tests/test_doc_maker.py Show resolved Hide resolved
tests/test_doc_maker.py Show resolved Hide resolved
@chrizandr
Copy link
Member

Please rebase so we can merge

@chrizandr chrizandr merged commit 15d55f2 into HTTP-APIs:develop Aug 2, 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