Skip to content

Commit 9ceeb61

Browse files
committed
feat(Serialization): Transitioned from FullSerializer to Json.net
1 parent 53e8b1e commit 9ceeb61

16 files changed

+126
-100
lines changed

Core/Utilities/SerializedDelegate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
using System;
2020
using System.Reflection;
2121
using UnityEngine;
22+
using Newtonsoft.Json;
2223

2324
namespace IBM.Cloud.SDK.Utilities
2425
{
2526
/// <summary>
2627
/// This class allows for a delegate to be serialized for a component and method
2728
/// on a given GameObject.
2829
/// </summary>
29-
[Serializable]
3030
public class SerializedDelegate
3131
{
3232
/// <summary>

Plugins/Newtonsoft.Json.dll

532 KB
Binary file not shown.

Plugins/Newtonsoft.Json.dll.meta

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Scripts/Services/ToneAnalyzer/V3/Model/DocumentAnalysis.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
using System.Collections.Generic;
19-
using FullSerializer;
19+
using Newtonsoft.Json;
2020

2121
namespace IBM.Watson.ToneAnalyzer.V3.Model
2222
{
@@ -30,23 +30,21 @@ public class DocumentAnalysis
3030
/// qualifying tone of the document. The array includes results for any tone whose score is at least 0.5. The
3131
/// array is empty if no tone has a score that meets this threshold. **`2016-05-19`:** Not returned.
3232
/// </summary>
33-
[fsProperty("tones")]
33+
[JsonProperty("tones", NullValueHandling = NullValueHandling.Ignore)]
3434
public List<ToneScore> Tones { get; set; }
3535
/// <summary>
3636
/// **`2017-09-21`:** Not returned. **`2016-05-19`:** An array of `ToneCategory` objects that provides the
3737
/// results of the tone analysis for the full document of the input content. The service returns results only
3838
/// for the tones specified with the `tones` parameter of the request.
3939
/// </summary>
40-
[fsProperty("tone_categories")]
40+
[JsonProperty("tone_categories", NullValueHandling = NullValueHandling.Ignore)]
4141
public List<ToneCategory> ToneCategories { get; set; }
4242
/// <summary>
4343
/// **`2017-09-21`:** A warning message if the overall content exceeds 128 KB or contains more than 1000
4444
/// sentences. The service analyzes only the first 1000 sentences for document-level analysis and the first 100
4545
/// sentences for sentence-level analysis. **`2016-05-19`:** Not returned.
4646
/// </summary>
47-
[fsProperty("warning")]
47+
[JsonProperty("warning", NullValueHandling = NullValueHandling.Ignore)]
4848
public string Warning { get; set; }
4949
}
50-
51-
5250
}

Scripts/Services/ToneAnalyzer/V3/Model/SentenceAnalysis.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
using System.Collections.Generic;
19-
using FullSerializer;
19+
using Newtonsoft.Json;
2020

2121
namespace IBM.Watson.ToneAnalyzer.V3.Model
2222
{
@@ -29,40 +29,38 @@ public class SentenceAnalysis
2929
/// The unique identifier of a sentence of the input content. The first sentence has ID 0, and the ID of each
3030
/// subsequent sentence is incremented by one.
3131
/// </summary>
32-
[fsProperty("sentence_id")]
32+
[JsonProperty("sentence_id", NullValueHandling = NullValueHandling.Ignore)]
3333
public long? SentenceId { get; set; }
3434
/// <summary>
3535
/// The text of the input sentence.
3636
/// </summary>
37-
[fsProperty("text")]
37+
[JsonProperty("text", NullValueHandling = NullValueHandling.Ignore)]
3838
public string Text { get; set; }
3939
/// <summary>
4040
/// **`2017-09-21`:** An array of `ToneScore` objects that provides the results of the analysis for each
4141
/// qualifying tone of the sentence. The array includes results for any tone whose score is at least 0.5. The
4242
/// array is empty if no tone has a score that meets this threshold. **`2016-05-19`:** Not returned.
4343
/// </summary>
44-
[fsProperty("tones")]
44+
[JsonProperty("tones", NullValueHandling = NullValueHandling.Ignore)]
4545
public List<ToneScore> Tones { get; set; }
4646
/// <summary>
4747
/// **`2017-09-21`:** Not returned. **`2016-05-19`:** An array of `ToneCategory` objects that provides the
4848
/// results of the tone analysis for the sentence. The service returns results only for the tones specified with
4949
/// the `tones` parameter of the request.
5050
/// </summary>
51-
[fsProperty("tone_categories")]
51+
[JsonProperty("tone_categories", NullValueHandling = NullValueHandling.Ignore)]
5252
public List<ToneCategory> ToneCategories { get; set; }
5353
/// <summary>
5454
/// **`2017-09-21`:** Not returned. **`2016-05-19`:** The offset of the first character of the sentence in the
5555
/// overall input content.
5656
/// </summary>
57-
[fsProperty("input_from")]
57+
[JsonProperty("input_from", NullValueHandling = NullValueHandling.Ignore)]
5858
public long? InputFrom { get; set; }
5959
/// <summary>
6060
/// **`2017-09-21`:** Not returned. **`2016-05-19`:** The offset of the last character of the sentence in the
6161
/// overall input content.
6262
/// </summary>
63-
[fsProperty("input_to")]
63+
[JsonProperty("input_to", NullValueHandling = NullValueHandling.Ignore)]
6464
public long? InputTo { get; set; }
6565
}
66-
67-
6866
}

Scripts/Services/ToneAnalyzer/V3/Model/ToneAnalysis.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
using System.Collections.Generic;
19-
using FullSerializer;
19+
using Newtonsoft.Json;
2020

2121
namespace IBM.Watson.ToneAnalyzer.V3.Model
2222
{
@@ -28,16 +28,14 @@ public class ToneAnalysis
2828
/// <summary>
2929
/// An object of type `DocumentAnalysis` that provides the results of the analysis for the full input document.
3030
/// </summary>
31-
[fsProperty("document_tone")]
31+
[JsonProperty("document_tone", NullValueHandling = NullValueHandling.Ignore)]
3232
public DocumentAnalysis DocumentTone { get; set; }
3333
/// <summary>
3434
/// An array of `SentenceAnalysis` objects that provides the results of the analysis for the individual
3535
/// sentences of the input content. The service returns results only for the first 100 sentences of the input.
3636
/// The field is omitted if the `sentences` parameter of the request is set to `false`.
3737
/// </summary>
38-
[fsProperty("sentences_tone")]
38+
[JsonProperty("sentences_tone", NullValueHandling = NullValueHandling.Ignore)]
3939
public List<SentenceAnalysis> SentencesTone { get; set; }
4040
}
41-
42-
4341
}

Scripts/Services/ToneAnalyzer/V3/Model/ToneCategory.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
using System.Collections.Generic;
19-
using FullSerializer;
19+
using Newtonsoft.Json;
2020

2121
namespace IBM.Watson.ToneAnalyzer.V3.Model
2222
{
@@ -28,20 +28,18 @@ public class ToneCategory
2828
/// <summary>
2929
/// An array of `ToneScore` objects that provides the results for the tones of the category.
3030
/// </summary>
31-
[fsProperty("tones")]
31+
[JsonProperty("tones", NullValueHandling = NullValueHandling.Ignore)]
3232
public List<ToneScore> Tones { get; set; }
3333
/// <summary>
3434
/// The unique, non-localized identifier of the category for the results. The service can return results for the
3535
/// following category IDs: `emotion_tone`, `language_tone`, and `social_tone`.
3636
/// </summary>
37-
[fsProperty("category_id")]
37+
[JsonProperty("category_id", NullValueHandling = NullValueHandling.Ignore)]
3838
public string CategoryId { get; set; }
3939
/// <summary>
4040
/// The user-visible, localized name of the category.
4141
/// </summary>
42-
[fsProperty("category_name")]
42+
[JsonProperty("category_name", NullValueHandling = NullValueHandling.Ignore)]
4343
public string CategoryName { get; set; }
4444
}
45-
46-
4745
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Copyright 2018, 2019 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using System.Collections.Generic;
19+
using Newtonsoft.Json;
20+
21+
namespace IBM.Watson.ToneAnalyzer.V3.Model
22+
{
23+
/// <summary>
24+
/// ToneChatInput.
25+
/// </summary>
26+
public class ToneChatInput
27+
{
28+
/// <summary>
29+
/// An array of `Utterance` objects that provides the input content that the service is to analyze.
30+
/// </summary>
31+
[JsonProperty("utterances", NullValueHandling = NullValueHandling.Ignore)]
32+
public List<Utterance> Utterances { get; set; }
33+
}
34+
}

Scripts/Services/ToneAnalyzer/V3/Model/ToneChatInput.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Scripts/Services/ToneAnalyzer/V3/Model/ToneChatScore.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*/
1717

18-
using FullSerializer;
18+
using Newtonsoft.Json;
1919

2020
namespace IBM.Watson.ToneAnalyzer.V3.Model
2121
{
@@ -66,20 +66,18 @@ public class ToneIdEnumValue
6666
/// whose scores meet a minimum threshold of 0.5.
6767
/// Constants for possible values can be found using ToneChatScore.ToneIdEnumValue
6868
/// </summary>
69-
[fsProperty("tone_id")]
69+
[JsonProperty("tone_id", NullValueHandling = NullValueHandling.Ignore)]
7070
public string ToneId { get; set; }
7171
/// <summary>
7272
/// The score for the tone in the range of 0.5 to 1. A score greater than 0.75 indicates a high likelihood that
7373
/// the tone is perceived in the utterance.
7474
/// </summary>
75-
[fsProperty("score")]
75+
[JsonProperty("score", NullValueHandling = NullValueHandling.Ignore)]
7676
public double? Score { get; set; }
7777
/// <summary>
7878
/// The user-visible, localized name of the tone.
7979
/// </summary>
80-
[fsProperty("tone_name")]
80+
[JsonProperty("tone_name", NullValueHandling = NullValueHandling.Ignore)]
8181
public string ToneName { get; set; }
8282
}
83-
84-
8583
}

Scripts/Services/ToneAnalyzer/V3/Model/ToneInput.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*/
1717

18-
using FullSerializer;
18+
using Newtonsoft.Json;
1919

2020
namespace IBM.Watson.ToneAnalyzer.V3.Model
2121
{
@@ -27,9 +27,7 @@ public class ToneInput
2727
/// <summary>
2828
/// The input content that the service is to analyze.
2929
/// </summary>
30-
[fsProperty("text")]
30+
[JsonProperty("text", NullValueHandling = NullValueHandling.Ignore)]
3131
public string Text { get; set; }
3232
}
33-
34-
3533
}

Scripts/Services/ToneAnalyzer/V3/Model/ToneScore.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*/
1717

18-
using FullSerializer;
18+
using Newtonsoft.Json;
1919

2020
namespace IBM.Watson.ToneAnalyzer.V3.Model
2121
{
@@ -32,7 +32,7 @@ public class ToneScore
3232
/// that the tone is unlikely to be perceived in the content; a score greater than 0.75 indicates a high
3333
/// likelihood that the tone is perceived.
3434
/// </summary>
35-
[fsProperty("score")]
35+
[JsonProperty("score", NullValueHandling = NullValueHandling.Ignore)]
3636
public double? Score { get; set; }
3737
/// <summary>
3838
/// The unique, non-localized identifier of the tone.
@@ -45,14 +45,12 @@ public class ToneScore
4545
/// `conscientiousness_big5`, `extraversion_big5`, `agreeableness_big5`, and `emotional_range_big5`. The service
4646
/// returns scores for all tones of a category, regardless of their values.
4747
/// </summary>
48-
[fsProperty("tone_id")]
48+
[JsonProperty("tone_id", NullValueHandling = NullValueHandling.Ignore)]
4949
public string ToneId { get; set; }
5050
/// <summary>
5151
/// The user-visible, localized name of the tone.
5252
/// </summary>
53-
[fsProperty("tone_name")]
53+
[JsonProperty("tone_name", NullValueHandling = NullValueHandling.Ignore)]
5454
public string ToneName { get; set; }
5555
}
56-
57-
5856
}

Scripts/Services/ToneAnalyzer/V3/Model/Utterance.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*/
1717

18-
using FullSerializer;
18+
using Newtonsoft.Json;
1919

2020
namespace IBM.Watson.ToneAnalyzer.V3.Model
2121
{
@@ -28,14 +28,12 @@ public class Utterance
2828
/// An utterance contributed by a user in the conversation that is to be analyzed. The utterance can contain
2929
/// multiple sentences.
3030
/// </summary>
31-
[fsProperty("text")]
31+
[JsonProperty("text", NullValueHandling = NullValueHandling.Ignore)]
3232
public string Text { get; set; }
3333
/// <summary>
3434
/// A string that identifies the user who contributed the utterance specified by the `text` parameter.
3535
/// </summary>
36-
[fsProperty("user")]
36+
[JsonProperty("user", NullValueHandling = NullValueHandling.Ignore)]
3737
public string User { get; set; }
3838
}
39-
40-
4139
}

Scripts/Services/ToneAnalyzer/V3/Model/UtteranceAnalyses.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
using System.Collections.Generic;
19-
using FullSerializer;
19+
using Newtonsoft.Json;
2020

2121
namespace IBM.Watson.ToneAnalyzer.V3.Model
2222
{
@@ -28,15 +28,13 @@ public class UtteranceAnalyses
2828
/// <summary>
2929
/// An array of `UtteranceAnalysis` objects that provides the results for each utterance of the input.
3030
/// </summary>
31-
[fsProperty("utterances_tone")]
31+
[JsonProperty("utterances_tone", NullValueHandling = NullValueHandling.Ignore)]
3232
public List<UtteranceAnalysis> UtterancesTone { get; set; }
3333
/// <summary>
3434
/// **`2017-09-21`:** A warning message if the content contains more than 50 utterances. The service analyzes
3535
/// only the first 50 utterances. **`2016-05-19`:** Not returned.
3636
/// </summary>
37-
[fsProperty("warning")]
37+
[JsonProperty("warning", NullValueHandling = NullValueHandling.Ignore)]
3838
public string Warning { get; set; }
3939
}
40-
41-
4240
}

0 commit comments

Comments
 (0)