Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.

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

Merged
michaelcfanning merged 2 commits into
mainfrom
users/shaopeng-gh/nullableint
Nov 1, 2022
Merged

* BREAKING: .NET type to express Json integers now will be nullable if the property is not required and also without default.#167
michaelcfanning merged 2 commits into
mainfrom
users/shaopeng-gh/nullableint

Conversation

@shaopeng-gh

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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.

}

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

@shaopeng-gh shaopeng-gh Oct 27, 2022

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor 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.

@michaelcfanning michaelcfanning left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

:shipit:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants