-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Story
As a LB4 dev, I want my TypeScript classes to be automatically converted into JSON Schema so that I have a metadata representation of my classes that I can freely convert into other formats (OpenAPI schema, other classes in other languages, etc)
Cross-posting from #700:
In our Todo model example, we are duplicating information about model properties - first time in Model definition, second time in Swagger (OpenAPI) Schema.
We should have a helper function that can create Swagger/OpenAPI Schema from the Model data.
Acceptance Criteria
- Create a metadata type system (yikes!) that leverages the existing decorator names (
@model,@property) - For
@property:- Introspect the type of the property, either as a primitive type, or otherwise
- For complex types, mark with
$ref(we can dereference this later)
- For complex types, mark with
- Introspect the type of the property, either as a primitive type, or otherwise
- For
@model:- Add top-level specific metadata to the entry for this type:
- description
- title
- required
oneOf (it's a union type!)not supported by current juggler implementation
- Add top-level specific metadata to the entry for this type:
- Write a blog post about how awesome this will be
(unless it's not, then don't ;) ) - Document on loopback.io