loopbackio / loopbackio/loopback-next
Make `@model` decorator produce JSON Schema
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.