From 7ae25efa866554dfb0c5314fbceccd6afa354bf1 Mon Sep 17 00:00:00 2001 From: dazzatronus Date: Thu, 1 Oct 2026 10:20:43 +1000 Subject: [PATCH] fix: type the generate request as the fields generation uses --- api.oas3.yaml | 3 +++ paths/generate.yaml | 9 ++++---- schemas/generationasset.yaml | 40 ++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 schemas/generationasset.yaml diff --git a/api.oas3.yaml b/api.oas3.yaml index a0faf69..61169f6 100644 --- a/api.oas3.yaml +++ b/api.oas3.yaml @@ -376,6 +376,9 @@ components: $ref: "./schemas/serve/transfer.yaml#/Transfer" # Generation schemas + GenerationAsset: + $ref: "./schemas/generationasset.yaml#/GenerationAsset" + GenerationModel: $ref: "./schemas/generationmodel.yaml#/GenerationModel" diff --git a/paths/generate.yaml b/paths/generate.yaml index ad96638..4b0f69d 100644 --- a/paths/generate.yaml +++ b/paths/generate.yaml @@ -90,8 +90,10 @@ schema: type: string requestBody: + required: true description: >- - A prompt-bearing image, video or audio asset to generate. + The asset to generate and, for models that generate to a duration, the length of + the clip it fills. content: application/json: example: @@ -103,10 +105,7 @@ type: object properties: asset: - oneOf: - - $ref: "../schemas/imageasset.yaml#/ImageAsset" - - $ref: "../schemas/videoasset.yaml#/VideoAsset" - - $ref: "../schemas/audioasset.yaml#/AudioAsset" + $ref: "../schemas/generationasset.yaml#/GenerationAsset" length: description: >- The length, in seconds, of the clip the asset fills. A model that diff --git a/schemas/generationasset.yaml b/schemas/generationasset.yaml new file mode 100644 index 0000000..6f70b78 --- /dev/null +++ b/schemas/generationasset.yaml @@ -0,0 +1,40 @@ + GenerationAsset: + description: An image, video or audio asset to generate from a text prompt. + type: object + properties: + type: + description: The kind of asset to generate. + type: string + enum: ['image', 'video', 'audio'] + example: image + prompt: + description: >- + A description of the asset to generate. For text-to-speech models it is the + text spoken. + type: string + minLength: 1 + maxLength: 4000 + pattern: '\S' + example: A lighthouse on a rocky coast at sunset, cinematic lighting + model: + description: >- + The generation model. Defaults to `nano-banana-2` for images, + `seedance-2.0-text-to-video` for video and `elevenlabs-multilingual-v2` for + audio. `GET /models` lists the models for each type. + type: string + example: nano-banana-2 + options: + description: >- + Settings for the chosen `model`. `GET /models` lists the options each model + accepts; omitted options use the model's defaults and unknown or invalid + options are rejected. A starting image for video goes in `startSrc` + (`inputSrc` on the original image-to-video models) and a speech voice in + `voice`. + type: object + additionalProperties: true + example: + aspectRatio: '16:9' + additionalProperties: false + required: + - type + - prompt