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

Improve Docs #264

Merged
merged 49 commits into from
Dec 3, 2020
Merged

Improve Docs #264

merged 49 commits into from
Dec 3, 2020

Conversation

tobiasschweizer
Copy link
Contributor

@tobiasschweizer tobiasschweizer commented Nov 25, 2020

resolves DSP-1050

This PR reorganises the docs:

  • README.md (project root): brief introduction to DSP-JS-LIB and shows how to use it
  • contribution.md: information for developers
  • design-documentation.md: design and architecture
  • test-framework/README.md: how to run the test Angular app and how to run E2E test

The API docs have been improved and can be generated locally by running npm run builddocs.
This PR adds the @category tag to classes, interfaces, and namespaces so that the API docs are organised by different sections:

  • "Config"
  • "Response"
  • "Endpoint Admin"
  • "Endpoint V2"
  • "Endpoint System"
  • "Model Admin"
  • "Model V2"
  • "Model System"
  • "Internal"

It would be nice to exclude the "Internal" category for the published API docs. I requested this feature.

@tobiasschweizer tobiasschweizer added the documentation Add or update doc files label Nov 25, 2020
@tobiasschweizer tobiasschweizer self-assigned this Nov 25, 2020
@tobiasschweizer tobiasschweizer changed the title Improved Docs Improve Docs Nov 30, 2020
@tobiasschweizer
Copy link
Contributor Author

Also not sure if this is anywhere mentioned, to run e2e tests in test-framework, DSP-API needs to be restarted every time before with volume deletion. Is this correct?

In test-framework/README.md, I added the sentence:

Make sure that DSP-API's database is in its initial state. Reload the data if necessary.

I think the details how to do this should be covered by the DSP-API docs. I usually delete all the volumes. I believe there is a problem with stopping the db container.

Copy link
Collaborator

@mpro7 mpro7 left a comment

Choose a reason for hiding this comment

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

So what are we doing with links? Is it better to link at all or do not link to do not mess up with versions? I would link - here is why.

README.md Show resolved Hide resolved
README.md Outdated
For the public API, see <https://dasch-swiss.github.io/dsp-js-lib>.
For design documentation, see file `design-documentation.md`.
## Developing DSP-JS-LIB
See `contribution.md`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

That was my point of every comment suggesting the link. Linking makes life way easier. One just can click to open in external tab and keep read the docs.

contribution.md Show resolved Hide resolved
contribution.md Show resolved Hide resolved
test-framework/README.md Show resolved Hide resolved
@tobiasschweizer
Copy link
Contributor Author

So what are we doing with links? Is it better to link at all or do not link to do not mess up with versions? I would link - here is why.

Could we try to find a general solution for this? Other repos will need that too and it should be handled in a consistent manner so all fits together in the end. How about tomorrow after the meeting?

@mpro7 mpro7 self-requested a review December 2, 2020 13:32
Copy link
Collaborator

@mpro7 mpro7 left a comment

Choose a reason for hiding this comment

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

From my side it looks ok now. So we can move the links topic to another task, talking about it first, like suggested.

@tobiasschweizer
Copy link
Contributor Author

From my side it looks ok now. So we can move the links topic to another task, talking about it first, like suggested.

Shall I schedule a meeting for tomorrow?

Copy link
Collaborator

@mdelez mdelez left a comment

Choose a reason for hiding this comment

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

Making our docs great again!

README.md Outdated

Below you may find a minimal example in TypeScript for the process of the user login.
Make sure that `rxjs` is installed in the required major version 6 with the framework you are using, e.g. Angular.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Make sure that your version of 'rxjs' is major version 6 with..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 12cd1f1

README.md Outdated

We recommend to install this library through NPM. This will make sure that all dependencies are installed.
At the moment, this library depends on `rxjs`, `json2typescript`, and `jsonld`.
Consult the API docs for more details about the available endpoints..
Copy link
Collaborator

Choose a reason for hiding this comment

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

You have two periods here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 12cd1f1

README.md Outdated
console.log(res);
},
(error) => {
// for some reason, the request failed
Copy link
Collaborator

Choose a reason for hiding this comment

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

"if, for some reason, the request failed"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 12cd1f1

contribution.md Outdated

## Introduction

The purpose of this library is facilitating the use of [DSP-API (Knora)](https://www.knora.org) in web client development.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"The purpose of this library is to facilitate the use of..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 8a12b84

contribution.md Outdated

1. `npm run peer-deps`: Installs the project's peer dependencies. Peer dependencies are not installed with `npm install`, but have to be met before building or running the tests.
1. `npm run test`: Runs the library's tests defined in `./karma.conf.js`.
1. `npm run prepare-dev-publication`: prepares a dev version of the library **before** building it. The dev version contains code to create mocked data to be used in unit test of projects using DSP-JS-LIB.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"unit test" should be plural

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 8a12b84


DSP-API System endpoints inform about DSP-API's status.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not exactly sure what this is trying to say, perhaps "DSP-API System endpoints provide information about DSP-API's status."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in cc70b8e


The Knora Admin API is used to administrate projects in Knora. This also includes management of users and groups as well as permissions.
The Knora API relies on JSON as an exchange format.
The `HealthEndpointSystem` returns DSP-API's health status including information about the is version.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"about the version"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in cc70b8e


`ResourcesConversionUtil` handles the conversion of one or several resources serialized as JSON-LD to an array of `ReadResource`.
`ResourcesConversionUtil` creates an array of `ReadResource` from JSON-LD representing resource instances,
automatically adding ontology information such as resource class labels and labels from list nodes that are referred to from list values.
It does so by using `OntologyCache` and `ListNodeCache`, minimizing the requests to the Knora API to obtain the necessary information.
It does so by using `OntologyCache` and `ListNodeCache`, minimizing the requests to DSP-API to obtain the necessary information.

`ResourcesConversionUtil.createReadResourceSequence` is a public method that takes JSON-LD representing zero, one or more resources and returns an array of `ReadResource`. For each resource serialized as JSON-LD, `ResourcesConversionUtil.createReadResource` is called to do the conversion to a `ReadResource`. As a first step, `ResourcesConversionUtil.createReadResource` determines the resource's type (its class). Then, the definition for this class is requested from `OntologyCache`. The class definition contains information such as the class's label, cardinalities for properties and the definitions of those properties. The cardinalities are required to distinguish between system properties and properties that are defined in a project ontology. Each property value serialized as JSON-LD is converted to a `ReadValue` if there exists a cardinality for it for the resource class at hand.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"zero, one, or more" - the additional comma makes it easier to comprehend

the sentence at the end
"Each property value serialized as JSON-LD is converted to a ReadValue if a cardinality for it exists for the resource class at hand."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in cc70b8e


### Generic Cache

`GenericCache` is an abstract and generic class. The generic type is the type of object that is going to be cached, e.g., an `ReadOntology`. The key is the IRI of the object that is cached. `GenericCache` ensures that a specific element is only requested once from Knora also if several asynchronous for the same element are performed. `GenericCache` also resolves dependencies of an element that is being requested, but in a non blocking ay, i.e. the requested element is returned immediately it is ready while the dependencies are still being resolved.
`GenericCache` is an abstract and generic class. The generic type is the type of object that is going to be cached, e.g., an `ReadOntology`. The key is the IRI of the object that is cached. `GenericCache` ensures that a specific element is only requested once from DSP-API also if several asynchronous for the same element are performed. `GenericCache` also resolves dependencies of an element that is being requested, but in a non blocking ay, i.e. the requested element is returned immediately it is ready while the dependencies are still being resolved.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"GenericCache ensures that a specific element is only requested once from DSP-API if several asynchronous for the same element are performed." - remove "also"

"but in a non-blocking way, i.e. the requested element is returned immediately when it is ready while the dependencies are still being resolved."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in cc70b8e


Then, open the root directory of the library in the terminal and run
Then switch to the directory `./test-framework`.
From this directory, run the follwoing scripts:
Copy link
Collaborator

Choose a reason for hiding this comment

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

following

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in cc70b8e

@tobiasschweizer
Copy link
Contributor Author

after discussion with @kilchenmann and @mpro7: I will add links to the Markdown files and add a section in the README saying that these links always point to the latest version of the file, not necessarily the version / release the user is currently using.

@tobiasschweizer
Copy link
Contributor Author

@tobiasschweizer
Copy link
Contributor Author

I checked https://www.npmjs.com/package/rxjs and I figured that relative links are rewritten so they point to the location on GitHub.

@tobiasschweizer
Copy link
Contributor Author

@mpro7 I added the @category tag to the metadata endpoint. Once the whole implementation of the metadata endpoint is done, we should categorise all classes correctly. I did not do it yet because this would create merge conflicts.

Copy link
Collaborator

@mdelez mdelez left a comment

Choose a reason for hiding this comment

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

Very nice :)

@tobiasschweizer tobiasschweizer merged commit 95c57c3 into main Dec 3, 2020
@tobiasschweizer tobiasschweizer deleted the wip/dsp-1050-docs branch December 3, 2020 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Add or update doc files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants