[Go] OAuth client credentials: an optional enum grant_type in the token request makes the SDK fail to compile
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go, openapi, typescript
- Ambito
- build-system, devtools
Direzione di ricerca
Start in generators/go-v2/sdk/src/client/ClientGenerator.ts near the reported line 902 and trace how optional enum grant_type values are emitted. Use the OpenAPI repro and run fern generate --local --group go --force, then go build ./... in the generated SDK. Done when the generated request uses the enum pointer value and the Go SDK builds.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The following is AI-written (Claude Opus 5.5). It found this in charter's conformance projects, reduced it to the repro below, and checked it on the versions named.
Component
SDK generation (OAuth client credentials)
SDK Language(s)
Go
Versions
- Fern CLI 5.158.0,
fern generate --local - fernapi/fern-go-sdk 1.70.5 (the newest today)
- Go 1.27.1
Repro
fern/fern.config.json
{ "organization": "repro", "version": "5.158.0" }
fern/openapi.yml
openapi: 3.1.0
info: { title: Repro, version: 1.0.0 }
servers: [{ url: https://api.example.com }]
components:
securitySchemes:
OAuth:
type: oauth2
flows:
clientCredentials:
tokenUrl: /oauth/token
scopes: {}
paths:
/oauth/token:
post:
operationId: getToken
tags: [auth]
security: []
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
grant_type: { type: string, enum: [client_credentials] }
client_id: { type: string }
client_secret: { type: string }
responses:
"200":
description: token
content:
application/json:
schema:
type: object
required: [access_token, expires_in]
properties:
access_token: { type: string }
expires_in: { type: integer }
/ping:
get:
operationId: ping
security: [{ OAuth: [] }]
responses:
"200":
description: ok
content:
application/json:
schema: { type: string }
fern/generators.yml
api:
specs:
- openapi: openapi.yml
auth-schemes:
OAuth:
scheme: oauth
type: client-credentials
get-token:
endpoint: "POST /oauth/token"
request-properties:
client-id: $request.client_id
client-secret: $request.client_secret
response-properties:
access-token: $response.access_token
expires-in: $response.expires_in
auth: OAuth
groups:
go:
generators:
- name: fernapi/fern-go-sdk
version: 1.70.5
output:
location: local-file-system
path: ../sdk/go
config:
module:
path: example.com/repro
version: "1.22"
packageName: repro
Command
fern generate --local --group go --force
cd sdk/go && go build ./...
Output
# example.com/repro/client
client/client.go:43:16: cannot use repro.String("client_credentials") (value of type *string) as *repro.GetTokenRequestGrantType value in struct literal
The generated token request in client/client.go:
GrantType: repro.String(
"client_credentials",
),
The field is GrantType *GetTokenRequestGrantType, and GetTokenRequestGrantTypeClientCredentials is generated.
Expected
The SDK compiles, for example with GrantType: repro.GetTokenRequestGrantTypeClientCredentials.Ptr().
Notes
- With
grant_type: { type: string }the same spec passesgo buildandgo vet. - With
required: [grant_type]and the enum kept, it compiles (GrantType: "client_credentials"). - On
main,generators/go-v2/sdk/src/client/ClientGenerator.ts(around line 902, added in #17076) writes<pkg>.String("client_credentials")for every pointergrant_typethat is not a literal, enum or not.
How charter works around it: grant_type is an optional plain string, and its server refuses any other grant with a 400.
- Lingua principale
- TypeScript
- Stelle
- 3.8k
- Fork
- 376
- Merge medio
- 9h 15m
- PR unite (30g)
- 171
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fern-api/fern
-
[typescript] BasicAuth.fromAuthorizationHeader accepts headers without the Basic scheme prefixAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
component:cli priority:p2-medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[Python] Naive datetimes are serialized with today's UTC offset, so values across a DST change are sent one hour offForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertacomponent:sdks lang:python
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
component:cli lang:python priority:p2-medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di fern-api/fern
Issue simili
-
Resources: Update work of fuzhouForse già presa @rmt-svc l’ha presa oggi. Apertaresources
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
railmapgen/rmp-gallery#4245 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
mike-north/AgentMonitors#717 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 60/100
slavakurilyak/awesome-ai-agents#1100 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
navikt/syfo-oppfolgingsplan-frontend#1206 ·
I maintainer di solito rispondono entro 1 giorno
-
The SIGKILL escalation test passes without escalation when its child starts later than 100 msApertabug:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
callstackincubator/simlock#1986 ·
I maintainer di solito rispondono entro 1 giorno