|
@@ -14,7 +14,7 @@ In order to make this documentation as clear as possible it is important to make
|
|
|
In order to intialize the content directory on a development chain based on data that is provided in form of json files inside `/inputs` directory (`classes`, `schemas` and example entities - `entityBatches`), we can run:
|
|
|
|
|
|
```
|
|
|
-yarn workspace cd-schemas initialize:dev
|
|
|
+yarn workspace @joystream/cd-schemas initialize:dev
|
|
|
```
|
|
|
|
|
|
This will handle:
|
|
@@ -51,7 +51,7 @@ For more context, see: https://code.visualstudio.com/docs/languages/json
|
|
|
|
|
|
### Validate inputs and `json-schemas` via a command
|
|
|
|
|
|
-All inputs inside `inputs` directory and `json-schemas` used to validate those inputs can also be validated using `yarn workspace cd-schemas validate` command. This is mainly to facilitate checking the validity of `.json` and `.schema.json` files inside `content-directory-schemas` through CI.
|
|
|
+All inputs inside `inputs` directory and `json-schemas` used to validate those inputs can also be validated using `yarn workspace @joystream/cd-schemas validate` command. This is mainly to facilitate checking the validity of `.json` and `.schema.json` files inside `content-directory-schemas` through CI.
|
|
|
|
|
|
### Entity batches
|
|
|
|
|
@@ -109,7 +109,7 @@ We can do it by either using `"new"` or `"existing"` keyword.
|
|
|
There is a script that provides an easy way of converting `runtime-schemas` (based on inputs from `inputs/schemas`) to `json-schemas` (`.schema.json` files) which allow validating the input (ie. json files) describing some specific entities. It can be run with:
|
|
|
|
|
|
```
|
|
|
-yarn workspace cd-schemas generate:entity-schemas
|
|
|
+yarn workspace @joystream/cd-schemas generate:entity-schemas
|
|
|
```
|
|
|
|
|
|
Those `json-schemas` are currently mainly used for validating the inputs inside `inputs/entityBatches`.
|
|
@@ -125,7 +125,7 @@ The generated `json-schemas` include:
|
|
|
Thanks to the `json-schema-to-typescript` library, we can very simply generate Typescript interfaces based on existing `json-schemas`. This can be done via:
|
|
|
|
|
|
```
|
|
|
-yarn workspace cd-schemas generate:types
|
|
|
+yarn workspace @joystream/cd-schemas generate:types
|
|
|
```
|
|
|
|
|
|
This command will generate:
|
|
@@ -153,8 +153,8 @@ The best way to ilustrate this would be by providing some examples:
|
|
|
|
|
|
#### Creating a channel
|
|
|
```
|
|
|
- import { InputParser } from 'cd-schemas'
|
|
|
- import { ChannelEntity } from 'cd-schemas/types/entities/ChannelEntity'
|
|
|
+ import { InputParser } from '@joystream/cd-schemas'
|
|
|
+ import { ChannelEntity } from '@joystream/cd-schemas/types/entities/ChannelEntity'
|
|
|
// Other imports...
|
|
|
|
|
|
async main() {
|
|
@@ -182,12 +182,12 @@ The best way to ilustrate this would be by providing some examples:
|
|
|
.signAndSend(SENDER_KEYPAIR)
|
|
|
}
|
|
|
```
|
|
|
-_Full example with comments can be found in `content-directory-schemas/examples/createChannel.ts` and ran with `yarn workspace cd-schemas example:createChannel`_
|
|
|
+_Full example with comments can be found in `content-directory-schemas/examples/createChannel.ts` and ran with `yarn workspace @joystream/cd-schemas example:createChannel`_
|
|
|
|
|
|
#### Creating a video
|
|
|
```
|
|
|
-import { InputParser } from 'cd-schemas'
|
|
|
-import { VideoEntity } from 'cd-schemas/types/entities/VideoEntity'
|
|
|
+import { InputParser } from '@joystream/cd-schemas'
|
|
|
+import { VideoEntity } from '@joystream/cd-schemas/types/entities/VideoEntity'
|
|
|
// ...
|
|
|
|
|
|
async main() {
|
|
@@ -239,13 +239,13 @@ async main() {
|
|
|
.signAndSend(SENDER_KEYPAIR)
|
|
|
}
|
|
|
```
|
|
|
-_Full example with comments can be found in `content-directory-schemas/examples/createVideo.ts` and ran with `yarn workspace cd-schemas example:createChannel`_
|
|
|
+_Full example with comments can be found in `content-directory-schemas/examples/createVideo.ts` and ran with `yarn workspace @joystream/cd-schemas example:createChannel`_
|
|
|
|
|
|
#### Update channel title
|
|
|
|
|
|
```
|
|
|
-import { InputParser } from 'cd-schemas'
|
|
|
-import { ChannelEntity } from 'cd-schemas/types/entities/ChannelEntity'
|
|
|
+import { InputParser } from '@joystream/cd-schemas'
|
|
|
+import { ChannelEntity } from '@joystream/cd-schemas/types/entities/ChannelEntity'
|
|
|
// ...
|
|
|
|
|
|
async function main() {
|
|
@@ -266,7 +266,7 @@ async function main() {
|
|
|
.signAndSend(SENDER_KEYPAIR)
|
|
|
}
|
|
|
```
|
|
|
-_Full example with comments can be found in `content-directory-schemas/examples/updateChannelTitle.ts` and ran with `yarn workspace cd-schemas example:updateChannelTitle`_
|
|
|
+_Full example with comments can be found in `content-directory-schemas/examples/updateChannelTitle.ts` and ran with `yarn workspace @joystream/cd-schemas example:updateChannelTitle`_
|
|
|
|
|
|
Note: Updates can also inlucde `new` and `existing` keywords. In case `new` is specified inside the update - `CreateEntity` and `AddSchemaSupportToEntity` operations will be included as part of the operations returned by `InputParser.getEntityUpdateOperations`.
|
|
|
|