Skip to content

Commit

Permalink
EUREKA-240: adjust readme (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
yauhen-vavilkin authored Aug 19, 2024
1 parent 5b80713 commit 8419d8d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ It checks the module descriptor template placed in FOLIO modules for issues and
- [Usage](#usage)
- [Non-project usage](#non-project-usage)
- [Validation rules](#validation-rules)
- [Helpful scripts](#helpful-scripts)

## Features
- Validation: Automatically checks module descriptor for common issues and ensures it adheres to FOLIO standards.
Expand Down Expand Up @@ -53,7 +54,7 @@ To disable the fail-fast mode or add custom path to module descriptor file, add
</execution>
</executions>
<configuration>
<failOnInvalidJson>false</failOnInvalidJson>
<failOnInvalidDescriptor>false</failOnInvalidDescriptor>
<moduleDescriptorFile>${project.basedir}/path/to/module-descriptor.json</moduleDescriptorFile>
</configuration>
</plugin>
Expand All @@ -71,4 +72,5 @@ The plugin checks the module descriptor for the following issues:
- Endpoint required permissions: `permissionsRequired` array should contain no more than one permission. Also `permissionsRequired` shouldn't contain permission set.
- Permission definition: Checks if the permission is defined in the `permissionSets` section.


## Helpful scripts
- [module descriptor batch validator](scripts/module-descriptor-batch-validator/README.md)
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<maven-plugin-api.version>3.9.6</maven-plugin-api.version>
<maven-plugin-tools.version>3.11.0</maven-plugin-tools.version>
<jackson-databind.version>2.17.0</jackson-databind.version>
<folio-permission-utils.version>1.5.5-SNAPSHOT</folio-permission-utils.version>
<folio-permission-utils.version>1.5.5</folio-permission-utils.version>

<junit-jupiter.version>5.10.2</junit-jupiter.version>
<assertj-core.version>3.25.3</assertj-core.version>
Expand All @@ -25,7 +25,7 @@
<maven-checkstyle.version>10.14.2</maven-checkstyle.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<maven-plugin.version>3.11.0</maven-plugin.version>
<maven-plugin.version>3.14.0</maven-plugin.version>

<sonar.exclusions>
src/main/java/**/model/**/*
Expand Down
11 changes: 11 additions & 0 deletions scripts/module-descriptor-batch-validator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Module Descriptor Batch Validator
This script helps to validate module descriptors for modules gathered in `install.json`.

### Usage
Place the `md-validator.sh` file next to `install.json` and run the command:
```bash
./md-validator.sh
```

### How it works
The script parses the `install.json` file, retrieves all module IDs, and downloads the module descriptors sequentially. Then, the plugin validates the module descriptors. It is based on the non-project usage feature of the plugin.
34 changes: 34 additions & 0 deletions scripts/module-descriptor-batch-validator/md-validator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

JSON_FILE="install.json"
BASE_URL="https://folio-registry.dev.folio.org/_/proxy/modules"
PLUGIN_GROUP_ID="org.folio"
PLUGIN_ARTIFACT_ID="folio-module-descriptor-validator"
PLUGIN_VERSION="0.0.1-SNAPSHOT"
PLUGIN_GOAL="validate"

ids=$(jq -r '.[].id' $JSON_FILE)

for id in $ids; do
FILE_URL="$BASE_URL/$id"
FILE_PATH="$id.json"

curl -sS -o $FILE_PATH $FILE_URL

echo -n "Validation $FILE_PATH started... "

if [ $? -eq 0 ]; then

mvn $PLUGIN_GROUP_ID:$PLUGIN_ARTIFACT_ID:$PLUGIN_VERSION:$PLUGIN_GOAL -q -DmoduleDescriptorFile=$FILE_PATH

rm -f $FILE_PATH
echo -ne "\rValidation $FILE_PATH DONE "
echo ""
else
echo "Failed to download $FILE_URL"
fi
done

rm -f $TEMP_POM

echo "All operations completed."

0 comments on commit 8419d8d

Please sign in to comment.