Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Schema Inaccuracy] GET /conversations schema is inaccurate #166

Open
haydenbleasel opened this issue Aug 20, 2024 · 1 comment
Open

[Schema Inaccuracy] GET /conversations schema is inaccurate #166

haydenbleasel opened this issue Aug 20, 2024 · 1 comment

Comments

@haydenbleasel
Copy link

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

  1. 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
  1. 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',
    },
});
  1. Get the conversations with:
const conversations = await intercom.GET('/conversations');
  1. Use the provided schema:
console.log(conversations.data.data);
  1. Realize that conversations.data.data is undefined 😂
@Eclairemoy
Copy link
Contributor

thanks Hayden we will take a look

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

No branches or pull requests

2 participants