Files
leadchat/swagger/definitions/request/conversation/create_payload.yml
Shivam Mishra 9a9398b386 feat: validate OpenAPI spec using Skooma (#13623)
Adds Skooma-based OpenAPI validation so SDK-facing request specs can
assert that documented request and response contracts match real Rails
behavior. This also upgrades the spec to OpenAPI 3.1 and fixes contract
drift uncovered while validating core application and platform
resources.

Closes
None

Why
We want CI to catch OpenAPI drift before it reaches SDK consumers. While
wiring validation in, this PR surfaced several mismatches between the
documented contract and what the Rails endpoints actually accept or
return.

What this change does
- Adds Skooma-backed OpenAPI validation to the request spec flow and a
dedicated OpenAPI validation spec.
- Migrates nullable schema definitions to OpenAPI 3.1-compatible unions.
- Updates core SDK-facing schemas and payloads across accounts,
contacts, conversations, inboxes, messages, teams, reporting events, and
platform account resources.
- Documents concrete runtime cases that were previously missing or
inaccurate, including nested `profile` update payloads, multipart avatar
uploads, required profile update bodies, nullable inbox feature flags,
and message sender types that include both `Captain::Assistant` and
senderless activity-style messages.
- Regenerates the committed Swagger JSON and tag-group artifacts used by
CI sync checks.

Validation
- `bundle exec rake swagger:build`
- `bundle exec rspec spec/swagger/openapi_spec.rb`

---------

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2026-03-10 18:33:55 -07:00

79 lines
2.4 KiB
YAML

type: object
required:
- source_id
properties:
source_id:
type: string
description: Conversation source id
example: '1234567890'
inbox_id:
type: integer
description: 'Id of inbox in which the conversation is created <br/> Allowed Inbox Types: Website, Phone, Api, Email'
example: 1
contact_id:
type: integer
description: Contact Id for which conversation is created
example: 1
additional_attributes:
type: object
description: Lets you specify attributes like browser information
example:
{
browser: 'Chrome',
browser_version: '89.0.4389.82',
os: 'Windows',
os_version: '10',
}
custom_attributes:
type: object
description: The object to save custom attributes for conversation, accepts custom attributes key and value
example: { attribute_key: attribute_value, priority_conversation_number: 3 }
status:
type: string
enum: ['open', 'resolved', 'pending']
description: Specify the conversation whether it's pending, open, closed
example: open
assignee_id:
type: integer
description: Agent Id for assigning a conversation to an agent
example: 1
team_id:
type: integer
description: Team Id for assigning a conversation to a team\
example: 1
snoozed_until:
type: string
format: date-time
description: Snoozed until date time
example: '2030-07-21T17:32:28Z'
message:
type: object
description: The initial message to be sent to the conversation
required: ['content']
properties:
content:
type: string
description: The content of the message
example: 'Hello, how can I help you?'
template_params:
type: object
description: The template params for the message in case of whatsapp Channel
properties:
name:
type: string
description: Name of the template
example: 'sample_issue_resolution'
category:
type: string
description: Category of the template
example: UTILITY
language:
type: string
description: Language of the template
example: en_US
processed_params:
type: object
description: The processed param values for template variables in template
example:
1: 'Chatwoot'