这是indexloc提供的服务,不要输入任何密码
Skip to content

Add experimental client #179

@mrlubos

Description

@mrlubos

Add a new flag for experimental clients.

/** @type {import('@hey-api/openapi-ts').UserConfig} */
module.exports = {
  experimental: true,
  input: 'path/to/openapi.json',
  output: 'src/client',
}

This client will work towards simplification of the API. For example, instead of

DefaultsService.callToTestOrderOfParams({
  parameterStringWithNoDefault: ''
})

we will generate types like

DefaultsService.callToTestOrderOfParams({
  query: {
    parameterStringWithNoDefault: ''
  }
})

so they can be passed directly

public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise<void> {
  const { query } = data;
  return __request(OpenAPI, {
    method: 'PUT',
    url: '/api/v{api-version}/defaults',
    query: {
      parameterOptionalStringWithDefault: 'Hello World!',
      parameterOptionalStringWithEmptyDefault: '',
      parameterStringNullableWithDefault: null,
      parameterStringWithDefault: 'Hello World!',
      parameterStringWithEmptyDefault: '',
      ...query
    }
  })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions