diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 50d951d..db563d9 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,9 +1,13 @@
- Morgan Stanley
+ 2.0.0
+
+ Morgan Stanley
Morgan Stanley
Copyright 2023 Morgan Stanley
Apache-2.0
en-US
+ https://github.com/finos/fdc3-dotnet
+ FDC3
\ No newline at end of file
diff --git a/src/Fdc3.AppDirectory/Finos.Fdc3.AppDirectory.csproj b/src/Fdc3.AppDirectory/Finos.Fdc3.AppDirectory.csproj
index 51d8274..e3e906f 100644
--- a/src/Fdc3.AppDirectory/Finos.Fdc3.AppDirectory.csproj
+++ b/src/Fdc3.AppDirectory/Finos.Fdc3.AppDirectory.csproj
@@ -3,18 +3,14 @@
Finos.Fdc3.AppDirectory
Finos.Fdc3.AppDirectory
- 2.0.0
- beta.1
- .NET FDC3 Newtonsoft JSON
+ .NET FDC3 AppDirectory
true
..\keypair.snk
README.md
netstandard2.0
enable
8.0
- https://github.com/finos/fdc3-dotnet
.NET Standard 2.0 declarations to implement FDC3 AppDirectory.
- FDC3
diff --git a/src/Fdc3.Json/Finos.Fdc3.Json.csproj b/src/Fdc3.Json/Finos.Fdc3.Json.csproj
index 16c0bf1..574b003 100644
--- a/src/Fdc3.Json/Finos.Fdc3.Json.csproj
+++ b/src/Fdc3.Json/Finos.Fdc3.Json.csproj
@@ -3,8 +3,6 @@
Finos.Fdc3.Json
Finos.Fdc3.Json
- 2.0.0
- beta.1
.NET FDC3 System.Text JSON
true
..\keypair.snk
@@ -12,9 +10,7 @@
netstandard2.0
enable
8.0
- https://github.com/finos/fdc3-dotnet
.NET Standard 2.0 FDC3 JSON helpers based on System.Text.Json for use with Finos.Fdc3.
- FDC3
diff --git a/src/Fdc3.Json/Serialization/Fdc3JsonSerializerOptions.cs b/src/Fdc3.Json/Serialization/Fdc3JsonSerializerOptions.cs
index c2a22e2..262d9d9 100644
--- a/src/Fdc3.Json/Serialization/Fdc3JsonSerializerOptions.cs
+++ b/src/Fdc3.Json/Serialization/Fdc3JsonSerializerOptions.cs
@@ -20,17 +20,21 @@ namespace Finos.Fdc3.Json.Serialization
public static class Fdc3JsonSerializerOptions
{
public static JsonSerializerOptions Create()
+ {
+ var options = CreateWithoutConverters();
+ options.Converters.Add(new JsonStringEnumConverter(new Fdc3CamelCaseNamingPolicy()));
+ options.Converters.Add(new Fdc3AppConverter());
+ options.Converters.Add(new RecipientJsonConverter());
+ options.Converters.Add(new IntentsConverter());
+ return options;
+ }
+
+ internal static JsonSerializerOptions CreateWithoutConverters()
{
return new JsonSerializerOptions
{
ReferenceHandler = ReferenceHandler.IgnoreCycles,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
- Converters =
- {
- new JsonStringEnumConverter(new Fdc3CamelCaseNamingPolicy()),
- new Fdc3AppConverter(),
- new RecipientJsonConverter()
- },
PropertyNamingPolicy = new Fdc3CamelCaseNamingPolicy()
};
}
diff --git a/src/Fdc3.Json/Serialization/IntentsConverter.cs b/src/Fdc3.Json/Serialization/IntentsConverter.cs
new file mode 100644
index 0000000..cd0e7f6
--- /dev/null
+++ b/src/Fdc3.Json/Serialization/IntentsConverter.cs
@@ -0,0 +1,43 @@
+/*
+ * Morgan Stanley makes this available to you under the Apache License,
+ * Version 2.0 (the "License"). You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * See the NOTICE file distributed with this work for additional information
+ * regarding copyright ownership. Unless required by applicable law or agreed
+ * to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+using Finos.Fdc3.AppDirectory;
+using System;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace Finos.Fdc3.Json.Serialization
+{
+ public class IntentsConverter : JsonConverter
+ {
+ public override Intents? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+ {
+ var result = JsonSerializer.Deserialize(ref reader, Fdc3JsonSerializerOptions.CreateWithoutConverters());
+ if (result?.ListensFor != null)
+ {
+ foreach (var intentName in result.ListensFor.Keys)
+ {
+ result.ListensFor[intentName].Name = intentName;
+ }
+ }
+
+ return result;
+ }
+
+ public override void Write(Utf8JsonWriter writer, Intents value, JsonSerializerOptions options)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Fdc3.NewtonsoftJson/Finos.Fdc3.NewtonsoftJson.csproj b/src/Fdc3.NewtonsoftJson/Finos.Fdc3.NewtonsoftJson.csproj
index 2baac3d..6aa776c 100644
--- a/src/Fdc3.NewtonsoftJson/Finos.Fdc3.NewtonsoftJson.csproj
+++ b/src/Fdc3.NewtonsoftJson/Finos.Fdc3.NewtonsoftJson.csproj
@@ -3,8 +3,6 @@
Finos.Fdc3.NewtonsoftJson
Finos.Fdc3.NewtonsoftJson
- 2.0.0
- beta.1
.NET FDC3 Newtonsoft JSON
true
..\keypair.snk
@@ -12,9 +10,7 @@
netstandard2.0
enable
8.0
- https://github.com/finos/fdc3-dotnet
.NET Standard 2.0 FDC3 JSON helpers based on Newtonsoft.Json for use with Finos.Fdc3.
- FDC3
diff --git a/src/Fdc3.NewtonsoftJson/Serialization/Fdc3JsonSerializerSettings.cs b/src/Fdc3.NewtonsoftJson/Serialization/Fdc3JsonSerializerSettings.cs
index 497223b..e821a34 100644
--- a/src/Fdc3.NewtonsoftJson/Serialization/Fdc3JsonSerializerSettings.cs
+++ b/src/Fdc3.NewtonsoftJson/Serialization/Fdc3JsonSerializerSettings.cs
@@ -30,7 +30,13 @@ public Fdc3JsonSerializerSettings()
{
NamingStrategy = new Fdc3CamelCaseNamingStrategy()
};
- this.Converters = new JsonConverter[] { new StringEnumConverter(new CamelCaseNamingStrategy()), new RecipientJsonConverter(), new Fdc3AppConverter() };
+ this.Converters = new JsonConverter[]
+ {
+ new StringEnumConverter(new CamelCaseNamingStrategy()),
+ new RecipientJsonConverter(),
+ new Fdc3AppConverter(),
+ new IntentsConverter()
+ };
}
}
}
\ No newline at end of file
diff --git a/src/Fdc3.NewtonsoftJson/Serialization/IntentsConverter.cs b/src/Fdc3.NewtonsoftJson/Serialization/IntentsConverter.cs
new file mode 100644
index 0000000..1c28e81
--- /dev/null
+++ b/src/Fdc3.NewtonsoftJson/Serialization/IntentsConverter.cs
@@ -0,0 +1,52 @@
+/*
+ * Morgan Stanley makes this available to you under the Apache License,
+ * Version 2.0 (the "License"). You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * See the NOTICE file distributed with this work for additional information
+ * regarding copyright ownership. Unless required by applicable law or agreed
+ * to in writing, software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+using Finos.Fdc3.AppDirectory;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+
+namespace Finos.Fdc3.NewtonsoftJson.Serialization
+{
+ public class IntentsConverter : JsonConverter
+ {
+ public override bool CanWrite => false;
+
+ public override Intents? ReadJson(JsonReader reader, Type objectType, Intents? existingValue, bool hasExistingValue, JsonSerializer serializer)
+ {
+ if (reader.TokenType == JsonToken.Null)
+ {
+ return null;
+ }
+
+ var obj = JObject.Load(reader);
+ var result = obj.ToObject(typeof(Intents)) as Intents;
+
+ if (result?.ListensFor != null)
+ {
+ foreach (var intentName in result.ListensFor.Keys)
+ {
+ result.ListensFor[intentName].Name = intentName;
+ }
+ }
+
+ return result;
+ }
+
+ public override void WriteJson(JsonWriter writer, Intents? value, JsonSerializer serializer)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Fdc3/Finos.Fdc3.csproj b/src/Fdc3/Finos.Fdc3.csproj
index c5e0642..1117acc 100644
--- a/src/Fdc3/Finos.Fdc3.csproj
+++ b/src/Fdc3/Finos.Fdc3.csproj
@@ -3,8 +3,6 @@
Finos.Fdc3
Finos.Fdc3
- 2.0.0
- beta.1
.NET FDC3
true
..\keypair.snk
@@ -12,9 +10,7 @@
netstandard2.0
enable
8.0
- https://github.com/Finos/fdc3-dotnet
.NET Standard 2.0 declarations to implement concrete FDC3 compatible .NET desktop agents and usage of intents/contexts.
- FDC3
diff --git a/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs b/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs
index 513aa54..ef6453d 100644
--- a/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs
+++ b/src/Tests/Finos.Fdc3.AppDirectory.Tests/DeserializationTest.cs
@@ -54,6 +54,8 @@ protected void ValidateApp(Fdc3App app)
Assert.Contains("fdc3.instrument", app.Interop!.Intents!.ListensFor!["myApp.GetPrice"].Contexts!);
Assert.Equal("Get Price", app.Interop!.Intents!.ListensFor!["myApp.GetPrice"].DisplayName);
Assert.Equal("myApp.quote", app.Interop!.Intents!.ListensFor!["myApp.GetPrice"].ResultType);
+ Assert.Equal("ViewChart", app.Interop!.Intents!.ListensFor!["ViewChart"].Name);
+ Assert.Equal("myApp.GetPrice", app.Interop!.Intents!.ListensFor!["myApp.GetPrice"].Name);
Assert.Contains("ViewOrders", app.Interop.Intents.Raises!.Keys);
Assert.Contains("fdc3.instrument", app.Interop.Intents.Raises!["ViewOrders"]);
Assert.Contains("StartEmail", app.Interop.Intents.Raises.Keys);
diff --git a/src/Tests/Finos.Fdc3.AppDirectory.Tests/Finos.Fdc3.AppDirectory.Tests.csproj b/src/Tests/Finos.Fdc3.AppDirectory.Tests/Finos.Fdc3.AppDirectory.Tests.csproj
index eeb5b63..ed7fde0 100644
--- a/src/Tests/Finos.Fdc3.AppDirectory.Tests/Finos.Fdc3.AppDirectory.Tests.csproj
+++ b/src/Tests/Finos.Fdc3.AppDirectory.Tests/Finos.Fdc3.AppDirectory.Tests.csproj
@@ -25,7 +25,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Finos.Fdc3.NewtonsoftJson.Tests.csproj b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Finos.Fdc3.NewtonsoftJson.Tests.csproj
index 8a2685d..d689ba5 100644
--- a/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Finos.Fdc3.NewtonsoftJson.Tests.csproj
+++ b/src/Tests/Finos.Fdc3.NewtonsoftJson.Tests/Finos.Fdc3.NewtonsoftJson.Tests.csproj
@@ -27,7 +27,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/src/Tests/Finos.Fdc3.SystemTextJson.Tests/Finos.Fdc3.SystemTextJson.Tests.csproj b/src/Tests/Finos.Fdc3.SystemTextJson.Tests/Finos.Fdc3.SystemTextJson.Tests.csproj
index 6991950..268df6b 100644
--- a/src/Tests/Finos.Fdc3.SystemTextJson.Tests/Finos.Fdc3.SystemTextJson.Tests.csproj
+++ b/src/Tests/Finos.Fdc3.SystemTextJson.Tests/Finos.Fdc3.SystemTextJson.Tests.csproj
@@ -15,13 +15,13 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/src/Tests/Finos.Fdc3.Tests/Finos.Fdc3.Tests.csproj b/src/Tests/Finos.Fdc3.Tests/Finos.Fdc3.Tests.csproj
index 44aa953..d21390b 100644
--- a/src/Tests/Finos.Fdc3.Tests/Finos.Fdc3.Tests.csproj
+++ b/src/Tests/Finos.Fdc3.Tests/Finos.Fdc3.Tests.csproj
@@ -15,7 +15,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all