@@ -27,7 +27,7 @@ public class OpenApiJsonReader : IOpenApiReader
27
27
/// <param name="settings">The Reader settings to be used during parsing.</param>
28
28
/// <returns></returns>
29
29
public ReadResult Read ( MemoryStream input ,
30
- OpenApiReaderSettings settings = null )
30
+ OpenApiReaderSettings settings )
31
31
{
32
32
JsonNode jsonNode ;
33
33
var diagnostic = new OpenApiDiagnostic ( ) ;
@@ -51,40 +51,6 @@ public ReadResult Read(MemoryStream input,
51
51
return Read ( jsonNode , settings ) ;
52
52
}
53
53
54
-
55
- /// <summary>
56
- /// Reads the stream input asynchronously and parses it into an Open API document.
57
- /// </summary>
58
- /// <param name="input">TextReader containing OpenAPI description to parse.</param>
59
- /// <param name="settings">The Reader settings to be used during parsing.</param>
60
- /// <param name="cancellationToken">Propagates notifications that operations should be cancelled.</param>
61
- /// <returns></returns>
62
- public async Task < ReadResult > ReadAsync ( Stream input ,
63
- OpenApiReaderSettings settings ,
64
- CancellationToken cancellationToken = default )
65
- {
66
- JsonNode jsonNode ;
67
- var diagnostic = new OpenApiDiagnostic ( ) ;
68
- settings ??= new OpenApiReaderSettings ( ) ;
69
-
70
- // Parse the JSON text in the TextReader into JsonNodes
71
- try
72
- {
73
- jsonNode = await JsonNode . ParseAsync ( input ) ;
74
- }
75
- catch ( JsonException ex )
76
- {
77
- diagnostic . Errors . Add ( new OpenApiError ( $ "#line={ ex . LineNumber } ", $ "Please provide the correct format, { ex . Message } ") ) ;
78
- return new ReadResult
79
- {
80
- OpenApiDocument = null ,
81
- OpenApiDiagnostic = diagnostic
82
- } ;
83
- }
84
-
85
- return Read ( jsonNode , settings ) ;
86
- }
87
-
88
54
/// <summary>
89
55
/// Parses the JsonNode input into an Open API document.
90
56
/// </summary>
@@ -137,6 +103,39 @@ public ReadResult Read(JsonNode jsonNode,
137
103
} ;
138
104
}
139
105
106
+ /// <summary>
107
+ /// Reads the stream input asynchronously and parses it into an Open API document.
108
+ /// </summary>
109
+ /// <param name="input">TextReader containing OpenAPI description to parse.</param>
110
+ /// <param name="settings">The Reader settings to be used during parsing.</param>
111
+ /// <param name="cancellationToken">Propagates notifications that operations should be cancelled.</param>
112
+ /// <returns></returns>
113
+ public async Task < ReadResult > ReadAsync ( Stream input ,
114
+ OpenApiReaderSettings settings ,
115
+ CancellationToken cancellationToken = default )
116
+ {
117
+ JsonNode jsonNode ;
118
+ var diagnostic = new OpenApiDiagnostic ( ) ;
119
+ settings ??= new OpenApiReaderSettings ( ) ;
120
+
121
+ // Parse the JSON text in the TextReader into JsonNodes
122
+ try
123
+ {
124
+ jsonNode = await JsonNode . ParseAsync ( input ) ;
125
+ }
126
+ catch ( JsonException ex )
127
+ {
128
+ diagnostic . Errors . Add ( new OpenApiError ( $ "#line={ ex . LineNumber } ", $ "Please provide the correct format, { ex . Message } ") ) ;
129
+ return new ReadResult
130
+ {
131
+ OpenApiDocument = null ,
132
+ OpenApiDiagnostic = diagnostic
133
+ } ;
134
+ }
135
+
136
+ return Read ( jsonNode , settings ) ;
137
+ }
138
+
140
139
/// <inheritdoc/>
141
140
public T ReadFragment < T > ( MemoryStream input ,
142
141
OpenApiSpecVersion version ,
0 commit comments