@@ -153,7 +153,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
153
153
154
154
// parse JSON
155
155
if err := parseJSON (spec , specInfo , & parsedSpec ); err != nil {
156
- return nil , fmt .Errorf ("failed to parse json specification: %w" , err )
156
+ specInfo .Error = fmt .Errorf ("failed to parse specification: %w" , err )
157
+ return specInfo , specInfo .Error
157
158
}
158
159
parsed = true
159
160
@@ -182,7 +183,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
182
183
183
184
// parse JSON
184
185
if err := parseJSON (spec , specInfo , & parsedSpec ); err != nil {
185
- return nil , fmt .Errorf ("failed to parse json specification: %w" , err )
186
+ specInfo .Error = fmt .Errorf ("failed to parse specification: %w" , err )
187
+ return specInfo , specInfo .Error
186
188
}
187
189
parsed = true
188
190
@@ -208,7 +210,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
208
210
209
211
// parse JSON
210
212
if err := parseJSON (spec , specInfo , & parsedSpec ); err != nil {
211
- return nil , fmt .Errorf ("failed to parse json specification: %w" , err )
213
+ specInfo .Error = fmt .Errorf ("failed to parse specification: %w" , err )
214
+ return specInfo , nil
212
215
}
213
216
parsed = true
214
217
@@ -225,7 +228,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
225
228
// parse JSON
226
229
if ! bypass {
227
230
if err := parseJSON (spec , specInfo , & parsedSpec ); err != nil {
228
- return nil , fmt .Errorf ("failed to parse json specification: %w" , err )
231
+ specInfo .Error = errors .New ("spec type not supported by libopenapi, sorry" )
232
+ return specInfo , specInfo .Error
229
233
}
230
234
parsed = true
231
235
specInfo .Error = errors .New ("spec type not supported by libopenapi, sorry" )
@@ -239,7 +243,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
239
243
240
244
if ! parsed {
241
245
if err := parseJSON (spec , specInfo , & parsedSpec ); err != nil {
242
- return nil , fmt .Errorf ("failed to parse json specification: %w" , err )
246
+ specInfo .Error = fmt .Errorf ("failed to parse specification: %w" , err )
247
+ return specInfo , specInfo .Error
243
248
}
244
249
}
245
250
0 commit comments