feat: add Image type for image-specific file handling #2567
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This experimental PR adds a new
cog.Imagetype that extendscog.Pathto provide image-specific handling in model inputs and outputs.The Image type works identically to Path but produces OpenAPI schemas with
format: "uri"andx-cog-type: "image", following the same pattern as streaming outputs that usex-cog-array-type: "iterator". This allows UIs to provide image-specific widgets while correctly identifying the value as a URI.Example usage
OpenAPI schema
The generated OpenAPI schema for an Image input:
{ "image": { "title": "Image", "description": "An input image", "type": "string", "format": "uri", "x-cog-type": "image" } }Related: