OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Java] [okhttp-gson] Allow overriding tokenUrl in ApiClient constructor

Aperta
#22,167 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Enhancement: Feature
Lingua principale
Java
Stelle
26.8k
Fork
7.7k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Is your feature request related to a problem? Please describe.

I have an openapi spec with a security section like:

  securitySchemes:
    mySecurityScheme:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://example.com/token

I want to override tokenUrl at runtime. Currently the generated ApiClient class does not have a constructor or setter to allow overriding this value.

Describe the solution you'd like

A new ApiClient constructor that allows specifying tokenUrl.

The closest existing constructor is:

public ApiClient(String basePath, String clientId, String clientSecret, Map<String, String> parameters)

We could have a new constructor with this signature:

public ApiClient(String basePath, String clientId, String clientSecret, String tokenUrl, Map<String, String> parameters)

(could possibly use URI instead of String for tokenUrl).

Describe alternatives you've considered

My current workaround is to extend ApiClient and create the new constructor in the subclass.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Iniziare individuando l’ApiClient Java okhttp-gson generato e il relativo costruttore esistente con basePath, clientId, clientSecret e parameters. Aggiungere il percorso del costruttore richiesto in modo che tokenUrl possa essere fornito a runtime, quindi verificare che i client generati accettino il valore preservando il comportamento del costruttore esistente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.