## Description This PR updates the OpenAPI schema definitions for Public API resources (`public_conversation`, `public_message`, `public_contact`) so they match the actual API responses produced by the jbuilder views. These definitions were introduced in #2417 (2021-06) with a minimal set of fields. The jbuilder views have since been updated (e.g. `uuid` in #7255, `agent_last_seen_at` in #4377), but the Swagger definitions were never updated. As a result, generated API clients get incorrect or missing types. This change fixes that by aligning the schemas with the implementation. **Fixes #13692** ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality not to work as expected) - [x] This change requires a documentation update ## How Has This Been Tested? - Compared each jbuilder view (`app/views/public/api/v1/models/_conversation.json.jbuilder`, `_message.json.jbuilder`, `_contact.json.jbuilder`) field-by-field against the Swagger YAML definitions. - Cross-referenced Ruby model enums (`Conversation.status`, `Attachment.file_type`, `Message.message_type`) for enum values. - Ran the swagger build (via the project’s `rake swagger:build` logic / `json_refs` resolution) to regenerate `swagger.json` and tag group files; confirmed the generated schemas contain the correct fields and types. - No runtime tests were run; this is a documentation/schema-only change. ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas *(N/A: schema definitions)* - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works *(N/A: documentation/schema only)* - [ ] New and existing unit tests pass locally with my changes *(N/A: no code under test)* - [x] Any dependent changes have been merged and published in downstream modules *(N/A: none)* --- ## Change summary (for reference) ### `public_conversation` - Added missing fields: `uuid`, `status`, `contact_last_seen_at`, `agent_last_seen_at` - Fixed `inbox_id` type from `string` to `integer` - Fixed `messages` items `$ref` from `message` to `public_message` - Added property details for embedded `contact` object (`id`, `name`, `email`, `phone_number`) - Added `status` enum: `open`, `resolved`, `pending`, `snoozed` ### `public_message` - Fixed `id`, `message_type`, `created_at`, `conversation_id` types (string → integer where applicable) - Fixed `content_attributes` type from `string` to `object` - Added property details for `attachments` items and `sender` object - Added `file_type` and `sender.type` enums ### `public_contact` - Added missing `phone_number` field --------- Co-authored-by: Sojan Jose <sojan@pepalo.com>
61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
type: object
|
|
additionalProperties: true
|
|
description: Attachment payload. Available fields vary by attachment file_type.
|
|
properties:
|
|
id:
|
|
type: integer
|
|
description: Id of the attachment
|
|
message_id:
|
|
type: integer
|
|
description: Id of the parent message
|
|
file_type:
|
|
type: string
|
|
enum: ['image', 'audio', 'video', 'file', 'location', 'fallback', 'share', 'story_mention', 'contact', 'ig_reel', 'ig_post', 'ig_story', 'embed']
|
|
description: Type of the attached file
|
|
account_id:
|
|
type: integer
|
|
description: Id of the account
|
|
extension:
|
|
type:
|
|
- string
|
|
- 'null'
|
|
description: File extension
|
|
data_url:
|
|
type:
|
|
- string
|
|
- 'null'
|
|
description: URL of the file. Can be null when an attachment variant has no external URL.
|
|
thumb_url:
|
|
type: string
|
|
description: URL of the file thumbnail
|
|
file_size:
|
|
type: integer
|
|
description: File size in bytes
|
|
width:
|
|
type:
|
|
- integer
|
|
- 'null'
|
|
description: Width of the attachment when available
|
|
height:
|
|
type:
|
|
- integer
|
|
- 'null'
|
|
description: Height of the attachment when available
|
|
coordinates_lat:
|
|
type: number
|
|
description: Latitude for location attachments
|
|
coordinates_long:
|
|
type: number
|
|
description: Longitude for location attachments
|
|
fallback_title:
|
|
type:
|
|
- string
|
|
- 'null'
|
|
description: Fallback title for location, fallback, and contact attachments when available
|
|
meta:
|
|
type: object
|
|
description: Metadata for contact attachments
|
|
transcribed_text:
|
|
type: string
|
|
description: Transcribed text for audio attachments
|