Skip to content

feat: add minimum and maximum range metadata to option introspection - #106

Merged
cshum merged 1 commit into
mainfrom
introspection-min-max
Sep 22, 2026
Merged

cshum merged 1 commit into
mainfrom
introspection-min-max

Conversation

@cshum

@cshum cshum commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Add minimum and maximum range metadata to libvips option introspection.

This is groundwork for a possible vipsgen v2 options API. The current generated options API uses zero values to decide whether an option should be passed to libvips. This means valid explicit values such as 0 can be skipped and replaced by the libvips default.

For example, an integer or floating-point option may need pointer semantics when:

  • 0 is within the parameter range
  • the default value is non-zero

This metadata can help vipsgen make that decision mechanically instead of maintaining operation-specific allowlists.

The same idea can be applied to other types:

  • enums where value 0 exists and the default is non-zero
  • booleans where the default is true, so explicit false must be preserved

This PR only adds the introspection metadata. It does not change generated option types or generation behavior yet.

The v2 design is expected to use pointers only where they are needed to distinguish omission from an explicitly supplied zero value. Other fields can keep normal Go value types, which are cleaner and more idiomatic.

Related fixes

These fixes exposed the broader issue in the original options API design.

Notes

Some libvips parameters have unbounded ranges, so range metadata may eventually need to represent whether each bound exists rather than serializing infinity as a numeric JSON value. Flags, 64-bit values, arrays, and operation-specific semantics may also need separate metadata treatment.

This PR is intended as the metadata-first step before changing the generated v2 API.

@cshum cshum changed the title feat: add min max to introspection metadata feat: add minimum and maximum range metadata to libvips option introspection Sep 22, 2026
@cshum cshum changed the title feat: add minimum and maximum range metadata to libvips option introspection feat: add minimum and maximum range metadata to option introspection Sep 22, 2026
@cshum
cshum merged commit 0bf3115 into main Sep 22, 2026
5 checks passed
@cshum
cshum deleted the introspection-min-max branch September 22, 2026 17:45
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.

1 participant