Skip to content

Commit

Permalink
Feature/update readme and swagger (#151)
Browse files Browse the repository at this point in the history
* swagger endpoint doc

* swagger

* trivy

* annotation controller swagger

* digital media swagger

* digital specimen swagger

* mjr swagger

* readme

* code review

* trivy
  • Loading branch information
southeo authored Nov 20, 2024
1 parent f0fe34d commit 62a0406
Show file tree
Hide file tree
Showing 41 changed files with 1,082 additions and 309 deletions.
46 changes: 18 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,31 @@ In general, the find/search APIs are open, and APIs for create, update and delet

All endpoints are based on the [JSON:API](https://jsonapi.org/) specification.
It follows the guidelines and best practices described in [BiCIKL Deliverable 1.3](https://docs.google.com/document/d/1RgngKSPabEs-Pir6vA25iFDgVorbEZe7duT7L7vQ7QI)
The organisation endpoints are an exception.

The backend provides APIs for the following objects:
- Digital Specimens
- Digital Media Objects
- Annotations
- Users
- Organisations

## Storage solutions
In general, there are three places where data is stored:
- Postgres database
The Postgres database stores the latest active version of the object.
- **Postgres database**: The Postgres database stores the latest active version of the object.
It is used in retrieving a specific object based on the id.
It can also be used to combine objects based on their relationships.

- Elasticsearch
This data storage is used for searching and aggregating.
- **Elasticsearch**: This data storage is used for searching and aggregating.
It is used for data discovery and provides endpoints for the filters and search fields.
In general, it does not return a single object, but a paginated list of objects.
Additionally, it can provide aggregations showing how many items comply to the search criteria.

- MongoDB
MongoDB is used for provenance storage and stores the historical data.
- **MongoDB**: MongoDB is used for provenance storage and stores the historical data.
This data storage is used for displaying previous versions of the data.

## API documentation
The APIs are documented through code-generated OpenAPI v3 and Swagger.
- The swagger endpoint is: https://sandbox.dissco.tech/api/swagger-ui/index.html#/
- The OpenAPI endpoint is: https://sandbox.dissco.tech/api/v3/api-docs

As we use generic objects, the API documentation is not as detailed as we would like.
We are looking at additional options for more detailed documentation.

### Digital Specimens
For Digital Specimen, we only provide search and read functionality through the APIs.
It follows a generic structure.
Expand Down Expand Up @@ -79,24 +70,10 @@ The create, update and tombstone endpoints are protected through authentication.
The actions posted to these endpoints are forwarded to the annotation processor.
This processor manages all the annotations and is the only application authorized to create or change annotations.

### User
For users, we provide a set of read, create, update and delete functionality through the APIs.
When a new user is registered it will be created in the database.
A user can update his or her information through the profile page.
The backend will then update the user information in the database.

### Organisation
The organisation endpoints provide read functionality for the organisations.
These organisations are inserted in the database and need to be updated manually.
The organisation endpoints can be used by forms.

### Organisation document
The organisation documents can be used to insert documents for a particular organisation.
These endpoints can be used to insert the result of forms.

## Run locally
To run the system locally, it can be run from an IDEA.
Clone the code and fill in the application properties (see below).
The application requires a connection to an elastic search instance and a mongodb instance.
The application needs a connection to a Postgres database, MongoDB and Elasticsearch.
For creation and modification of annotations it needs a reachable annotation processor service.

Expand All @@ -121,10 +98,23 @@ elasticsearch.port=# The port of the Elasticsearch cluster
#Oauth properties
spring.security.oauth2.resourceserver.jwt.issuer-uri=# The URI to the JWT issuer
spring.security.oauth2.authorizationserver.endpoint.jwk-set-uri=# The URI to the JWT OpenId certifications
token.secret=# Keycloak secret
token.id=# Keycloak client id
token.grant-type= # Keycloak grant type
#Kafka properties
kafka.publisher.host=# Endpoint for kafka publisher
#MongoDB properties
mongo.connection-string=# Connection string to MongoDB
mongo.database=# Database name of MongoDB
#Feign clients
feign.annotations=# Path to annotation proccessor endpoint
feign.annotations=# Path to annotation proccessor endpoint
#Endpoints
endpoint.handle-endpoint=# Endpoint to handle API
endpoint.token-endpoint=# Endpoint to keycloak authenticator
#Application Properties
application.base-url=# The url of the application (used to build JsonApiLinks objects)
23 changes: 23 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
Expand Down Expand Up @@ -249,6 +254,24 @@
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<outputFileName>openapi.yaml</outputFileName>
<outputDir>${project.build.directory}</outputDir>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down
Loading

0 comments on commit 62a0406

Please sign in to comment.