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

Client generates code that when compiled warns about unused params #2271

Open
mikaelkaron opened this issue Mar 15, 2024 · 0 comments
Open
Assignees

Comments

@mikaelkaron
Copy link
Contributor

mikaelkaron commented Mar 15, 2024

With this OpenAPI schema

"/auth/login": {
  "get": {
    "responses": {
      "200": {
        "description": "Default Response"
      }
    }
  }
}

This client is generated

const _getAuthLogin = async (url: string, request: Types.GetAuthLoginRequest): Promise<Types.GetAuthLoginResponses> => {

  const response = await fetch(`${url}/auth/login`)

  if (!response.ok) {
    throw new Error(await response.text())
  }

  return await response.text()
}

export const getAuthLogin: Api['getAuthLogin'] = async (request: Types.GetAuthLoginRequest): Promise<Types.GetAuthLoginResponses> => {
  return await _getAuthLogin(baseUrl, request)
}

When compiles a warning is generated

[ WARN  ]  TypeScript: src/openapi/api.ts:52:43
           'request' is declared but its value is never read.

     L51:  }
     L52:  const _getAuthLogin = async (url: string, request: Types.GetAuthLoginRequest): Promise<Types.GetAuthLoginResp
@mikaelkaron mikaelkaron reopened this Mar 15, 2024
@mikaelkaron mikaelkaron changed the title Client generates unused params Client generates code that when compiles warns about unused params Mar 15, 2024
@mikaelkaron mikaelkaron changed the title Client generates code that when compiles warns about unused params Client generates code that when compiled warns about unused params Mar 15, 2024
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