-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Schema Inaccuracy
Example in spec shows that intended response is:
{
type: "conversation.list",
pages: object;
total_count: number;
conversations: Conversation[];
}
The 200 response schema points to a paginated_response which is:
{
type: "conversation.list",
pages: object;
total_count: number;
data: Conversation[];
}
Expected
When using GET /conversations, expecting to map over response.data. Instead, receiving response.conversations. Causes a TypeScript issue.
Reproduction Steps
- Produce a TS schema with:
npx [email protected] https://raw.githubusercontent.com/intercom/Intercom-OpenAPI/main/descriptions/2.11/api.intercom.io.yaml -o ./src/types.d.ts- Create a client with:
import createFetchClient from 'openapi-fetch';
import type { paths } from './types';
const client = createFetchClient<paths>({
baseUrl: 'https://api.intercom.io',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`,
'Intercom-Version': '2.11',
},
});- Get the conversations with:
const conversations = await intercom.GET('/conversations');- Use the provided schema:
console.log(conversations.data.data);- Realize that
conversations.data.datais undefined 😂
Metadata
Metadata
Assignees
Labels
No labels