Skip to content
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

Merged
merged 1 commit into from
Jan 30, 2018
Merged

json-schema metadata #592

merged 1 commit into from
Jan 30, 2018

Conversation

shimks
Copy link
Contributor

@shimks shimks commented Jan 30, 2018

@shimks shimks requested a review from bschrammIBM as a code owner January 30, 2018 19:40
@shimks shimks force-pushed the json-schema-docs branch 2 times, most recently from 661fa2f to dc55cc8 Compare January 30, 2018 19:43
Copy link
Contributor

@b-admike b-admike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -144,6 +144,76 @@ class Customer extends Entity {
}
```

### JSON Schema inferrence
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sp) inference

| 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 |

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.

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One additional edit needed.

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.

Copy link
Contributor

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.

@@ -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.
Copy link
Contributor

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.

@bschrammIBM bschrammIBM merged commit 5d53512 into gh-pages Jan 30, 2018
@kjdelisle kjdelisle deleted the json-schema-docs branch January 30, 2018 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants