Skip to content

Missing methods with nested operation ID's with class SDKs #2435

@opswiz

Description

@opswiz

Description

When there are two operation Id like this

"operationId": "providers.list",
and
"operationId": "tenants.providers.list",

the output is generated like this. The later, tenants.providers.list is never generated. They both are different operation IDs, the later providers belongs to tenant, which is not the providers outside.

This works fine without class sdks

// This file is auto-generated by @hey-api/openapi-ts

import type { Options as ClientOptions, TDataShape, Client } from './client';
import type { ProvidersListData, ProvidersListResponses, ProvidersListErrors } from './types.gen';
import { zProvidersListData, zProvidersListResponse } from './zod.gen';
import { providersListResponseTransformer } from './transformers.gen';
import { client as _heyApiClient } from './client.gen';

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
  TData,
  ThrowOnError
> & {
  /**
   * You can provide a client instance returned by `createClient()` instead of
   * individual options. This might be also useful if you want to implement a
   * custom client.
   */
  client?: Client;
  /**
   * You can pass arbitrary values through the `meta` object. This can be
   * used to access values that aren't defined as part of the SDK function.
   */
  meta?: Record<string, unknown>;
};

export class Providers {
  /**
   * List Providers
   */
  public static list<ThrowOnError extends boolean = false>(options?: Options<ProvidersListData, ThrowOnError>) {
    return (options?.client ?? _heyApiClient).get<ProvidersListResponses, ProvidersListErrors, ThrowOnError>({
      requestValidator: async (data) => {
        return await zProvidersListData.parseAsync(data);
      },
      responseTransformer: providersListResponseTransformer,
      responseValidator: async (data) => {
        return await zProvidersListResponse.parseAsync(data);
      },
      security: [
        {
          scheme: 'bearer',
          type: 'http',
        },
      ],
      url: '/v1/providers',
      ...options,
    });
  }
}

export class Tenants {
  static providers = Providers;
}

export class TenantProviders {
  static tenants = Tenants;
}

Reproducible example or configuration

https://stackblitz.com/edit/hey-api-client-fetch-example-e6ryjs6n

OpenAPI specification (optional)

{
  "openapi": "3.1.1",
  "paths": {
    "/v1/providers": {
      "get": {
        "operationId": "providers.list",
        "summary": "List Providers",
        "tags": [
          "providers"
        ]
      }
    },
    "/v1/tenants/{tenantId}/providers": {
      "get": {
        "operationId": "tenants.providers.list",
        "summary": "List Tenant Providers",
        "tags": [
          "tenants",
          "tenantProviders"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Tenant ID"
            }
          }
        ]
      }
    }
  }
}

System information (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Something isn't workingjavascriptPull requests that update Javascript code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions