Skip to content

Commit f529e91

Browse files
authored
Merge pull request #121 from nextflow-io/2.4.0dev
Release 2.4.0
2 parents ecf159f + b8260aa commit f529e91

File tree

122 files changed

+2555
-1620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+2555
-1620
lines changed

.github/workflows/build-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
python-version: 3.x
2020
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
2121
- name: Obtain version from MANIFEST.MF
22-
run: echo "plugin_version=$(grep "Plugin-Version" plugins/nf-schema/src/resources/META-INF/MANIFEST.MF | awk '{print $2}' | awk -F '.' '{print $1"."$2}')" >> $GITHUB_ENV
22+
run: echo "plugin_version=$(grep "version = " build.gradle | sed -e 's/version = //' | cut -d "'" -f 2)" >> $GITHUB_ENV
2323
- name: Setup git user
2424
run: |
2525
git config --global user.name "${{github.actor}}"

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
java_version: [11, 17]
20+
java_version: [11, 17, 21]
2121

2222
steps:
2323
- name: Environment

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# nextflow-io/nf-schema: Changelog
22

3+
# Version 2.4.0
4+
5+
## New features
6+
7+
1. Added a new configuration option: `validation.maxErrValSize` which sets the maximum length that a value in an error message can be. The default is set to 150 characters.
8+
2. Added a new function: `validate()` that can be used to validate any data structure using a JSON schema.
9+
10+
## Bug fixes
11+
12+
1. Move the unpinned version check to an observer. This makes sure the warning is always shown and not only when importing a function.
13+
2. Added a missing inherited method to the observer to fix issues with workflow output publishing
14+
3. Fixed unexpected failures with samplesheet schemas using `anyOf`, `allOf` and `oneOf`
15+
4. Fixed an error with help messages when the `type` keyword was missing
16+
5. Fix compilation errors in Java 21
17+
18+
## Improvements
19+
20+
1. Slow uniqueness check (> 2hrs for 100k samples) made 400x faster by switching from `findAll` to a `subMap` for isolating the required unique fields.
21+
2. `patternProperties` now has greater support, with no warnings about invalid parameters which actually match a pattern
22+
3. Added better error handling and debug messages to the configuration parser.
23+
24+
## Changes
25+
26+
1. Refactored the whole codebase to make future development easier
27+
2. Bumped the minimal Nextflow version to `24.10.0`
28+
329
# Version 2.3.0 - Hakodate
430

531
## Bug fixes

Makefile

Lines changed: 12 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,23 @@
1-
2-
config ?= compileClasspath
3-
version ?= $(shell grep 'Plugin-Version' plugins/nf-schema/src/resources/META-INF/MANIFEST.MF | awk '{ print $$2 }')
4-
5-
ifdef module
6-
mm = :${module}:
7-
else
8-
mm =
9-
endif
1+
# Build the plugin
2+
assemble:
3+
./gradlew assemble
104

115
clean:
6+
rm -rf .nextflow*
7+
rm -rf work
8+
rm -rf build
129
./gradlew clean
1310

14-
compile:
15-
./gradlew compileGroovy
16-
@echo "DONE `date`"
17-
18-
19-
check:
20-
./gradlew check
21-
22-
23-
#
24-
# Show dependencies try `make deps config=runtime`, `make deps config=google`
25-
#
26-
deps:
27-
./gradlew -q ${mm}dependencies --configuration ${config}
28-
29-
deps-all:
30-
./gradlew -q dependencyInsight --configuration ${config} --dependency ${module}
31-
32-
#
33-
# Refresh SNAPSHOTs dependencies
34-
#
35-
refresh:
36-
./gradlew --refresh-dependencies
37-
3811
#
3912
# Run all tests or selected ones
4013
#
4114
test:
42-
ifndef class
43-
./gradlew ${mm}test
44-
else
45-
./gradlew ${mm}test --tests ${class}
46-
endif
47-
15+
./gradlew test
4816

17+
# Install the plugin into local nextflow plugins dir
4918
install:
50-
./gradlew copyPluginZip
51-
rm -rf ${HOME}/.nextflow/plugins/nf-schema-${version}
52-
cp -r build/plugins/nf-schema-${version} ${HOME}/.nextflow/plugins/nf-schema-${version}
53-
54-
#
55-
# Upload JAR artifacts to Maven Central
56-
#
57-
upload:
58-
./gradlew upload
59-
60-
61-
upload-plugins:
62-
./gradlew plugins:upload
19+
./gradlew install
6320

64-
publish-index:
65-
./gradlew plugins:publishIndex
21+
# Publish the plugin
22+
release:
23+
./gradlew releasePlugin

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Declare the plugin in your Nextflow pipeline configuration file:
2525

2626
```groovy title="nextflow.config"
2727
plugins {
28-
id 'nf-schema@2.2.0'
28+
id 'nf-schema@2.4.0'
2929
}
3030
```
3131

@@ -65,7 +65,7 @@ validation {
6565

6666
- Java 11 or later
6767
- <https://github.com/harrel56/json-schema>
68-
- Nextflow 23.10.0 or later
68+
- Nextflow 24.10.0 or later
6969

7070
## Slack channel
7171

build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
plugins {
2+
id 'io.nextflow.nextflow-plugin' version '0.0.1-alpha2'
3+
}
4+
5+
dependencies {
6+
implementation 'org.json:json:20240303'
7+
implementation 'dev.harrel:json-schema:1.5.0'
8+
implementation 'com.sanctionco.jmail:jmail:1.6.3' // Needed for e-mail format validation
9+
}
10+
11+
version = '2.4.0'
12+
13+
nextflowPlugin {
14+
nextflowVersion = '24.10.0'
15+
16+
provider = 'nextflow'
17+
className = 'nextflow.validation.ValidationPlugin'
18+
extensionPoints = [
19+
'nextflow.validation.ValidationExtension',
20+
'nextflow.validation.ValidationObserverFactory'
21+
]
22+
23+
publishing {
24+
github {
25+
repository = 'nextflow-io/nf-schema'
26+
userName = project.findProperty('github_username')
27+
authToken = project.findProperty('github_access_token')
28+
email = project.findProperty('github_commit_email')
29+
30+
indexUrl = 'https://github.com/nextflow-io/plugins/blob/main/plugins.json'
31+
}
32+
}
33+
}

buildSrc/src/main/groovy/io.nextflow.groovy-common-conventions.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repositories {
1414

1515
java {
1616
toolchain {
17-
languageVersion = JavaLanguageVersion.of(19)
17+
languageVersion = JavaLanguageVersion.of(21)
1818
}
1919
}
2020

docs/configuration/configuration.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,22 @@ This option does exactly the same as `validation.ignoreParams`, but provides pip
9595
validation.defaultIgnoreParams = ["param1", "param2"] // default: []
9696
```
9797

98+
## maxErrValSize
99+
100+
Configure the maximum characters of a value that may be shown in an error message. It takes a whole number above or equal to `1`. A value will be truncated when it goes over the maximum amount of characters.
101+
102+
Setting this option to `-1` will allow any amount of characters for values.
103+
104+
See the below example where the limit is to 20 characters:
105+
106+
```
107+
* --test (abcdefghij...qrstuvwxyz): Value is [string] but should be [integer]
108+
```
109+
110+
```groovy
111+
validation.maxErrValSize = 100 // default: 150
112+
```
113+
98114
## help
99115

100116
The `validation.help` config scope can be used to configure the creation of the help message.

docs/contributing/setup.md

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ description: How to contribute to nf-schema
55

66
# Getting started with plugin development
77

8-
## Compiling
8+
## Tests
99

10-
To compile and run the tests use the following command:
10+
To run the tests use the following command:
1111

1212
```bash
13-
./gradlew check
13+
make test
1414
```
1515

16-
## Launch it with installed Nextflow
16+
## Install and use in pipelines
1717

1818
!!! warning
1919

@@ -39,33 +39,6 @@ plugins {
3939
}
4040
```
4141

42-
## Launch it with a local version of Nextflow
43-
44-
- Clone the Nextflow repo into a sibling directory
45-
46-
```bash
47-
cd .. && git clone https://github.com/nextflow-io/nextflow
48-
cd nextflow && ./gradlew exportClasspath
49-
```
50-
51-
- Append to the `settings.gradle` in this project the following line:
52-
53-
```bash
54-
includeBuild('../nextflow')
55-
```
56-
57-
- Compile the plugin code
58-
59-
```bash
60-
./gradlew compileGroovy
61-
```
62-
63-
- Run nextflow with this command:
64-
65-
```bash
66-
./launch.sh run -plugins nf-schema <script/pipeline name> [pipeline params]
67-
```
68-
6942
## Change and preview the docs
7043

7144
The docs are generated using [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/).
@@ -82,3 +55,20 @@ mkdocs serve
8255
```
8356

8457
To preview the docs, open the URL provided by mkdocs in your browser.
58+
59+
## Release and publish the plugin
60+
61+
1. In `build.gradle` make sure that:
62+
- `version` matches the desired release version,
63+
- `github.repository` matches the repository of the plugin,
64+
- `github.indexUrl` points to your fork of the plugins index repository.
65+
2. Create a file named `$HOME/.gradle/gradle.properties`, where `$HOME` is your home directory. Add the following properties:
66+
- `github_username`: The GitHub username granting access to the plugin repository.
67+
- `github_access_token`: The GitHub access token required to upload and commit changes to the plugin repository.
68+
- `github_commit_email`: The email address associated with your GitHub account.
69+
3. Update the [changelog](./CHANGELOG.md).
70+
4. Build and publish the plugin to your GitHub repository:
71+
```bash
72+
make release
73+
```
74+
5. Create a pull request against the [nextflow-io/plugins](https://github.com/nextflow-io/plugins/blob/main/plugins.json) repository to make the plugin publicly accessible.

docs/validate/validate.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Validate common data structures
3+
description: Function to validate common data structures
4+
---
5+
6+
# Validate common data structures
7+
8+
The `validate` function can be used to validate common data structures.
9+
10+
```groovy
11+
include { validate } from 'plugin/nf-schema'
12+
13+
validate(<input>, <schema>)
14+
```
15+
16+
This function takes two positional arguments:
17+
18+
1. The data that needs to be validated
19+
2. The path to the schema used to validate the input data
20+
21+
The tested data structures are listed below, however more data structures might by supported too:
22+
23+
- Maps
24+
- Lists
25+
- String
26+
- Integers
27+
- Booleans
28+
29+
`validate` also has the following optional arguments:
30+
31+
- `exitOnError`: Exit the pipeline on validation failure and show the error message. The function will output the errors when this option is set to `false` (default: `true`)
32+
- `validate(<input>, <schema>, exitOnError:true|false)`

0 commit comments

Comments
 (0)