Skip to content

Command maint-validate-metadata: correct missing 'itemtype' entry in item metadata#2242

Merged
RogerHaase merged 2 commits intomoinwiki:masterfrom
roland-ruedenauer:fix-issue-2228
Apr 17, 2026
Merged

Command maint-validate-metadata: correct missing 'itemtype' entry in item metadata#2242
RogerHaase merged 2 commits intomoinwiki:masterfrom
roland-ruedenauer:fix-issue-2228

Conversation

@roland-ruedenauer
Copy link
Copy Markdown
Contributor

@roland-ruedenauer roland-ruedenauer commented Apr 15, 2026

(.venv) [roland@reckoner moin-test]$ moin maint-validate-metadata -b userprofiles -v -f
 * Tip: There are .env files present. Install python-dotenv to use them.
itemtype_error name: userprofiles/roland item: 8411d4c17c0a405fae0d7253cd2e15ad rev_number: 1 rev_id: e8190c02cb2a4b149c08fc9e061f3bfb: missing itemtype (userprofile)
1 items with invalid metadata found and fixed

Fixes issue #2228

@RogerHaase
Copy link
Copy Markdown
Member

I created an account, edited the meta file removing "itemtype": "userprofile", ran "moin maint-validate-metadata" > 0 items with invalid metadata found

ran pip install python-dotenv

ran "moin maint-validate-metadata" > 0 items with invalid metadata found

Expected the meta file to be corrected.

Use of "parent_id: str | None = None" seems odd

@roland-ruedenauer
Copy link
Copy Markdown
Contributor Author

roland-ruedenauer commented Apr 17, 2026

Can you please try again providing the verbose flag ( "-v" ) ?

Installation of python-dotenv is not required at all. The message showed up because I have a .env file used by VSCode in my root moin directory.

@RogerHaase
Copy link
Copy Markdown
Member

(.venv) C:\Clones\Roland-ruedenauer\moin>moin maint-validate-metadata -v
2026-04-17 09:17:23,397 WARNING moin.cli._util:28 no backends specified
0 items with invalid metadata found

@roland-ruedenauer
Copy link
Copy Markdown
Contributor Author

A backend must be specified, e.g. userprofiles

moin maint-validate-metadata -b userprofiles -v

or all backends

moin maint-validate-metadata -a -v

@roland-ruedenauer
Copy link
Copy Markdown
Contributor Author

Use of "parent_id: str | None = None" seems odd

This just corrects a type hinting error: you can't specify a field to have type str and set a default value of None.

And a value None for parent_id might indicate either the first revision of an item or an error in moin filling the field correctly. Why do you think it looks odd?

@RogerHaase
Copy link
Copy Markdown
Member

Ah - user error. Thanks

@RogerHaase RogerHaase merged commit 5a851f8 into moinwiki:master Apr 17, 2026
10 checks passed
@roland-ruedenauer roland-ruedenauer deleted the fix-issue-2228 branch April 17, 2026 19:09
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