Skip to content

Enable Version-Based File Type Validation for Analysis Submission #866

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

Merged
merged 4 commits into from
Oct 15, 2024

Conversation

Azher2Ali
Copy link
Contributor

@Azher2Ali Azher2Ali commented Oct 2, 2024

This PR implements changes to support file type validation based on the analysis version provided during submission. Key updates include:

File Type Validation by Version:

  • When submitting an analysis, the file types will now be validated according to the version specified in the payload.

  • If no version is specified, the latest version is used by default.

Handling File Types Across Versions:

  • If no file types are provided for a particular version, the system retrieves file types from previous versions.

  • If it is the first version and no file types are specified, all file types are allowed (null value or empty array).

  • If file types are explicitly provided, those will be used regardless of the version.

  • An empty fileTypes array is treated the same as a null value, meaning all file types are allowed.

Repository Changes:
In AnalysisSchemaRepository, updated method signatures:

  • Changed findByName to findAllByName to fetch all schemas for a name.

Validation Logic:

Updated in ValidationService to fetch and validate file types from the correct version:

  • if no options.fileType is provided, it looks for the latest schema version and re-use the file types
  • if aoptions.fileTypeis an empty array, set no value for file types, indicates any file type is allowed
  • if a options.fileType is an array with values, set this as the value for file types

These changes ensure that the file types are consistently validated based on the correct version, improving flexibility for versioned analysis types.

@Azher2Ali Azher2Ali changed the title Validation of custom schema against the version Enable Version-Based File Type Validation for Analysis Submission Oct 2, 2024
@Azher2Ali Azher2Ali requested review from joneubank and leoraba October 2, 2024 20:13
@Azher2Ali Azher2Ali requested a review from joneubank October 4, 2024 20:34
Copy link
Contributor

@joneubank joneubank left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@Azher2Ali Azher2Ali merged commit 434ddf2 into develop Oct 15, 2024
2 checks passed
@Azher2Ali Azher2Ali deleted the feature/schema_version_fix branch October 15, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants