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

* BREAKING: .NET type to express Json integers now will be nullable if the property is not required and also without default. #167

Merged
merged 2 commits into from
Nov 1, 2022

Conversation

shaopeng-gh
Copy link
Collaborator

@shaopeng-gh shaopeng-gh commented Oct 27, 2022

Purpose of this change:
Ran through SARIF SDK looks good to remove all those:
// NOTYETAUTOGENERATED: Property should be nullable int. https://github.com/Microsoft/jschema/issues/112
#112
And also nullable BigInteger.

Modified existing test case, and add a test in GeneratesAttributesForPropertiesOfPrimitiveTypeWithDefaults()

""type"": ""integer"",
""description"": ""An integer property, required and with a default value."",
""default"": 42
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These 4 are a set of tests.

@@ -630,7 +643,9 @@ private string GetUnqualifiedTypeName(string typeName, out string namespaceName)
namespaceName = null;
}

return unqualifiedTypeName.ToPascalCase();
namespaceName = namespaceName == "System" ? null : namespaceName;
Copy link
Collaborator Author

@shaopeng-gh shaopeng-gh Oct 27, 2022

Choose a reason for hiding this comment

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

namespaceName = namespaceName == "System" ? null : namespaceName;

This is because using System; is not required.

return unqualifiedTypeName.ToPascalCase();
namespaceName = namespaceName == "System" ? null : namespaceName;

return typeName.StartsWith("System.") ? unqualifiedTypeName : unqualifiedTypeName.ToPascalCase();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unqualifiedTypeName

This is because we don't want to use Int, should be int.
All system types are already with correct case we don't need to manually do ToPascalCase.

Copy link
Member

@michaelcfanning michaelcfanning left a comment

Choose a reason for hiding this comment

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

:shipit:

@michaelcfanning michaelcfanning merged commit 050fc37 into main Nov 1, 2022
@shaopeng-gh shaopeng-gh deleted the users/shaopeng-gh/nullableint branch November 1, 2022 23:32
@shaopeng-gh shaopeng-gh mentioned this pull request Nov 7, 2022
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.

2 participants