Skip to content

Commit 7a88a64

Browse files
committed
Review feedback
1 parent 5a4a06f commit 7a88a64

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

src/JsonApiDotNetCore.OpenApi/SwaggerComponents/JsonApiObjectNullabilityProcessor.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ namespace JsonApiDotNetCore.OpenApi.SwaggerComponents
77
/// </summary>
88
/// <remarks>
99
/// Initially these entries are marked nullable by Swashbuckle because nullable reference types are not enabled. This post-processing step can be removed
10-
/// entirely once we enable nullable reference types. See eg
11-
/// https://github.com/degreed/JsonApiCorePrototype/blob/936db8950d925f1b8a055cf5d8bba753f6579094/src/Web/OpenApi/JsonApiObjects/Documents/ManyResourceIdentifierResponseDocument.cs#L7
10+
/// entirely once we enable nullable reference types.
1211
/// </remarks>
1312
internal sealed class JsonApiObjectNullabilityProcessor
1413
{

test/OpenApiClientTests/LegacyClient/ClientAttributeRegistrationLifeTimeTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using TestBuildingBlocks;
66
using Xunit;
77

8-
#pragma warning disable AV1704 // Don't include numbers in variables, parameters and type members
9-
108
namespace OpenApiClientTests.LegacyClient
119
{
1210
public sealed class ClientAttributeRegistrationLifetimeTests
@@ -135,7 +133,7 @@ public async Task Request_is_unaffected_by_attribute_registration_for_different_
135133
airplane => airplane.AirtimeInHours))
136134
{
137135
using (openApiClient.RegisterAttributesForRequestDocument<AirplanePatchRequestDocument, AirplaneAttributesInPatchRequest>(requestDocument2,
138-
airplane => airplane.IsInMaintenance))
136+
airplane => airplane.SerialNumber))
139137
{
140138
}
141139

@@ -149,7 +147,7 @@ public async Task Request_is_unaffected_by_attribute_registration_for_different_
149147
""type"": ""airplanes"",
150148
""id"": """ + airplaneId2 + @""",
151149
""attributes"": {
152-
""is-in-maintenance"": false
150+
""serial-number"": null
153151
}
154152
}
155153
}");

test/OpenApiClientTests/LegacyClient/ResponseTests.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
using OpenApiClientTests.LegacyClient.GeneratedCode;
1010
using Xunit;
1111

12-
#pragma warning disable AV1704 // Don't include numbers in variables, parameters and type members
13-
1412
namespace OpenApiClientTests.LegacyClient
1513
{
1614
public sealed class ResponseTests
@@ -22,13 +20,13 @@ public async Task Getting_resource_collection_translates_response()
2220
{
2321
// Arrange
2422
const string flightId = "ZvuH1";
25-
const string flightDestination = "Destination of Flight";
26-
const string fightServiceOnBoard = "Movies";
23+
const string flightDestination = "Amsterdam";
24+
const string flightServiceOnBoard = "Movies";
2725
const string flightDepartsAt = "2014-11-25T00:00:00";
2826
const string documentMetaValue = "1";
29-
const string flightMetaValue = "https://api.jsonapi.net/docs/#get-flights";
27+
const string flightMetaValue = "https://jsonapi.net/api/docs/#get-flights";
3028
const string purserMetaValue = "https://jsonapi.net/api/docs/#get-flight-purser";
31-
const string cabinPersonnelMetaValue = "https://jsonapi.net/api/docs/#get-flight-cabin-crew-members";
29+
const string cabinCrewMembersMetaValue = "https://jsonapi.net/api/docs/#get-flight-cabin-crew-members";
3230
const string passengersMetaValue = "https://jsonapi.net/api/docs/#get-flight-passengers";
3331
const string topLevelLink = HostPrefix + "flights";
3432
const string flightResourceLink = topLevelLink + "/" + flightId;
@@ -53,7 +51,7 @@ public async Task Getting_resource_collection_translates_response()
5351
""departs-at"": """ + flightDepartsAt + @""",
5452
""arrives-at"": null,
5553
""services-on-board"": [
56-
""" + fightServiceOnBoard + @""",
54+
""" + flightServiceOnBoard + @""",
5755
"""",
5856
null
5957
]
@@ -74,7 +72,7 @@ public async Task Getting_resource_collection_translates_response()
7472
""related"": """ + flightResourceLink + @"/cabin-crew-members""
7573
},
7674
""meta"": {
77-
""docs"": """ + cabinPersonnelMetaValue + @"""
75+
""docs"": """ + cabinCrewMembersMetaValue + @"""
7876
}
7977
},
8078
""passengers"": {
@@ -120,13 +118,14 @@ public async Task Getting_resource_collection_translates_response()
120118
flight.Meta["docs"].Should().Be(flightMetaValue);
121119

122120
flight.Attributes.FinalDestination.Should().Be(flightDestination);
121+
flight.Attributes.StopOverDestination.Should().Be(null);
123122
flight.Attributes.ServicesOnBoard.Should().HaveCount(3);
124-
flight.Attributes.ServicesOnBoard.ElementAt(0).Should().Be(fightServiceOnBoard);
123+
flight.Attributes.ServicesOnBoard.ElementAt(0).Should().Be(flightServiceOnBoard);
125124
flight.Attributes.ServicesOnBoard.ElementAt(1).Should().Be(string.Empty);
126125
flight.Attributes.ServicesOnBoard.ElementAt(2).Should().BeNull();
127126
flight.Attributes.OperatedBy.Should().Be(Airline.DeltaAirLines);
128127
flight.Attributes.DepartsAt.Should().Be(DateTimeOffset.Parse(flightDepartsAt, new CultureInfo("en-GB")));
129-
flight.Attributes.ArrivesAt.Should().Be(null);
128+
flight.Attributes.ArrivesAt.Should().BeNull();
130129

131130
flight.Relationships.Purser.Data.Should().BeNull();
132131
flight.Relationships.Purser.Links.Self.Should().Be(flightResourceLink + "/relationships/purser");
@@ -138,7 +137,7 @@ public async Task Getting_resource_collection_translates_response()
138137
flight.Relationships.CabinCrewMembers.Links.Self.Should().Be(flightResourceLink + "/relationships/cabin-crew-members");
139138
flight.Relationships.CabinCrewMembers.Links.Related.Should().Be(flightResourceLink + "/cabin-crew-members");
140139
flight.Relationships.CabinCrewMembers.Meta.Should().HaveCount(1);
141-
flight.Relationships.CabinCrewMembers.Meta["docs"].Should().Be(cabinPersonnelMetaValue);
140+
flight.Relationships.CabinCrewMembers.Meta["docs"].Should().Be(cabinCrewMembersMetaValue);
142141

143142
flight.Relationships.Passengers.Data.Should().BeNull();
144143
flight.Relationships.Passengers.Links.Self.Should().Be(flightResourceLink + "/relationships/passengers");
@@ -187,6 +186,8 @@ public async Task Getting_resource_translates_response()
187186
document.Data.Attributes.ArrivesAt.Should().Be(DateTimeOffset.Parse(arrivesAtWithUtcOffset));
188187
document.Data.Attributes.ServicesOnBoard.Should().BeNull();
189188
document.Data.Attributes.FinalDestination.Should().BeNull();
189+
document.Data.Attributes.StopOverDestination.Should().BeNull();
190+
190191
document.Data.Attributes.OperatedBy.Should().Be(default(Airline));
191192
}
192193

0 commit comments

Comments
 (0)