Skip to content

Commit ebcea37

Browse files
committed
Resharper: Fix new warning about usage of collection expressions
1 parent 7bb798e commit ebcea37

5 files changed

+25
-25
lines changed

src/JsonApiDotNetCore.OpenApi/JsonApiRequestFormatMetadataProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ namespace JsonApiDotNetCore.OpenApi;
1010
internal sealed class JsonApiRequestFormatMetadataProvider : IInputFormatter, IApiRequestFormatMetadataProvider
1111
{
1212
private static readonly Type[] JsonApiRequestObjectOpenType =
13-
{
13+
[
1414
typeof(ToManyRelationshipInRequest<>),
1515
typeof(ToOneRelationshipInRequest<>),
1616
typeof(NullableToOneRelationshipInRequest<>),
1717
typeof(ResourcePostRequestDocument<>),
1818
typeof(ResourcePatchRequestDocument<>)
19-
};
19+
];
2020

2121
/// <inheritdoc />
2222
public bool CanRead(InputFormatterContext context)

src/JsonApiDotNetCore.OpenApi/OpenApiEndpointConvention.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,20 @@ private static IEnumerable<int> GetStatusCodesForEndpoint(JsonApiEndpoint endpoi
105105
{
106106
return endpoint switch
107107
{
108-
JsonApiEndpoint.GetCollection or JsonApiEndpoint.GetSingle or JsonApiEndpoint.GetSecondary or JsonApiEndpoint.GetRelationship => new[]
109-
{
108+
JsonApiEndpoint.GetCollection or JsonApiEndpoint.GetSingle or JsonApiEndpoint.GetSecondary or JsonApiEndpoint.GetRelationship =>
109+
[
110110
StatusCodes.Status200OK
111-
},
112-
JsonApiEndpoint.Post => new[]
113-
{
111+
],
112+
JsonApiEndpoint.Post =>
113+
[
114114
StatusCodes.Status201Created,
115115
StatusCodes.Status204NoContent
116-
},
117-
JsonApiEndpoint.Patch => new[]
118-
{
116+
],
117+
JsonApiEndpoint.Patch =>
118+
[
119119
StatusCodes.Status200OK,
120120
StatusCodes.Status204NoContent
121-
},
121+
],
122122
JsonApiEndpoint.Delete or JsonApiEndpoint.PostRelationship or JsonApiEndpoint.PatchRelationship or JsonApiEndpoint.DeleteRelationship => new[]
123123
{
124124
StatusCodes.Status204NoContent

src/JsonApiDotNetCore.OpenApi/SwaggerComponents/JsonApiSchemaGenerator.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace JsonApiDotNetCore.OpenApi.SwaggerComponents;
1212
internal sealed class JsonApiSchemaGenerator : ISchemaGenerator
1313
{
1414
private static readonly Type[] JsonApiDocumentOpenTypes =
15-
{
15+
[
1616
typeof(ResourceCollectionResponseDocument<>),
1717
typeof(PrimaryResourceResponseDocument<>),
1818
typeof(SecondaryResourceResponseDocument<>),
@@ -25,24 +25,24 @@ internal sealed class JsonApiSchemaGenerator : ISchemaGenerator
2525
typeof(ToManyRelationshipInRequest<>),
2626
typeof(ToOneRelationshipInRequest<>),
2727
typeof(NullableToOneRelationshipInRequest<>)
28-
};
28+
];
2929

3030
private static readonly Type[] JsonApiDocumentWithNullableDataOpenTypes =
31-
{
31+
[
3232
typeof(NullableSecondaryResourceResponseDocument<>),
3333
typeof(NullableResourceIdentifierResponseDocument<>),
3434
typeof(NullableToOneRelationshipInRequest<>)
35-
};
35+
];
3636

3737
private static readonly string[] DocumentPropertyNamesInOrder =
38-
{
38+
[
3939
JsonApiPropertyName.Jsonapi,
4040
JsonApiPropertyName.Links,
4141
JsonApiPropertyName.Data,
4242
JsonApiPropertyName.Errors,
4343
JsonApiPropertyName.Included,
4444
JsonApiPropertyName.Meta
45-
};
45+
];
4646

4747
private readonly ISchemaGenerator _defaultSchemaGenerator;
4848
private readonly IJsonApiOptions _options;

src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceFieldObjectSchemaBuilder.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ namespace JsonApiDotNetCore.OpenApi.SwaggerComponents;
1111
internal sealed class ResourceFieldObjectSchemaBuilder
1212
{
1313
private static readonly Type[] RelationshipSchemaInResponseOpenTypes =
14-
{
14+
[
1515
typeof(ToOneRelationshipInResponse<>),
1616
typeof(ToManyRelationshipInResponse<>),
1717
typeof(NullableToOneRelationshipInResponse<>)
18-
};
18+
];
1919

2020
private static readonly Type[] NullableRelationshipSchemaOpenTypes =
21-
{
21+
[
2222
typeof(NullableToOneRelationshipInRequest<>),
2323
typeof(NullableToOneRelationshipInResponse<>)
24-
};
24+
];
2525

2626
private static readonly string[] RelationshipObjectPropertyNamesInOrder =
27-
{
27+
[
2828
JsonApiPropertyName.Links,
2929
JsonApiPropertyName.Data,
3030
JsonApiPropertyName.Meta
31-
};
31+
];
3232

3333
private readonly ResourceTypeInfo _resourceTypeInfo;
3434
private readonly ISchemaRepositoryAccessor _schemaRepositoryAccessor;

src/JsonApiDotNetCore.OpenApi/SwaggerComponents/ResourceObjectSchemaGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ namespace JsonApiDotNetCore.OpenApi.SwaggerComponents;
88
internal sealed class ResourceObjectSchemaGenerator
99
{
1010
private static readonly string[] ResourceObjectPropertyNamesInOrder =
11-
{
11+
[
1212
JsonApiPropertyName.Type,
1313
JsonApiPropertyName.Id,
1414
JsonApiPropertyName.Attributes,
1515
JsonApiPropertyName.Relationships,
1616
JsonApiPropertyName.Links,
1717
JsonApiPropertyName.Meta
18-
};
18+
];
1919

2020
private readonly SchemaGenerator _defaultSchemaGenerator;
2121
private readonly IResourceGraph _resourceGraph;

0 commit comments

Comments
 (0)