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

Swagger 2.20.3 and other versions do not have proper CodeGen models for API responses #1300

Open
ranilian opened this issue Jul 31, 2024 · 0 comments

Comments

@ranilian
Copy link

When you download the Client SDK for typescript-fetch and attempt to use it in a standard application, the API responses' models don't match to the fetch requests being made primarily due to case issues:

For example this code expects the Endpoint response to include "id" but the server returns "Id"

const endpointsClient = new EndpointsApi(
  {
    apiKey: Config.PORTAINER_API_KEY,
  },
  Config.PORTAINER_URL + "/api",
  fetch
);
const environmentName = `${currentUser.username}/${new Date().toISOString()}`;
const environment = await endpointsClient.endpointCreate(
    environmentName,
    4,
    "",
    Config.PORTAINER_URL
  );
console.log(environment.id); // => returns undefined
console.log(environment.Id); // => returns the correct value if updated in the model otherwise this throws a Property 'Id' does not exist on type 'PortainerEndpoint'. Did you mean 'id'?

I believe something is wrong in the CodeGen output or I am using Swagger incorrectly.

Thank you!

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

1 participant