-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
json-schema metadata #592
json-schema metadata #592
Conversation
661fa2f
to
dc55cc8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
pages/en/lb4/Schemas.md
Outdated
@@ -144,6 +144,76 @@ class Customer extends Entity { | |||
} | |||
``` | |||
|
|||
### JSON Schema inferrence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(sp) inference
dc55cc8
to
3660dee
Compare
| description | `@model` | string | | Description of the model | | ||
| array | `@property` | boolean | | Used to specify whether the property is an array or not | | ||
| required | `@property` | boolean | | Used to specify whether the property is required or not | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add one of those decoration tags we have to this section to say that it's a work-in-progress. There are most likely other JSON schema keywords/features that we'll want to support in the future, so letting people know that it's not yet feature complete in that respect would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added edits in-line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One additional edit needed.
pages/en/lb4/Schemas.md
Outdated
In the `@loopback/repository-json-schema` module, we provide `getJsonSchema` | ||
which accesses the metadata stored by the decorators to build a matching | ||
JSON Schema of your model. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested rewording:
Use the @loopback/repository-json-schema
module to build a JSON schema from a decorated model. Type information is inferred from the @model
and @property
decorators. The @loopback/repository-json-schema
module contains the getJsonSchema
function to access the metadata stored by the decorators to build a matching JSON Schema of your model.
3660dee
to
241c83a
Compare
pages/en/lb4/Schemas.md
Outdated
@@ -144,6 +144,85 @@ class Customer extends Entity { | |||
} | |||
``` | |||
|
|||
### JSON Schema inference | |||
With type information inferred from using `@model` and `@property` decorators, | |||
we've created a module to easily build a JSON Schema from a decorated model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete the first sentence:
+With type information inferred from using @model
and @property
decorators,
+we've created a module to easily build a JSON Schema from a decorated model.
241c83a
to
64a3b7c
Compare
Docs for loopbackio/loopback-next#786