Skip to content

basically all response record keys are optional (possibly undefined) #31

@kwypchlo

Description

@kwypchlo

Hey! I have an internal integration of coingecko api in my company code and I wanted to migrate our api calls to use this sdk but it does seem like all of the records keys from the response types are optional, and while it's probably safe to assume a lot of keys are optional, some of them do not make sense to be optional ie:

export interface CoinGetIDResponse {
  /**
   * coin ID
   */
  id?: string;
...

Other example below. I don't get how id, name or symbol can be optional here.

export type ListGetResponse = Array<ListGetResponse.ListGetResponseItem>;

export namespace ListGetResponse {
  export interface ListGetResponseItem {
    /**
     * coin ID
     */
    id?: string;

    /**
     * coin name
     */
    name?: string;

    /**
     * coin asset platform and contract address
     */
    platforms?: { [key: string]: string };

    /**
     * coin symbol
     */
    symbol?: string;
  }
}

If there is no concept of required fields it makes the client code that much more complicated if we even need to check if the id exists on the coin in the response. If there is anything I can do to help out lmk but I took a look at the code and those types seem to be autogenerated so they will need to be fixed in the api source code probably.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions