A secure API gateway service for the European Digital Identity Wallet ecosystem.
To run application locally, se docker-compose/README.md
The JaCoCo tool is configured in this project with the jacoco-maven-plugin in pom.xml. When running mvn test
JaCoCo will automatically measure how many lines of the code which are executed during automated tests and produce
a code coverage report.
The tool generates report output content in ./target/site/jacoco/. For human reading, the most suitable format is
HTML. To view the report, open the generated ./target/site/jacoco/index.html in your web browser.
Additional output for machine reading is created in CSV and XML format. The tool will also create a coverage report in
binary format target/jacoco.exec. Obviously we can’t interpret the output single-handedly, but other tools and plugins
can, e.g. SonarQube.
JaCoCo Maven plugin documentation
This microservice honors the API-First strategy based on OpenAPI specification yaml file(s):
/src/main/resources/static/wallet-client-gateway-openapi-{version}.yaml
API classes for Spring are automatically generated by the openapi-generator-maven-plugin
based on the OpenAPI specification yaml.
With mvn generate-sources or mvn compile, java code classes (interfaces and models) are created
in the target folder. The generated code is owned entirely by the API specification and must not be
commited to the git repository. To implement and import generated
java classes in the controller implementation just refer to the package and class name of the
generated classes.
NOTE: The target directory with generated classes must be included in the class path. This is handled by the
build-helper-maven-plugin.
Target directory for generated sources (java classes):
/target/generated-sources/openapi/src/main/java
The plugins used with the openapi-generator along with configuration is defined in pom.xml.
The API should be compliant with the REST API-profile on an acceptable level. To highlight any compliancy issues, the OpenAPI specification should be evaluated regularly with the linting tool RAP-LP rest-api-profile-lint-processor.
Start the linter by running the command:
just lint-openapi
This will trigger the openapi-linter.sh stand-alone script, which runs the linter tool as a podman container.
OpenAPI specification yaml files *openapi*.yaml in /src/main/resources/static will be fetched by the script
and evaluated accordingly.
The linter tool will generate output report files in the target directory /target/raplp which is mounted
as a shared folder with the podman container.
The script utilizes the yq command line tool mikefarah/yq - GitHub.
Please make sure you have it installed in your environment. It comes by default when installing the
devbase-core package.
Report output file name pattern:
/target/raplp/{openapi-filename}-{api-version}-{timestamp}.{extension}
File output:
| Description | Extension |
|---|---|
| Status report summary. Copy of the console output. | txt |
| Validation rule log details in json format. | log |
| Status report Excel file. | xlsx |
A copy of the OpenAPI specification file will also appear in the target directory.
When making changes to the API-specification, backward compatibility is crucial and must be ensured.
Important! If breaking the API backwards compatibility, a new major version of th API-specification must be implemented.
This project utilizes the tool openapi-diff configured as a
maven plugin. On mvn test the API-specification in the project (newSpec) is compared with the current
(oldSpec) preferably from production/sandbox. An error will be thrown if the backwards compatibility
is broken.
Configuration parameters with the openapi-diff-maven plugin in pom.xml:
| Configuration parameter | Description |
|---|---|
| oldSpec | Path to the reference API-specification (production/sandbox). |
| newSpec | Path to the project API-specification. |
| failOnIncompatible | true = fail only if API changes broke backward compatibility. |
| failOnChanged | true = fail if API changed but is backward compatible. Should preferably be set to false. |
| consoleOutputFileName | File path for console output. |
| jsonOutputFileName | File path for json output. |
| markdownOutputFileName | File path for markdown output. |
Any detected changes will be presented in the configured output files.
Please read our Contributing Guidelines and Code of Conduct before submitting any contributions.
See the LICENSE file for details.
For questions or support, please refer to our Security Policy or open an issue in this repository.