Skip to content

Commit a7d5d15

Browse files
committed
Added schema dictionary documentation to GUIDE.md
1 parent d205770 commit a7d5d15

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

GUIDE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public override string name {
2525
}
2626
```
2727

28+
Don't worry about the schemas error. We'll deal with that later.'
29+
2830
## Parameters in Plugs
2931

3032
Parameters are passed to functions in plugs with *schemas*. A schema is a class with
@@ -59,6 +61,27 @@ public class AddSchema{
5961
}
6062
```
6163

64+
## Defining the Schemas
65+
66+
Once you have functions and the schemas they need, you must declare a Dictionary<string, Type> property to tell PlugPlex about the schemas.
67+
Each entry in the dictionary sould have a `string` key representing the name of a function, and a `Type` value representing the `typeof` the schema the
68+
function takes as a parameter. For example, a schema dictionary for the `Print` and `Add` functions above would look like this:
69+
70+
```C#
71+
public Dictionary<string, Type> schemas {
72+
get {
73+
Dictionary<string, Type> _schemas
74+
75+
_schemas.Add("Print", typeof(PrintSchema));
76+
_schemas.Add("Add", typeof(AddSchema));
77+
78+
return _schemas;
79+
}
80+
}
81+
```
82+
83+
You must declare the schemas for every function you intend to call from javascript.
84+
6285
## Using the Plug
6386

6487
To use your plug, build the project and copy the DLL into the PlugPlex `Plugs` folder.

0 commit comments

Comments
 (0)