@@ -153,7 +153,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
153153
154154 // parse JSON
155155 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
157158 }
158159 parsed = true
159160
@@ -182,7 +183,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
182183
183184 // parse JSON
184185 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
186188 }
187189 parsed = true
188190
@@ -208,7 +210,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
208210
209211 // parse JSON
210212 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
212215 }
213216 parsed = true
214217
@@ -225,7 +228,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
225228 // parse JSON
226229 if ! bypass {
227230 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
229233 }
230234 parsed = true
231235 specInfo .Error = errors .New ("spec type not supported by libopenapi, sorry" )
@@ -239,7 +243,8 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
239243
240244 if ! parsed {
241245 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
243248 }
244249 }
245250
0 commit comments