fix(models): Update ValidatedIntEnum class to properly serialize with…#25
Merged
heliocastro merged 1 commit intomainfrom Mar 18, 2026
Merged
fix(models): Update ValidatedIntEnum class to properly serialize with…#25heliocastro merged 1 commit intomainfrom
heliocastro merged 1 commit intomainfrom
Conversation
… strings Signed-off-by: Helio Chissini de Castro <helio.chissini.de.castro@cariad.technology>
There was a problem hiding this comment.
Pull request overview
This PR updates the ValidatedIntEnum Pydantic integration so enums serialize as their string names (and expose a string-enum JSON schema), adds focused tests for the new behavior, and bumps project / tooling versions accordingly.
Changes:
- Update
ValidatedIntEnumcore schema to serialize enums asnameand emit a stringenumJSON schema. - Add new tests and repo-config fixtures to validate enum behavior and YAML config validation (including known-invalid fixtures).
- Bump
python-ortversion to0.8.5and updatetydependency to>=0.0.23; adjust SPDX header contact details in tests.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/ort/utils/validated_enum.py |
Implements string-based serialization + JSON schema customization for ValidatedIntEnum. |
tests/test_validated_int_enum.py |
New test coverage for parsing, serialization, round-trips, and schema generation. |
tests/test_repo_config_license_choices.py |
New tests ensuring license_choices.yml validates and bad_license_choices.yml fails. |
tests/test_repo_config_files.py |
Treats additional YAML fixtures as known-invalid and asserts they fail validation. |
tests/data/repo_config/license_choices.yml |
New valid repo-config fixture for license choices. |
tests/data/repo_config/bad_license_choices.yml |
New invalid repo-config fixture (wrong field name) to assert validation fails. |
pyproject.toml |
Version bump + dev dependency update (ty>=0.0.23). |
uv.lock |
Lockfile updates reflecting version bump and updated ty package. |
tests/test_vulnerability_reference.py |
SPDX header contact update. |
tests/test_scan_result.py |
SPDX header contact update. |
tests/test_repository_configuration.py |
SPDX header contact update. |
tests/test_repository_analyzer_config.py |
SPDX header contact update. |
tests/test_repo_config_curations.py |
SPDX header contact update. |
tests/test_package_curation.py |
SPDX header contact update. |
tests/test_package_configuration.py |
SPDX header contact update. |
tests/test_evaluator_run.py |
SPDX header contact update. |
tests/test_cvss_ratings.py |
SPDX header contact update. |
tests/test_advisor_result.py |
SPDX header contact update. |
tests/test_advisor_details.py |
SPDX header contact update. |
tests/test_advisor_capability.py |
SPDX header contact update. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+36
to
+38
| return core_schema.no_info_wrap_validator_function( | ||
| lambda value, handler: validate(value), | ||
| core_schema.str_schema(), |
Comment on lines
+45
to
+48
| lambda _schema, handler: { | ||
| "type": "string", | ||
| "enum": enum_names, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… strings