Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Conversation

@nvnieuwk
Copy link
Collaborator

This PR contains a fix for the YAML validation skip reported in #121 and the preparation for a patch release

@nvnieuwk nvnieuwk requested a review from mirpedrol October 23, 2023 07:50
@nvnieuwk
Copy link
Collaborator Author

Error seems to be related to the validation of YAML files that have no header. I'll try and fix this first

Copy link
Collaborator

@awgymer awgymer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that part of the issue was that no tests really checked we performed the validation. Should we add some new tests to ensure this doesn't creep in again somehow?

(I think it might just be a case of having a test that we actually intend to fail validation - that can only happen if content is actually passed)

Comment on lines +195 to +200
fileContent = new Yaml().load((samplesheetFile.text)).collect {
if(containsHeader) {
return it as Map
}
return ["empty": it] as Map
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the identical code in SamplesheetConverter:castToType still required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't in that function? The main issue here is that we need an array of Map values for the validation. This is a little hacky workaround for samplesheets that have no header

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 73 of SamplesheetConverter.groovy no?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figure if we are pre-converting here we didn't need it there? But maybe I'm not following the flow properly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the code in SamplesheetConverter.convertToList()?.
This code here is for the validation, convertToList is creating the Nextflow channel, and we don't pass fileContent or fileContentCasted to this function, they are independent. If we want to reduce code, I would rather remove the validation from fromSamplesheet(), but this is opening the discussion about where to validate a sample sheet again and out of topic so don't mind me :D

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry I mixed up castToType with convertToList!

Code deduplication was the goal, but agree it is out of scope for this PR/patch release if it's not just a case of deleting what's there

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah code deduplication should really happen at one point but not here :p

@nvnieuwk
Copy link
Collaborator Author

I think that part of the issue was that no tests really checked we performed the validation. Should we add some new tests to ensure this doesn't creep in again somehow?

(I think it might just be a case of having a test that we actually intend to fail validation - that can only happen if content is actually passed)

Good point! I'll add a failing test :)

@nvnieuwk nvnieuwk merged commit 1a6bf69 into nextflow-io:master Oct 23, 2023
@nvnieuwk nvnieuwk deleted the fix-yaml-validation branch October 23, 2023 11:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants