loopbackio / loopbackio/loopback-next

Make `@model` decorator produce JSON Schema

Aperta
#962 11 commenti 0 reazioni 2 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Juggler needs discussion Schema
Lingua principale
TypeScript
Stelle
5.1k
Fork
1.1k
Merge medio
2g 21h
PR unite (30g)
27

Descrizione

Thread to discuss on possibly switching the metadata that @model produces to JSON Schema or anything else. Thoughts @raymondfeng @bajtos @strongloop/sq-lb-apex ?

As the name of repository-json-schema suggests, @model and @property are intrinsically linked to @loopback/repository, but we're also using those decorators for creating JSON Schemas when that has nothing to do with the legacy juggler. This could potentially create a dependency cycle (for example, repository-json-schema -> repository -> new juggler (which may potentially leverage) -> repository-json-schema), so the two concepts should be separated. Ideally, JSON Schema being produced by repository-json-schema should be the baseline from which the juggler definition is being created from, on top of any additional metadata given.

I'd propose that we create in a separate package 'private' decorators intended to be used in @model and @property that would solely be used to harvest JSON Schema related metadata, which then can be used 'enhance' our generated juggler definition. This way, future extensions would only need to leverage the key to which JSON Schema metadata is stored under with none of the juggler-exclusive concepts.

Acceptance criteria will be further fleshed out based on the feedback of the current proposal.

Acceptance Criteria

  • Investigate the feasibility of building a model definition from a given JSON Schema
    • What kind of JSON Schema can be given from information purely from the TypeScript compiler?
    • What kind of additional metadata need to be manually given to the decorator in order to build the model def?

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.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.