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

Pattern validation not working when using scheme without header #10

Closed
drpatelh opened this issue Jan 17, 2024 · 5 comments
Closed

Pattern validation not working when using scheme without header #10

drpatelh opened this issue Jan 17, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@drpatelh
Copy link
Contributor

Inspired by nf-core/fetchngs, if I have a schema spec for a samplesheet that doesn't have a header:

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://raw.githubusercontent.com/nf-core/fetchngs/master/assets/schema_input.json",
    "title": "nf-core/fetchngs pipeline - params.input schema",
    "description": "Schema for the file provided with params.input",
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "": {
                "type": "string",
                "pattern": "^(((SR|ER|DR)[APRSX])|(SAM(N|EA|D))|(PRJ(NA|EB|DB))|(GS[EM])|(syn))(\\d+)$",
                "errorMessage": "Please provide a valid SRA, ENA, DDBJ or GEO identifier"
            }
        }
    }
}

And try and use a samplesheet like this:

SRR9984183
asdasd

The validation should fail the pattern match for asdasd but doesn't. If I add a dummy header to the spec and the samplesheet it works.

@nvnieuwk
Copy link
Collaborator

Hi @drpatelh This seems to be an issue with the validation library. I'm hoping this will be fixed once we swapped the validation library

@drpatelh
Copy link
Contributor Author

Ah, thanks for the update! Created nf-core/fetchngs#254 so we don't lose track of this issue.

@nvnieuwk
Copy link
Collaborator

Hi updating your schema to this in the new version should hopefully fix your issues:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://raw.githubusercontent.com/nf-core/fetchngs/master/assets/schema_input.json",
    "title": "nf-core/fetchngs pipeline - params.input schema",
    "description": "Schema for the file provided with params.input",
    "type": "array",
    "items": {
        "type": "string",
        "pattern": "^(((SR|ER|DR)[APRSX])|(SAM(N|EA|D))|(PRJ(NA|EB|DB))|(GS[EM])|(syn))(\\d+)$",
        "errorMessage": "Please provide a valid SRA, ENA, DDBJ or GEO identifier"
    }
}

@nvnieuwk nvnieuwk transferred this issue from nextflow-io/nf-validation Apr 23, 2024
@nvnieuwk
Copy link
Collaborator

@drpatelh can you try this again using nf-schema?

@nvnieuwk nvnieuwk added the bug Something isn't working label Apr 23, 2024
@nvnieuwk
Copy link
Collaborator

Support for headerless samplesheets has been properly implemented in nf-schema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants