Skip to content

Conversation

@ax3l
Copy link
Contributor

@ax3l ax3l commented Jan 12, 2026

Quick vibe code to close #6

Quick vibe code to close vsoch#6
@ax3l ax3l force-pushed the custom-extra-prop branch from 129398e to 2852d54 Compare January 12, 2026 20:09
@ax3l ax3l mentioned this pull request Jan 12, 2026
@ax3l
Copy link
Contributor Author

ax3l commented Jan 13, 2026

Testing in openPMD/openPMD-api#1826

Copy link
Owner

@vsoch vsoch left a comment

Choose a reason for hiding this comment

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

Thank you! Some questions and comments.

# Use empty schema {} which allows any type
for prop in allowed_props:
if prop not in schema['properties']:
schema['properties'][prop] = {}
Copy link
Owner

Choose a reason for hiding this comment

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

What happens if the property is nested? And where is the full definition of the property?

allowed_props = [prop.strip() for prop in allowed_props_str.split(',') if prop.strip()]
if not allowed_props:
print('❌ ERROR: No valid property names found in allowed_extra_properties', file=sys.stderr)
Copy link
Owner

Choose a reason for hiding this comment

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

You can just do sys.exit("Message") and it will exit with error and print the message.

try:
schema_path = os.environ['SCHEMA_PATH_ESC']
final_schema_path = os.environ['FINAL_SCHEMA_PATH_ESC']
allowed_props_str = os.environ['ALLOWED_PROPS_ESC']
Copy link
Owner

Choose a reason for hiding this comment

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

nit: variable names should not have types.

| :--- | :--- | :--- |
| `path` 📍 | Where is your `.zenodo.json`? | `.zenodo.json` |
| `error_format` 🎨 | `text`, `json`, or `pretty-json` | `text` |
| `allowed_extra_properties`| Comma-separated list of extra property names to allow (e.g., `pub_id,custom_field`) | `''` (empty) |
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe just extra_properties ? I think allowed is implied.


### 🔓 Allowing Extra Properties

Some Invenio instances (like [RODARE](https://rodare.hzdr.de)) require additional properties beyond the standard Zenodo schema. You can explicitly allow these properties using the `allowed_extra_properties` input:
Copy link
Owner

Choose a reason for hiding this comment

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

What if something is allowed and required? Or requires more than just being in the listing? Notably, we are adding the allowed extra properties, but not defining types, etc.

FINAL_SCHEMA_PATH="/tmp/modified_schema.json"

# Use Python to modify the schema and add allowed extra properties
if ! SCHEMA_PATH_ESC="$SCHEMA_PATH" \
Copy link
Owner

Choose a reason for hiding this comment

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

For this block let's:

  • Write an actual Python script with argparse
  • Run the command here, providing the environment variables

It will be more understandable for the reader developer than as currently done.

import os
import sys
try:
Copy link
Owner

Choose a reason for hiding this comment

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

LLMs have a tendency to wrap everything in try/except. My preference would be to not do that. We aren't catching any specific error here, especially with the various checks. If there is an error I want it to raise and see it and don't need the additional wrapping.

if prop not in schema['properties']:
schema['properties'][prop] = {}
# Write the modified schema
Copy link
Owner

Choose a reason for hiding this comment

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

Make sure that comments are useful/meaningful.

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.

Invenio: pub_id

2 participants