Skip to content

Update to JsonApiDotNetCore v5.7.1 #95

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

Merged
merged 3 commits into from
Apr 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2024.1.6",
"version": "2024.3.6",
"commands": [
"jb"
]
],
"rollForward": false
},
"regitlint": {
"version": "6.3.13",
"commands": [
"regitlint"
]
],
"rollForward": false
},
"dotnet-reportgenerator-globaltool": {
"version": "5.3.11",
"version": "5.4.5",
"commands": [
"reportgenerator"
]
],
"rollForward": false
}
}
}
166 changes: 128 additions & 38 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,125 @@ root = true
[*]
indent_style = space
indent_size = 4
tab-width = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{config,csproj,css,js,json,props,ruleset,xslt,html}]
[*.{config,csproj,css,js,json,props,targets,xml,ruleset,xsd,xslt,html,yml,yaml}]
indent_size = 2
tab-width = 2
max_line_length = 160

[*.{cs,cshtml,ascx,aspx}]

[*.{cs}]
#### C#/.NET Coding Conventions ####

# Default severity for IDE* analyzers with category 'Style'
# Note: specific rules below use severity silent, because Resharper code cleanup auto-fixes them.
dotnet_analyzer_diagnostic.category-Style.severity = warning

# 'using' directive preferences
dotnet_sort_system_directives_first = true
csharp_using_directive_placement = outside_namespace:suggestion
csharp_using_directive_placement = outside_namespace:silent
# IDE0005: Remove unnecessary import
dotnet_diagnostic.IDE0005.severity = silent

# Namespace declarations
csharp_style_namespace_declarations = file_scoped:suggestion
csharp_style_namespace_declarations = file_scoped:silent
# IDE0160: Use block-scoped namespace
dotnet_diagnostic.IDE0160.severity = silent
# IDE0161: Use file-scoped namespace
dotnet_diagnostic.IDE0161.severity = silent

# this. preferences
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# IDE0003: Remove this or Me qualification
dotnet_diagnostic.IDE0003.severity = silent
# IDE0009: Add this or Me qualification
dotnet_diagnostic.IDE0009.severity = silent

# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# IDE0049: Use language keywords instead of framework type names for type references
dotnet_diagnostic.IDE0049.severity = silent

# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
csharp_style_pattern_local_over_anonymous_function = false:silent
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
# IDE0040: Add accessibility modifiers
dotnet_diagnostic.IDE0040.severity = silent
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:silent
# IDE0036: Order modifiers
dotnet_diagnostic.IDE0036.severity = silent

# Expression-level preferences
dotnet_style_operator_placement_when_wrapping = end_of_line
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
dotnet_style_prefer_auto_properties = true:silent
# IDE0032: Use auto property
dotnet_diagnostic.IDE0032.severity = silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
# IDE0045: Use conditional expression for assignment
dotnet_diagnostic.IDE0045.severity = silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
# IDE0046: Use conditional expression for return
dotnet_diagnostic.IDE0046.severity = silent
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
# IDE0058: Remove unused expression value
dotnet_diagnostic.IDE0058.severity = silent

# Collection expression preferences (note: partially turned off in Directory.Build.props)
dotnet_style_prefer_collection_expression = when_types_exactly_match

# Parameter preferences
dotnet_code_quality_unused_parameters = non_public:suggestion
dotnet_code_quality_unused_parameters = non_public

# Local functions vs lambdas
csharp_style_prefer_local_over_anonymous_function = false:silent
# IDE0039: Use local function instead of lambda
dotnet_diagnostic.IDE0039.severity = silent

# Expression-bodied members
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = false:suggestion
csharp_style_expression_bodied_methods = false:suggestion
csharp_style_expression_bodied_operators = false:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_accessors = true:silent
# IDE0027: Use expression body for accessors
dotnet_diagnostic.IDE0027.severity = silent
csharp_style_expression_bodied_constructors = false:silent
# IDE0021: Use expression body for constructors
dotnet_diagnostic.IDE0021.severity = silent
csharp_style_expression_bodied_indexers = true:silent
# IDE0026: Use expression body for indexers
dotnet_diagnostic.IDE0026.severity = silent
csharp_style_expression_bodied_lambdas = true:silent
# IDE0053: Use expression body for lambdas
dotnet_diagnostic.IDE0053.severity = silent
csharp_style_expression_bodied_local_functions = false:silent
# IDE0061: Use expression body for local functions
dotnet_diagnostic.IDE0061.severity = silent
csharp_style_expression_bodied_methods = false:silent
# IDE0022: Use expression body for methods
dotnet_diagnostic.IDE0022.severity = silent
csharp_style_expression_bodied_operators = false:silent
# IDE0023: Use expression body for conversion operators
dotnet_diagnostic.IDE0023.severity = silent
# IDE0024: Use expression body for operators
dotnet_diagnostic.IDE0024.severity = silent
csharp_style_expression_bodied_properties = true:silent
# IDE0025: Use expression body for properties
dotnet_diagnostic.IDE0025.severity = silent

# Member preferences (these analyzers are unreliable)
# IDE0051: Remove unused private member
dotnet_diagnostic.IDE0051.severity = silent
# IDE0052: Remove unread private member
dotnet_diagnostic.IDE0052.severity = silent

# Code-block preferences
csharp_prefer_braces = true:suggestion
csharp_prefer_braces = true:silent
# IDE0011: Add braces
dotnet_diagnostic.IDE0011.severity = silent

# Indentation preferences
csharp_indent_case_contents_when_block = false
Expand All @@ -66,19 +131,44 @@ csharp_indent_case_contents_when_block = false
csharp_preserve_single_line_statements = false

# 'var' usage preferences
csharp_style_var_for_built_in_types = false:none
csharp_style_var_when_type_is_apparent = true:none
csharp_style_var_elsewhere = false:none
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = false:silent
# IDE0007: Use var instead of explicit type
dotnet_diagnostic.IDE0007.severity = silent
# IDE0008: Use explicit type instead of var
dotnet_diagnostic.IDE0008.severity = silent

# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion

# Expression value is never used
dotnet_diagnostic.IDE0058.severity = none

#### Naming Style ####
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:silent
# IDE0047: Remove unnecessary parentheses
dotnet_diagnostic.IDE0047.severity = silent
# IDE0048: Add parentheses for clarity
dotnet_diagnostic.IDE0048.severity = silent

# Switch preferences
# IDE0010: Add missing cases to switch statement
dotnet_diagnostic.IDE0010.severity = silent
# IDE0072: Add missing cases to switch expression
dotnet_diagnostic.IDE0072.severity = silent

# Null check preferences
# IDE0029: Null check can be simplified
dotnet_diagnostic.IDE0029.severity = silent
# IDE0030: Null check can be simplified
dotnet_diagnostic.IDE0030.severity = silent
# IDE0270: Null check can be simplified
dotnet_diagnostic.IDE0270.severity = silent

# JSON002: Probable JSON string detected
dotnet_diagnostic.JSON002.severity = silent

# CA1062: Validate arguments of public methods
dotnet_code_quality.CA1062.excluded_symbol_names = Accept|DefaultVisit|Visit*|Apply*

#### .NET Naming Style ####

dotnet_diagnostic.IDE1006.severity = warning

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---

<!--
Remember that no-one is getting paid to answer your question. You're basically asking other people to give up their time to help you out of the goodness of their heart – it's up to you to do all you can to make that as simple as possible, so read http://tinyurl.com/stack-checklist first.
Remember that no-one is getting paid to answer your question. You're basically asking other people to give up their time to help you out of the goodness of their heart – it's up to you to do all you can to make that as simple as possible, so read https://tinyurl.com/stack-checklist first.
-->

#### SUMMARY
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
cancel-in-progress: true

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
Expand All @@ -41,8 +41,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
8.0.*
9.0.*
- name: Show installed versions
shell: pwsh
run: |
Expand All @@ -66,14 +66,14 @@ jobs:
$versionSuffix = $segments.Length -eq 1 ? '' : $segments[1..$($segments.Length - 1)] -join '-'

[xml]$xml = Get-Content Directory.Build.props
$configuredVersionPrefix = $xml.Project.PropertyGroup.JsonApiDotNetCoreMongoDbVersionPrefix | Select-Object -First 1
$configuredVersionPrefix = $xml.Project.PropertyGroup.VersionPrefix | Select-Object -First 1

if ($configuredVersionPrefix -ne $versionPrefix) {
Write-Error "Version prefix from git release tag '$versionPrefix' does not match version prefix '$configuredVersionPrefix' stored in Directory.Build.props."
# To recover from this:
# - Delete the GitHub release
# - Run: git push --delete origin the-invalid-tag-name
# - Adjust JsonApiDotNetCoreVersionPrefix in Directory.Build.props, commit and push
# - Adjust VersionPrefix in Directory.Build.props, commit and push
# - Recreate the GitHub release
}
}
Expand All @@ -97,7 +97,7 @@ jobs:
if: matrix.os == 'ubuntu-latest'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose: true
Expand Down Expand Up @@ -128,8 +128,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
8.0.*
9.0.*
- name: Git checkout
uses: actions/checkout@v4
- name: Restore tools
Expand Down Expand Up @@ -183,8 +183,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
8.0.*
9.0.*
- name: Git checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -234,6 +234,14 @@ jobs:
run: |
dotnet nuget add source --username 'json-api-dotnet' --password "$env:GITHUB_TOKEN" --store-password-in-clear-text --name 'github' 'https://nuget.pkg.github.com/json-api-dotnet/index.json'
dotnet nuget push "$env:GITHUB_WORKSPACE/packages/*.nupkg" --api-key "$env:GITHUB_TOKEN" --source 'github'
- name: Publish to feedz.io
if: github.event_name == 'push' || github.event_name == 'release'
env:
FEEDZ_IO_API_KEY: ${{ secrets.FEEDZ_IO_API_KEY }}
shell: pwsh
run: |
dotnet nuget add source --name 'feedz-io' 'https://f.feedz.io/json-api-dotnet/jsonapidotnetcore/nuget/index.json'
dotnet nuget push "$env:GITHUB_WORKSPACE/packages/*.nupkg" --api-key "$env:FEEDZ_IO_API_KEY" --source 'feedz-io'
- name: Publish to NuGet
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
8.0.*
9.0.*
- name: Git checkout
uses: actions/checkout@v4
- name: Initialize CodeQL
Expand Down
8 changes: 3 additions & 5 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
$versionSuffix="pre"

function VerifySuccessExitCode {
if ($LastExitCode -ne 0) {
throw "Command failed with exit code $LastExitCode."
Expand All @@ -16,14 +14,14 @@ Remove-Item -Recurse -Force * -Include coverage.cobertura.xml
dotnet tool restore
VerifySuccessExitCode

dotnet build --configuration Release /p:VersionSuffix=$versionSuffix
dotnet build --configuration Release
VerifySuccessExitCode

dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage"
dotnet test --no-build --configuration Release --verbosity quiet --collect:"XPlat Code Coverage"
VerifySuccessExitCode

dotnet reportgenerator -reports:**\coverage.cobertura.xml -targetdir:artifacts\coverage -filefilters:-*.g.cs
VerifySuccessExitCode

dotnet pack --no-build --configuration Release --output artifacts/packages /p:VersionSuffix=$versionSuffix
dotnet pack --no-build --configuration Release --output artifacts/packages
VerifySuccessExitCode
Loading