Skip to content
Snippets Groups Projects
Commit 433f6feb authored by Matt Parker's avatar Matt Parker
Browse files

Merge branch 'CW-5189' into 'dev'

Update datamodel-codegen variables for results_schema [CW-5189]

See merge request epi2melabs/workflows/wf-template!238
parents 99817a7f 5a025bbf
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ repos:
- epi2melabs==0.0.57
- id: build_models
name: build_models
entry: datamodel-codegen --strict-nullable --base-class workflow_glue.results_schema_helpers.BaseModel --use-schema-description --disable-timestamp --input results_schema.yml --input-file-type openapi --output bin/workflow_glue/results_schema.py
entry: datamodel-codegen --strict-nullable --base-class workflow_glue.results_schema_helpers.BaseModel --use-subclass-enum --use-schema-description --disable-timestamp --input results_schema.yml --input-file-type openapi --output bin/workflow_glue/results_schema.py
language: python
files: 'results_schema.yml'
pass_filenames: false
......
......@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v5.3.1]
### Changed
- Datamodel-codegen now uses subclasses in Enum classes.
## [v5.3.0]
### Fixed
- Collections of sorted XAM files eligible for merge will no longer be needlessly re-sorted before merge.
......
......@@ -11,7 +11,7 @@ from pydantic import Field
from workflow_glue.results_schema_helpers import BaseModel
class SampleType(Enum):
class SampleType(str, Enum):
"""
The type of the sample
"""
......
"""Test the results_schema and results_schema_helper scripts."""
import workflow_glue.results_schema as wf
def test_enum_comparisons():
"""Test enum comparison."""
dummy = wf.Sample(
alias="dummy",
barcode="barcode01",
sample_type=wf.SampleType.test_sample,
sample_pass=True,
sample_checks=[],
results={}
)
# Correct model comparison
assert dummy.sample_type == wf.SampleType.test_sample
# Old method still valid
assert dummy.sample_type == wf.SampleType.test_sample.value
# String comparisons still work but not advised
assert dummy.sample_type == "test_sample"
......@@ -57,7 +57,7 @@ manifest {
description = 'Template workflow'
mainScript = 'main.nf'
nextflowVersion = '>=23.04.2'
version = 'v5.3.0'
version = 'v5.3.1'
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment