Files
leadchat/swagger/definitions/index.yml
Haruma HIRABAYASHI 654fcd43f2 docs(swagger): fix public API schema definitions to match jbuilder responses (#13693)
## 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>
2026-03-19 00:03:37 -07:00

283 lines
7.7 KiB
YAML

## ---------- ERRORS -------------- ##
## -------------------------------- ##
bad_request_error:
$ref: ./error/bad_request.yml
request_error:
$ref: ./error/request.yml
## ---------- RESOURCE ------------ ##
## -------------------------------- ##
generic_id:
$ref: ./resource/extension/generic.yml
canned_response:
$ref: ./resource/canned_response.yml
custom_attribute:
$ref: ./resource/custom_attribute.yml
automation_rule:
$ref: ./resource/automation_rule.yml
automation_rule_item:
$ref: ./resource/automation_rule_item.yml
portal:
$ref: ./resource/portal.yml
portal_single:
$ref: ./resource/portal_single.yml
portal_config:
$ref: ./resource/portal_config.yml
portal_logo:
$ref: ./resource/portal_logo.yml
portal_meta:
$ref: ./resource/portal_meta.yml
portal_item:
$ref: ./resource/portal_item.yml
category:
$ref: ./resource/category.yml
article:
$ref: ./resource/article.yml
contact:
$ref: ./resource/contact.yml
conversation:
$ref: ./resource/conversation.yml
message:
$ref: ./resource/message.yml
user:
$ref: ./resource/user.yml
agent:
$ref: ./resource/agent.yml
inbox:
$ref: ./resource/inbox.yml
inbox_contact:
$ref: ./resource/inbox_contact.yml
agent_bot:
$ref: ./resource/agent_bot.yml
contact_inboxes:
$ref: ./resource/contact_inboxes.yml
contactable_inboxes:
$ref: ./resource/contactable_inboxes.yml
custom_filter:
$ref: ./resource/custom_filter.yml
webhook:
$ref: ./resource/webhook.yml
account:
$ref: ./resource/account.yml
account_detail:
$ref: ./resource/account_detail.yml
account_show_response:
$ref: ./resource/account_show_response.yml
account_user:
$ref: ./resource/account_user.yml
platform_account:
$ref: ./resource/platform_account.yml
team:
$ref: ./resource/team.yml
label:
$ref: ./resource/label.yml
integrations_app:
$ref: ./resource/integrations/app.yml
integrations_hook:
$ref: ./resource/integrations/hook.yml
audit_log:
$ref: ./resource/audit_log.yml
## public resources
public_contact:
$ref: ./resource/public/contact.yml
public_contact_record:
$ref: ./resource/public/contact_record.yml
public_conversation:
$ref: ./resource/public/conversation.yml
public_message:
$ref: ./resource/public/message.yml
public_message_attachment:
$ref: ./resource/public/message_attachment.yml
public_message_sender:
$ref: ./resource/public/message_sender.yml
public_inbox:
$ref: ./resource/public/inbox.yml
## ---------- REQUEST ------------- ##
## -------------------------------- ##
account_create_update_payload:
$ref: ./request/account/create_update_payload.yml
account_update_payload:
$ref: ./request/account/update_payload.yml
account_user_create_update_payload:
$ref: ./request/account_user/create_update_payload.yml
platform_agent_bot_create_update_payload:
$ref: ./request/platform/agent_bot/create_update_payload.yml
agent_bot_create_update_payload:
$ref: ./request/agent_bot/create_update_payload.yml
user_create_update_payload:
$ref: ./request/user/create_update_payload.yml
canned_response_create_update_payload:
$ref: ./request/canned_response/create_update_payload.yml
custom_attribute_create_update_payload:
$ref: ./request/custom_attribute/create_update_payload.yml
## Agent
agent_create_payload:
$ref: ./request/agent/create_payload.yml
agent_update_payload:
$ref: ./request/agent/update_payload.yml
## Contact
contact_create_payload:
$ref: ./request/contact/create_payload.yml
contact_update_payload:
$ref: ./request/contact/update_payload.yml
## Conversation
conversation_create_payload:
$ref: ./request/conversation/create_payload.yml
conversation_message_create_payload:
$ref: ./request/conversation/create_message_payload.yml
# Inbox
inbox_create_payload:
$ref: ./request/inbox/create_payload.yml
inbox_update_payload:
$ref: ./request/inbox/update_payload.yml
# Team
team_create_update_payload:
$ref: ./request/team/create_update_payload.yml
# Label
label_create_update_payload:
$ref: ./request/label/create_update_payload.yml
# Custom Filter
custom_filter_create_update_payload:
$ref: ./request/custom_filter/create_update_payload.yml
webhook_create_update_payload:
$ref: ./request/webhooks/create_update_payload.yml
integrations_hook_create_payload:
$ref: ./request/integrations/hook_create_payload.yml
integrations_hook_update_payload:
$ref: ./request/integrations/hook_update_payload.yml
# Automation Rule
automation_rule_create_update_payload:
$ref: ./request/automation_rule/create_update_payload.yml
# Help Center
portal_create_update_payload:
$ref: ./request/portal/portal_create_update_payload.yml
category_create_update_payload:
$ref: ./request/portal/category_create_update_payload.yml
article_create_update_payload:
$ref: ./request/portal/article_create_update_payload.yml
## public requests
public_contact_create_update_payload:
$ref: ./request/public/contact/create_update_payload.yml
public_message_create_payload:
$ref: ./request/public/message/create_payload.yml
public_message_update_payload:
$ref: ./request/public/message/update_payload.yml
public_conversation_create_payload:
$ref: ./request/public/conversation/create_payload.yml
## ---------- RESPONSE ------------ ##
## -------------------------------- ##
## Contact
extended_contact:
allOf:
- $ref: '#/components/schemas/contact'
- $ref: ./resource/extension/contact/show.yml
contact_base:
allOf:
- $ref: '#/components/schemas/generic_id'
- $ref: '#/components/schemas/contact'
contact_list:
type: array
description: 'array of contacts'
items:
allOf:
- $ref: '#/components/schemas/contact'
contact_conversations:
type: array
description: 'array of conversations'
items:
allOf:
- $ref: '#/components/schemas/conversation'
- $ref: ./resource/extension/contact/conversation.yml
- $ref: ./resource/extension/conversation/with_display_id.yml
contact_labels:
$ref: ./resource/extension/contact/labels.yml
## Conversation
conversation_list:
$ref: ./resource/extension/conversation/list.yml
conversation_show:
$ref: ./resource/extension/conversation/show.yml
conversation_status_toggle:
$ref: ./resource/extension/conversation/status_toggle.yml
conversation_labels:
$ref: ./resource/extension/conversation/labels.yml
## Report
account_summary:
$ref: './resource/reports/summary.yml'
agent_conversation_metrics:
$ref: './resource/reports/conversation/agent.yml'
channel_summary:
$ref: './resource/reports/channel_summary.yml'
first_response_time_distribution:
$ref: './resource/reports/first_response_time_distribution.yml'
inbox_label_matrix:
$ref: './resource/reports/inbox_label_matrix.yml'
outgoing_messages_count:
$ref: './resource/reports/outgoing_messages_count.yml'
inbox_summary:
$ref: './resource/reports/inbox_summary.yml'
agent_summary:
$ref: './resource/reports/agent_summary.yml'
team_summary:
$ref: './resource/reports/team_summary.yml'
contact_detail:
$ref: ./resource/contact_detail.yml
message_detailed:
$ref: ./resource/message_detailed.yml
conversation_meta:
$ref: ./resource/conversation_meta.yml
conversation_messages:
$ref: ./resource/conversation_messages.yml
contact_meta:
$ref: ./resource/contact_meta.yml
contact_inbox:
$ref: ./resource/contact_inbox.yml
contact_list_item:
$ref: ./resource/contact_list_item.yml
contacts_list_response:
$ref: ./resource/contacts_list_response.yml
contact_show_response:
$ref: ./resource/contact_show_response.yml
contact_conversation_message:
$ref: ./resource/contact_conversation_message.yml
contact_conversations_response:
$ref: ./resource/contact_conversations_response.yml
contactable_inboxes_response:
$ref: ./resource/contactable_inboxes_response.yml
reporting_event:
$ref: ./resource/reporting_event.yml
reporting_event_meta:
$ref: ./resource/reporting_event_meta.yml
reporting_events_list_response:
$ref: ./resource/reporting_events_list_response.yml