diff --git a/src/compare.rs b/src/compare.rs index eb77743..f32fff3 100644 --- a/src/compare.rs +++ b/src/compare.rs @@ -1,7 +1,8 @@ -// Copyright 2025 Oxide Computer Company +// Copyright 2026 Oxide Computer Company use std::collections::BTreeMap; +use anyhow::Context as _; use indexmap::IndexMap; use openapiv3::{ MediaType, Operation, Parameter, ParameterSchemaOrContent, ReferenceOr, RequestBody, @@ -35,10 +36,12 @@ pub(crate) struct Compare { impl Compare { pub fn compare(&mut self, old: &Value, new: &Value) -> anyhow::Result<()> { let old_context = Context::new(old); - let old_operations = operations(&old_context)?; + let old_operations = + operations(&old_context).context("error deserializing old OpenAPI document")?; let new_context = Context::new(new); - let new_operations = operations(&new_context)?; + let new_operations = + operations(&new_context).context("error deserializing new OpenAPI document")?; let SetCompare { a_unique, diff --git a/src/operations.rs b/src/operations.rs index 700cd44..d21af01 100644 --- a/src/operations.rs +++ b/src/operations.rs @@ -41,7 +41,7 @@ pub struct OperationInfo<'a> { pub fn operations<'a>( context: &Context<'a>, ) -> anyhow::Result)>> { - let api = OpenAPI::deserialize(context.raw_openapi).unwrap(); + let api = OpenAPI::deserialize(context.raw_openapi)?; let mut out = Vec::new();