-
Notifications
You must be signed in to change notification settings - Fork 3
Add changelog casting optionals to str according to schema #52
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
base: main
Are you sure you want to change the base?
Conversation
nvdaes
commented
Oct 13, 2025
- Add changelog
- Add changelog to json schema
- Address code review
- Update _validate/addonVersion_schema.json
- Apply suggestions from code review
- Address review
- Address review
- Assign None to changelog when appropriate
- Pre-commit auto-fix
- Fix
- Fix
- Remove unassigned addonData
- Fix test
- Fix error message
- harmonize test for changelog with homepage
- Fix test
- Remove function
- Commend python preference to test locally
- Lint fixes
- Add translated changelog optional and fix linting errors by casting to str
- Fix pyproject
- Add ignore type comments
- Add ignore type comment
- Address review
- Address review
- Remove accidentally committed files
- Try to ensure that homepage and changelog are str or None
- Address feedback
- Apply suggestions from code review
- Apply suggestions from code review
- Apply suggestions from code review
- Update _validate/createJson.py
- Apply review suggestions
- Update createJson casting fields to str according to schema
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Sean Budd <[email protected]>
@seanbudd , I'll test with this. I think we should cast optionals to str according to json schema to create the json file, since a string is expected, not None. |
…t would be str, according to json schema
@nvdaes - please keep this as None and avoiding casting to strings as requested in #48 (comment) We should be able to handle None values safely |
Sean wrote:
I've added the null type to some properties. I wonder if we should make the description optional, and in this case, if it should be a required field in the json schema and translations. I'll wait for your feedback before moving forward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds changelog support to the addon validation system, allowing add-ons to include changelog information that gets validated and processed similarly to existing fields like homepage and description.
Key changes:
- Added changelog field validation to ensure manifest and submission data match
- Updated JSON schema to support optional changelog fields for both main and translated content
- Enhanced data structures and processing to handle changelog as an optional string field
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/test_validate.py |
Added test class for changelog validation and updated SHA hash for test data |
tests/test_createJson.py |
Added changelog field to test data generation |
tests/testData/manifest.ini |
Added sample changelog content to test manifest |
tests/testData/addons/fake/13.0.0.json |
Added changelog field to test JSON and updated SHA hash |
pyproject.toml |
Removed python-preference configuration |
_validate/validate.py |
Added checkChangelogMatches function and integrated it into validation pipeline |
_validate/regenerateTranslations.py |
Added changelog handling for translation regeneration |
_validate/createJson.py |
Enhanced AddonData class and processing to support optional changelog field |
_validate/addonVersion_schema.json |
Updated JSON schema to include changelog fields with null type support |
_validate/addonManifest.py |
Added changelog field to manifest specification and translation handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
changelog = None | ||
if changelog != submission.get("changelog"): | ||
yield ( | ||
f"Submission 'changelog' must be set to '{manifest.get('changelog')}' " # type: ignore[reportUnknownMemberType] |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message uses manifest.get('changelog')
which could return the string 'None' instead of the processed changelog
variable that handles this case. Use the processed changelog
variable for consistency.
f"Submission 'changelog' must be set to '{manifest.get('changelog')}' " # type: ignore[reportUnknownMemberType] | |
f"Submission 'changelog' must be set to '{changelog}' " |
Copilot uses AI. Check for mistakes.
"language": langCode, | ||
"displayName": manifest["summary"], | ||
"description": manifest["description"], | ||
"changelog": cast(str, translatedChangelog), |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Casting translatedChangelog
to str
when it can be None
will cause a runtime error. The cast should be cast(str | None, translatedChangelog)
or the None case should be handled separately.
"changelog": cast(str, translatedChangelog), | |
"changelog": cast(str | None, translatedChangelog), |
Copilot uses AI. Check for mistakes.