Doby’s ESA Pyxel Logs🌙

🧩 Pyxel Contribution: Null in Optional Literal Enums

Summary: Lets the JSON Schema accept null for nine optional arguments whose default is None.

URL:
https://gitlab.com/esa/pyxel/-/merge_requests/1252

✨ Overview

Nine model arguments are typed Optional[Literal[...]] with a default of None, for example align in fixed_pattern_noise. apischema rendered them as a nullable type with an enum of the strings alone:

"type": ["string", "null"],
"enum": ["center", "top_left", "top_right", "bottom_left", "bottom_right"]

A value has to satisfy both keywords, so align: null, the default, failed validation while Pyxel ran it without complaint. Tools that validate a configuration against the schema reported an error the user did not make.


🔧 Technical Changes

The generated script now adds null to every enum whose type already allows it, before the schema is written or checked. The regenerated schema changes only these nine enums:

  • charge_collection: fixed_pattern_noise.align, persistence.trap_densities_align, persistence.trap_capacities_align
  • charge_generation: conversion_with_qe_map.align, load_charge.align, dark_current_dd.particle_type
  • photon_collection: load_image.align, usaf_illumination.align
  • readout_electronics: simple_adc.data_type

🧪 Validation

  • ✅ The new test fails against the previous schema and passes with this one.
  • ✅ The schema still rejects an unknown keyword.

🦕 Authored by: Doby Baxter
🌌 Contribution for: ESA Pyxel Project

⚙️ Config Lab