Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

queues subscriptions create: schema types 'events' as string but API requires an array of strings

Aperta
#181 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
64/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
api, cli

Direzione di ricerca

Start at the queues subscriptions create command and inspect how the events request-body field is represented by cf schema and --help. Verify the API accepts an array of strings, then trace the validation or discovery path for event values. Done means the schema reports array items as strings and the CLI gives accurate guidance for the accepted bare event suffix.

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

Descrizione

upstream

cf schema queues subscriptions create types the events request-body field as string, but the API requires an array of strings. The description says "List of event types", so the schema contradicts itself, and the resulting failure surfaces as a generic validation error.

Version: cf v1.0.0-beta.10

Actual

$ cf schema queues subscriptions create | jq '.requestBodyFields[] | select(.name=="events")'
{
  "name": "events",
  "type": "string",
  "required": false,
  "description": "List of event types this subscription handles"
}

type is string while description says list. Passing an array of objects fails:

$ ... --body '{"source":{"type":"artifacts.repo",...},"events":[{"type":"cf.artifacts.repo.pushed"}],...}'
┌ APIError
│ [error] Validation error: Expected string, received object at "events[0]"
│ 400 Bad Request

Passing an array of strings is accepted:

$ ... --body '{...,"events":["pushed"],...}'
{ "id": "ecc4290d1c9b49909c24f49f58bb4373", ... }

Note the --events option help already renders as [array], so the flag and the schema disagree with each other as well as with the API.

Expected

"type": "array" with an items type of string, so cf schema — documented as the way to inspect the request a command sends — describes the request accurately.

Second, separate discovery problem in the same field

The Artifacts docs specify fully-qualified event types such as cf.artifacts.repo.pushed. The API rejects those and accepts only the bare suffix:

$ ... --body '{...,"events":["cf.artifacts.repo.pushed"],...}'
┌ APIError
│ [error] Validation error: Unrecognized event types for source type at "events"
$ ... --body '{...,"events":["pushed"],...}'
{ "id": "ecc4290d1c9b49909c24f49f58bb4373", ... }

There is no hint in the error listing the event types valid for the chosen source, so the valid value is only discoverable by bisection against the API. It would help if the error enumerated the accepted values, or if cf schema/--help documented the bare form for Artifacts.

Related: --source-type has no artifacts entry, reported separately.

Lingua principale
TypeScript
Stelle
960
Fork
62
Merge medio
23h 46m
PR unite (30g)
217

Preparare l'ambiente

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.

Altre issue di cloudflare/cf

Tutte le issue di cloudflare/cf

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.