oas3-rs icon indicating copy to clipboard operation
oas3-rs copied to clipboard

Cannot Resolve ObjectOrReference<Header>

Open CodingFlow opened this issue 2 years ago • 0 comments

Cannot call resolve on ObjectOrReference<Header>. In a minimal example project, the compiler error message:

the method resolve exists for enum ObjectOrReference<Header>, but its trait bounds were not satisfied the following trait bounds were not satisfied: oas3::spec::Header: FromRefrustcClick for full compiler diagnostic header.rs(20, 1): doesn't satisfy oas3::spec::Header: FromRef

The code showing the issue with oas3 = "0.4" in cargo.toml:

fn main() {
    let mut spec = oas3::from_path("path").unwrap();

    let path = spec.paths.pop_first();
    let operation = path.unwrap().1.get.unwrap();
    let mut responses = operation.responses(&spec);
    let response = responses.pop_first().unwrap();
    let mut headers_refs = response.1.headers;
    let header_ref = headers_refs.pop_first().unwrap();
    let header = header_ref.1.resolve(&spec); // compile error here
}

I'd appreciate if someone could at least provide a workaround until the issue is fixed. 🙇

CodingFlow avatar Nov 22 '23 23:11 CodingFlow