-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[Aspnetcore] Fix nullable warnings part 1 #15555
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,10 @@ on: | |
- 'samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore**/' | ||
- 'samples/server/petstore/aspnetcore-6.0/**' | ||
- 'samples/server/petstore/aspnetcore-6.0-pocoModels/**' | ||
- 'samples/server/petstore/aspnetcore-6.0-project4Models/**' | ||
- 'samples/server/petstore/aspnetcore-6.0-useSwashBuckle/**' | ||
- 'samples/server/petstore/aspnetcore-6.0-useNewtonsoft/**' | ||
- 'samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/**' | ||
- 'samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes/**' | ||
jobs: | ||
build: | ||
name: Build .Net projects | ||
|
@@ -35,7 +37,8 @@ jobs: | |
- samples/server/petstore/aspnetcore-6.0-pocoModels | ||
- samples/server/petstore/aspnetcore-6.0-project4Models | ||
- samples/server/petstore/aspnetcore-6.0-useSwashBuckle | ||
- samples/server/petstore/aspnetcore-6.0-useNewtonsoft | ||
- samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse | ||
- samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
generatorName: aspnetcore | ||
outputDir: samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/aspnetcore/petstore.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/aspnetcore/3.0 | ||
additionalProperties: | ||
packageGuid: '{3C799344-F285-4669-8FD5-7ED9B795D5C5}' | ||
aspnetCoreVersion: "6.0" | ||
userSecretsGuid: 'cb87e868-8646-48ef-9bb6-344b537d0d37' | ||
nullableReferenceTypes: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
38 changes: 38 additions & 0 deletions
38
samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/.openapi-generator/FILES
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.openapi-generator-ignore | ||
Org.OpenAPITools.sln | ||
README.md | ||
build.bat | ||
build.sh | ||
src/Org.OpenAPITools/.gitignore | ||
src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs | ||
src/Org.OpenAPITools/Authentication/ApiAuthentication.cs | ||
src/Org.OpenAPITools/Controllers/FakeApi.cs | ||
src/Org.OpenAPITools/Controllers/PetApi.cs | ||
src/Org.OpenAPITools/Controllers/StoreApi.cs | ||
src/Org.OpenAPITools/Controllers/UserApi.cs | ||
src/Org.OpenAPITools/Converters/CustomEnumConverter.cs | ||
src/Org.OpenAPITools/Dockerfile | ||
src/Org.OpenAPITools/Filters/BasePathFilter.cs | ||
src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs | ||
src/Org.OpenAPITools/Formatters/InputFormatterStream.cs | ||
src/Org.OpenAPITools/Models/Animal.cs | ||
src/Org.OpenAPITools/Models/ApiResponse.cs | ||
src/Org.OpenAPITools/Models/Cat.cs | ||
src/Org.OpenAPITools/Models/CatAllOf.cs | ||
src/Org.OpenAPITools/Models/Category.cs | ||
src/Org.OpenAPITools/Models/Dog.cs | ||
src/Org.OpenAPITools/Models/DogAllOf.cs | ||
src/Org.OpenAPITools/Models/Order.cs | ||
src/Org.OpenAPITools/Models/Pet.cs | ||
src/Org.OpenAPITools/Models/Tag.cs | ||
src/Org.OpenAPITools/Models/User.cs | ||
src/Org.OpenAPITools/OpenApi/TypeExtensions.cs | ||
src/Org.OpenAPITools/Org.OpenAPITools.csproj | ||
src/Org.OpenAPITools/Program.cs | ||
src/Org.OpenAPITools/Properties/launchSettings.json | ||
src/Org.OpenAPITools/Startup.cs | ||
src/Org.OpenAPITools/appsettings.Development.json | ||
src/Org.OpenAPITools/appsettings.json | ||
src/Org.OpenAPITools/wwwroot/README.md | ||
src/Org.OpenAPITools/wwwroot/index.html | ||
src/Org.OpenAPITools/wwwroot/openapi-original.json |
1 change: 1 addition & 0 deletions
1
samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7.0.0-SNAPSHOT |
22 changes: 22 additions & 0 deletions
22
samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/Org.OpenAPITools.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.27428.2043 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{3C799344-F285-4669-8FD5-7ED9B795D5C5}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
50 changes: 50 additions & 0 deletions
50
samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Org.OpenAPITools - ASP.NET Core 6.0 Server | ||
|
||
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. | ||
|
||
## Upgrade NuGet Packages | ||
|
||
NuGet packages get frequently updated. | ||
|
||
To upgrade this solution to the latest version of all NuGet packages, use the dotnet-outdated tool. | ||
|
||
|
||
Install dotnet-outdated tool: | ||
|
||
``` | ||
dotnet tool install --global dotnet-outdated-tool | ||
``` | ||
|
||
Upgrade only to new minor versions of packages | ||
|
||
``` | ||
dotnet outdated --upgrade --version-lock Major | ||
``` | ||
|
||
Upgrade to all new versions of packages (more likely to include breaking API changes) | ||
|
||
``` | ||
dotnet outdated --upgrade | ||
``` | ||
|
||
|
||
## Run | ||
|
||
Linux/OS X: | ||
|
||
``` | ||
sh build.sh | ||
``` | ||
|
||
Windows: | ||
|
||
``` | ||
build.bat | ||
``` | ||
## Run in Docker | ||
|
||
``` | ||
cd src/Org.OpenAPITools | ||
docker build -t org.openapitools . | ||
docker run -p 5000:8080 org.openapitools | ||
``` |
9 changes: 9 additions & 0 deletions
9
samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/build.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
:: Generated by: https://openapi-generator.tech | ||
:: | ||
|
||
@echo off | ||
|
||
dotnet restore src\Org.OpenAPITools | ||
dotnet build src\Org.OpenAPITools | ||
echo Now, run the following to start the project: dotnet run -p src\Org.OpenAPITools\Org.OpenAPITools.csproj --launch-profile web. | ||
echo. |
8 changes: 8 additions & 0 deletions
8
samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/build.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Generated by: https://openapi-generator.tech | ||
# | ||
|
||
dotnet restore src/Org.OpenAPITools/ && \ | ||
dotnet build src/Org.OpenAPITools/ && \ | ||
echo "Now, run the following to start the project: dotnet run -p src/Org.OpenAPITools/Org.OpenAPITools.csproj --launch-profile web" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use {{nrt?}} instead of {{#nullableReferenceTypes}}?{{/nullableReferenceTypes}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! I didn't know! Should I change my code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its the same just shorter.