Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #262: Moved from Newtonsoft.Json to System.Text.Json #324

Open
wants to merge 15 commits into
base: development
Choose a base branch
from

Conversation

antoineatstariongroup
Copy link
Contributor

@antoineatstariongroup antoineatstariongroup commented Mar 21, 2024

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the COMET-SDK code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

Fix #262

  • Remove all dependencies to Newtonsoft.Json
  • All (de)serializers uses the most low-level Json calls
  • Creation of CDP4DalJsonSerializer that support (de)serialization of any PostOperation class
  • Creation of versionBump script that update all VersionPrefix entries for every csproj files
  • Added Deserialize(string)
  • PostOperation is not abstract anymore

BREAKING CHANGES :

  • Standard CDP4JsonSerializer should NOT be used anymore is case of PostOperation (de)serialization
  • PostOperation, Operation and Operation kind moved to new Namespace: CDP4DalCommon.Protocol.Operations

@antoineatstariongroup
Copy link
Contributor Author

I think that the issue found by SQ should be discarded and non-relevant with the context of the code

public override void Write(Utf8JsonWriter writer, PostOperation value, JsonSerializerOptions options)
{
writer.WriteStartObject();
writer.WriteStartArray("_delete");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "u8"

{
domainOfExpertise.Name = jObject["name"].ToObject<string>();
if(nameProperty.ValueKind == JsonValueKind.Null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets log at Trace level

<PackageTags>CDP COMET ECSS-E-TM-10-25 JSON</PackageTags>
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
<PackageReleaseNotes>
[BUMP] To CDP4Common 26.6.0
</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please restore the README.md

@@ -0,0 +1,20 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure to add some docs somewhere what the purpose is and how to use it

emailAddress.ModifiedOn = jObject["modifiedOn"].ToObject<DateTime>();
if(modifiedOnProperty.ValueKind == JsonValueKind.Null)
{
Logger.Trace("The non-nullabale modifiedOn property of the emailAddress {id} is null", emailAddress.Iid);

Check warning

Code scanning / CodeQL

Exposure of private information Medium

Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
emailAddress.ThingPreference = jObject["thingPreference"].ToObject<string>();
if(thingPreferenceProperty.ValueKind == JsonValueKind.Null)
{
Logger.Trace("The non-nullabale thingPreference property of the emailAddress {id} is null", emailAddress.Iid);

Check warning

Code scanning / CodeQL

Exposure of private information Medium

Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
emailAddress.Value = jObject["value"].ToObject<string>();
if(valueProperty.ValueKind == JsonValueKind.Null)
{
Logger.Trace("The non-nullabale value property of the emailAddress {id} is null", emailAddress.Iid);

Check warning

Code scanning / CodeQL

Exposure of private information Medium

Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
emailAddress.VcardType = jObject["vcardType"].ToObject<VcardEmailAddressKind>();
if(vcardTypeProperty.ValueKind == JsonValueKind.Null)
{
Logger.Trace("The non-nullabale vcardType property of the emailAddress {id} is null", emailAddress.Iid);

Check warning

Code scanning / CodeQL

Exposure of private information Medium

Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
Private data returned by
access to local variable emailAddress
is written to an external location.
/// Initializes a new <see cref="PostOperationJsonConverter" /> instance.
/// </summary>
/// <param name="ignoreCopyProperty">Asserts that the <see cref="PostOperation.Copy"/> have to be ignored</param>
public PostOperationJsonConverter(bool ignoreCopyProperty = false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default should be true, since this is special for COMET and not supported by version 1,0.0 of 10-25

Copy link

sonarcloud bot commented Mar 22, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CodeGenerate] a system.json.text based CDP4JsonSerializer
2 participants