loopbackio / loopbackio/loopback-next

bug: ajv example validation

Offen
#9,308 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
TypeScript
Sterne
5.1k
Forks
1.1k
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
27

Beschreibung

Describe the bug

Steps to reproduce

    git clone https://github.com/mosoriob/loopback-next.git
   cd loopback-next/
   cd sandbox/validation-ajv
    npm install
    npm test

Current Behavior

The test fail with error:

Request POST /pets failed with status code 500. Error: strict mode: unknown keyword: "example"

Link to reproduction sandbox

https://github.com/mosoriob/loopback-next.git

More details

The API was generated using lb4 openapi

$ lb4 openapi pet.yaml
Loading pet.yaml...
? Select controllers and/or service proxies to be generated: OpenApiController
   create src/models/pet.model.ts
   create src/models/new-pet.model.ts
   create src/models/error.model.ts
   create src/controllers/open-api.controller.ts
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

added 38 packages, and audited 609 packages in 10s

80 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Logs

No response

Additional information

Similar to: https://github.com/loopbackio/loopback-next/issues/4939

Reproduction

https://github.com/mosoriob/loopback-next.git

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in der Reproduktion sandbox/validation-ajv und führe npm install gefolgt von npm test aus, um den strict-mode-Fehler für das example-Schlüsselwort zu bestätigen. Verfolge die von lb4 openapi generierte API und ermittle, warum die Validierung dieses Schlüsselwort ablehnt; als erledigt gilt die Aufgabe, wenn der Reproduktionstest nicht mehr mit dem unknown-keyword-Fehler fehlschlägt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
nodejs, openapi, typescript
Bereich
api, backend, testing
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.