diff --git a/static/schemas/v1/index.json b/static/schemas/v1/index.json index 4848eb0809..363ad8f923 100644 --- a/static/schemas/v1/index.json +++ b/static/schemas/v1/index.json @@ -132,6 +132,12 @@ }, "media-buy": { "description": "Media buy task request/response schemas", + "supporting-schemas": { + "package-request": { + "$ref": "/schemas/v1/media-buy/package-request.json", + "description": "Package configuration for media buy creation - used within create_media_buy request" + } + }, "tasks": { "get-products": { "request": { diff --git a/static/schemas/v1/media-buy/create-media-buy-request.json b/static/schemas/v1/media-buy/create-media-buy-request.json index 73b6335da6..ef4787bb35 100644 --- a/static/schemas/v1/media-buy/create-media-buy-request.json +++ b/static/schemas/v1/media-buy/create-media-buy-request.json @@ -19,46 +19,7 @@ "type": "array", "description": "Array of package configurations", "items": { - "type": "object", - "properties": { - "buyer_ref": { - "type": "string", - "description": "Buyer's reference identifier for this package" - }, - "products": { - "type": "array", - "description": "Array of product IDs to include in this package", - "items": { - "type": "string" - } - }, - "format_ids": { - "type": "array", - "description": "Array of format IDs that will be used for this package - must be supported by all products", - "items": { - "type": "string", - "description": "Format ID referencing a format from list_creative_formats" - } - }, - "budget": { - "$ref": "/schemas/v1/core/budget.json" - }, - "targeting_overlay": { - "$ref": "/schemas/v1/core/targeting.json" - }, - "creative_ids": { - "type": "array", - "description": "Creative IDs to assign to this package at creation time", - "items": { - "type": "string" - } - } - }, - "anyOf": [ - {"required": ["buyer_ref", "products", "format_ids"]}, - {"required": ["buyer_ref", "products", "format_selection"]} - ], - "additionalProperties": false + "$ref": "/schemas/v1/media-buy/package-request.json" } }, "promoted_offering": { diff --git a/static/schemas/v1/media-buy/package-request.json b/static/schemas/v1/media-buy/package-request.json new file mode 100644 index 0000000000..7293215373 --- /dev/null +++ b/static/schemas/v1/media-buy/package-request.json @@ -0,0 +1,90 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/schemas/v1/media-buy/package-request.json", + "title": "Package Request", + "description": "Package configuration for media buy creation", + "oneOf": [ + { + "type": "object", + "description": "Package with explicit format IDs", + "properties": { + "buyer_ref": { + "type": "string", + "description": "Buyer's reference identifier for this package" + }, + "products": { + "type": "array", + "description": "Array of product IDs to include in this package", + "items": { + "type": "string" + } + }, + "format_ids": { + "type": "array", + "description": "Array of format IDs that will be used for this package - must be supported by all products", + "items": { + "type": "string", + "description": "Format ID referencing a format from list_creative_formats" + } + }, + "budget": { + "$ref": "/schemas/v1/core/budget.json" + }, + "targeting_overlay": { + "$ref": "/schemas/v1/core/targeting.json" + }, + "creative_ids": { + "type": "array", + "description": "Creative IDs to assign to this package at creation time", + "items": { + "type": "string" + } + } + }, + "required": ["buyer_ref", "products", "format_ids"], + "not": { + "required": ["format_selection"] + }, + "additionalProperties": false + }, + { + "type": "object", + "description": "Package with dynamic format selection", + "properties": { + "buyer_ref": { + "type": "string", + "description": "Buyer's reference identifier for this package" + }, + "products": { + "type": "array", + "description": "Array of product IDs to include in this package", + "items": { + "type": "string" + } + }, + "format_selection": { + "type": "object", + "description": "Dynamic format selection criteria" + }, + "budget": { + "$ref": "/schemas/v1/core/budget.json" + }, + "targeting_overlay": { + "$ref": "/schemas/v1/core/targeting.json" + }, + "creative_ids": { + "type": "array", + "description": "Creative IDs to assign to this package at creation time", + "items": { + "type": "string" + } + } + }, + "required": ["buyer_ref", "products", "format_selection"], + "not": { + "required": ["format_ids"] + }, + "additionalProperties": false + } + ] +} diff --git a/static/schemas/v1/standard-formats/asset-types/image.json b/static/schemas/v1/standard-formats/asset-types/image.json index 0fc920afa6..ca8dbeb3d1 100644 --- a/static/schemas/v1/standard-formats/asset-types/image.json +++ b/static/schemas/v1/standard-formats/asset-types/image.json @@ -3,107 +3,176 @@ "$id": "/schemas/v1/standard-formats/asset-types/image.json", "title": "Image Asset Type Schema", "description": "Schema for static image assets in AdCP creative formats", - "type": "object", - "properties": { - "asset_id": { - "type": "string", - "pattern": "^[a-z0-9_]+$", - "description": "Unique identifier for this asset within the format" - }, - "asset_type": { - "type": "string", - "const": "image" - }, - "required": { - "type": "boolean", - "description": "Whether this asset is mandatory for the format" - }, - "width": { - "type": "integer", - "minimum": 1, - "maximum": 4096, - "description": "Required width in pixels" - }, - "height": { - "type": "integer", - "minimum": 1, - "maximum": 4096, - "description": "Required height in pixels" - }, - "acceptable_dimensions": { - "type": "array", - "items": { - "type": "object", - "properties": { - "width": { - "type": "integer", - "minimum": 1 + "oneOf": [ + { + "type": "object", + "description": "Image with exact dimensions specified", + "properties": { + "asset_id": { + "type": "string", + "pattern": "^[a-z0-9_]+$", + "description": "Unique identifier for this asset within the format" + }, + "asset_type": { + "type": "string", + "const": "image" + }, + "required": { + "type": "boolean", + "description": "Whether this asset is mandatory for the format" + }, + "width": { + "type": "integer", + "minimum": 1, + "maximum": 4096, + "description": "Required width in pixels" + }, + "height": { + "type": "integer", + "minimum": 1, + "maximum": 4096, + "description": "Required height in pixels" + }, + "acceptable_formats": { + "type": "array", + "items": { + "type": "string", + "enum": ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp"] }, - "height": { - "type": "integer", - "minimum": 1 - } + "minItems": 1, + "uniqueItems": true, + "description": "List of acceptable image file formats" }, - "required": ["width", "height"], - "additionalProperties": false + "max_file_size_kb": { + "type": "number", + "minimum": 1, + "maximum": 10240, + "description": "Maximum file size in kilobytes" + }, + "min_file_size_kb": { + "type": "number", + "minimum": 0.1, + "description": "Minimum file size in kilobytes" + }, + "transparency": { + "type": "boolean", + "description": "Whether transparency is required/supported" + }, + "animation_allowed": { + "type": "boolean", + "description": "Whether animated images (GIF, animated WebP) are allowed" + }, + "min_resolution_dpi": { + "type": "integer", + "minimum": 72, + "maximum": 600, + "description": "Minimum resolution in dots per inch" + }, + "color_mode": { + "type": "string", + "enum": ["rgb", "cmyk", "grayscale"], + "description": "Required color mode" + }, + "notes": { + "type": "string", + "maxLength": 500, + "description": "Additional requirements or restrictions" + } }, - "minItems": 1, - "description": "Array of acceptable width/height combinations" - }, - "acceptable_formats": { - "type": "array", - "items": { - "type": "string", - "enum": ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp"] + "required": ["asset_id", "asset_type", "required", "width", "height"], + "not": { + "required": ["acceptable_dimensions"] }, - "minItems": 1, - "uniqueItems": true, - "description": "List of acceptable image file formats" - }, - "max_file_size_kb": { - "type": "number", - "minimum": 1, - "maximum": 10240, - "description": "Maximum file size in kilobytes" - }, - "min_file_size_kb": { - "type": "number", - "minimum": 0.1, - "description": "Minimum file size in kilobytes" - }, - "transparency": { - "type": "boolean", - "description": "Whether transparency is required/supported" - }, - "animation_allowed": { - "type": "boolean", - "description": "Whether animated images (GIF, animated WebP) are allowed" - }, - "min_resolution_dpi": { - "type": "integer", - "minimum": 72, - "maximum": 600, - "description": "Minimum resolution in dots per inch" - }, - "color_mode": { - "type": "string", - "enum": ["rgb", "cmyk", "grayscale"], - "description": "Required color mode" - }, - "notes": { - "type": "string", - "maxLength": 500, - "description": "Additional requirements or restrictions" - } - }, - "required": ["asset_id", "asset_type", "required"], - "additionalProperties": false, - "anyOf": [ - { - "required": ["width", "height"] + "additionalProperties": false }, { - "required": ["acceptable_dimensions"] + "type": "object", + "description": "Image with multiple acceptable dimension combinations", + "properties": { + "asset_id": { + "type": "string", + "pattern": "^[a-z0-9_]+$", + "description": "Unique identifier for this asset within the format" + }, + "asset_type": { + "type": "string", + "const": "image" + }, + "required": { + "type": "boolean", + "description": "Whether this asset is mandatory for the format" + }, + "acceptable_dimensions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "width": { + "type": "integer", + "minimum": 1 + }, + "height": { + "type": "integer", + "minimum": 1 + } + }, + "required": ["width", "height"], + "additionalProperties": false + }, + "minItems": 1, + "description": "Array of acceptable width/height combinations" + }, + "acceptable_formats": { + "type": "array", + "items": { + "type": "string", + "enum": ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp"] + }, + "minItems": 1, + "uniqueItems": true, + "description": "List of acceptable image file formats" + }, + "max_file_size_kb": { + "type": "number", + "minimum": 1, + "maximum": 10240, + "description": "Maximum file size in kilobytes" + }, + "min_file_size_kb": { + "type": "number", + "minimum": 0.1, + "description": "Minimum file size in kilobytes" + }, + "transparency": { + "type": "boolean", + "description": "Whether transparency is required/supported" + }, + "animation_allowed": { + "type": "boolean", + "description": "Whether animated images (GIF, animated WebP) are allowed" + }, + "min_resolution_dpi": { + "type": "integer", + "minimum": 72, + "maximum": 600, + "description": "Minimum resolution in dots per inch" + }, + "color_mode": { + "type": "string", + "enum": ["rgb", "cmyk", "grayscale"], + "description": "Required color mode" + }, + "notes": { + "type": "string", + "maxLength": 500, + "description": "Additional requirements or restrictions" + } + }, + "required": ["asset_id", "asset_type", "required", "acceptable_dimensions"], + "not": { + "required": ["width", "height"] + }, + "additionalProperties": false } ] } \ No newline at end of file