OpenAPITools / OpenAPITools/openapi-generator

[BUG] [Dart] Documentation for auth uses defaultApiClient.getAuthentication<ApiKeyAuth> but no such methods exists

Open
#12,374 3 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

See: https://github.com/OpenAPITools/openapi-generator/blob/df05e6f4bc6265ba4de801ba306f75dd7278e119/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md

import 'package:openapi/api.dart';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';

But the ApiClient class has no such method. Here are the available methods on the object:

invokeAPI()
addDefaultHeader()
deserializeAsync()
serializeAsync()
deserialize()
serialize()

There's a .authentication object but the interface only has a single void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams); function.

Consequently, I don't know what the canonical way to do auth, and specifically Cookie Auth is.

openapi-generator version

commit 559a2618dfe62dc8b86d0eb169bb4d998774a21f, Sunday May 15 2022

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated sample file samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md and compare its authentication example with the Dart ApiClient methods and authentication interface described in the issue. Trace how Cookie Auth is represented in the generated client, then update the documentation so it uses available APIs and states the canonical authentication setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, openapi
Domain
api, authentication, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.