mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 12:37:48 +00:00
Tuned logic on render only code for document.
I could not build a test to ensure any error returned from creating a new doc after rendering was caught. There is no way to test the code, so I changed the logic to capture all errors and cascade down. Same outcome, simplified flow. Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -189,13 +189,15 @@ func (d *document) RenderAndReload() ([]byte, Document, *DocumentModel[v3high.Do
|
|||||||
return nil, nil, nil, []error{rerr}
|
return nil, nil, nil, []error{rerr}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errs []error
|
||||||
|
|
||||||
newDoc, err := NewDocumentWithConfiguration(newBytes, d.config)
|
newDoc, err := NewDocumentWithConfiguration(newBytes, d.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return newBytes, newDoc, nil, []error{err}
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
// build the model.
|
// build the model.
|
||||||
model, errs := newDoc.BuildV3Model()
|
model, buildErrs := newDoc.BuildV3Model()
|
||||||
if errs != nil {
|
if buildErrs != nil {
|
||||||
return newBytes, newDoc, model, errs
|
return newBytes, newDoc, model, errs
|
||||||
}
|
}
|
||||||
// this document is now dead, long live the new document!
|
// this document is now dead, long live the new document!
|
||||||
|
|||||||
Reference in New Issue
Block a user