Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 18, 2025

Overview

This PR adds support for the MetaDetails entity and updates the MediaAttachment entity to include meta[small] and meta[original] properties, as specified in mastodon/documentation#1735.

Changes

New MetaDetails Entity

Created a new MetaDetails entity in the Mastodon documentation with the following properties:

  • width (nullable Integer) - The width of the attachment in pixels, or null if the attachment is not visual
  • height (nullable Integer) - The height of the attachment in pixels, or null if the attachment is not visual
  • frame_rate (nullable String) - The frame rate of the video attachment (as a fraction), or null if the attachment is not a video
  • duration (nullable Float) - The duration of the video attachment, or null if the attachment is not video or audio
  • bitrate (nullable Integer) - The media bitrate of the video or audio attachment, or null if the attachment is an image
  • aspect (nullable Float) - The media aspect ratio of the video or image attachment, or null if the attachment is not visual

Updated MediaAttachment Entity

Added two new optional, nullable properties to MediaAttachment:

  • meta[small] - Details about the small preview version of the attachment (references MetaDetails)
  • meta[original] - Details about the original version of the attachment (references MetaDetails)

Generated OpenAPI Schema

The OpenAPI schema now includes:

{
  "MetaDetails": {
    "type": "object",
    "description": "Metadata details about a media attachment.",
    "properties": {
      "width": { "type": ["integer", "null"] },
      "height": { "type": ["integer", "null"] },
      "frame_rate": { "type": ["string", "null"] },
      "duration": { "type": ["number", "null"] },
      "bitrate": { "type": ["integer", "null"] },
      "aspect": { "type": ["number", "null"] }
    }
  }
}

And MediaAttachment.meta.small and MediaAttachment.meta.original properly reference the MetaDetails schema using $ref.

Testing

  • Updated entity count test to reflect the new MetaDetails entity (91 → 92 entities)
  • Added comprehensive test suite (EntityParser.metadetails.test.ts) with 6 tests covering:
    • MetaDetails entity parsing
    • Verification of all 6 properties
    • Nullable property validation
    • MediaAttachment meta property references

All 136 test suites pass (630 tests total).

Related

Ref: mastodon/documentation#1735

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • otel.cloud.redocly.com
    • Triggering command: node /home/REDACTED/work/mastodon-openapi/mastodon-openapi/node_modules/.bin/redocly lint --format=github-actions dist/schema.json (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>MediaAttachment special cases</issue_title>
<issue_description>Add a MetaDetails entity with the following properties

### `width` {#width}

**Description:** The width of the attachment in pixels.\
**Type:** {{<nullable>}} Integer, or null if the attachment is not visual\
**Version history:**

### `height` {#height}

**Description:** The height of the attachment in pixels.\
**Type:** {{<nullable>}} Integer, or null if the attachment is not visual\
**Version history:**

### `frame_rate` {#frame_rate}

**Description:** The frame rate of the video attachment.\
**Type:** {{<nullable>}} String (fraction), or null if the attachment is not a video\
**Version history:**

### `duration` {#duration}

**Description:** The duration of the video attachment.\
**Type:** {{<nullable>}} Float, or null if the attachment is not video or audio\
**Version history:**

### `bitrate` {#bitrate}

**Description:** The media bitrate of the video or audio attachment.\
**Type:** {{<nullable>}} Integer, or null if the attachment is an image\
**Version history:**

### `aspect` {#aspect}

**Description:** The media aspect ratio of the video or image attachment.\
**Type:** {{<nullable>}} Float, or null if the attachment is not visual\
**Version history:**

Update MediaAttachment#meta to include small and original.

### `meta[small]` {{%optional%}} {#meta-small}

**Description:** Details about the small preview version of the attachment.\
**Type:** {{<nullable>}} [MetaDetails](#MetaDetails) or null\
**Version history:**

### `meta[original]` {{%optional%}} {#meta-original}

**Description:** Details about the original version of the attachment.\
**Type:** {{<nullable>}} [MetaDetails](#MetaDetails) or null\
**Version history:**

Ref mastodon/documentation#1735</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #496


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Add MetaDetails entity for media attachments Add MetaDetails entity and update MediaAttachment meta properties Oct 18, 2025
Copilot AI requested a review from abraham October 18, 2025 16:25
Copilot finished work on behalf of abraham October 18, 2025 16:25
@abraham abraham closed this Oct 18, 2025
@abraham abraham deleted the copilot/add-metadetails-entity branch October 18, 2025 16:32
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.

MediaAttachment special cases

2 participants