pub trait SpecExt {
    // Required method
    fn deref_all(self) -> OpenAPI;
}
Expand description

Extends an openapi spec with a method to dereference all its contents

Required Methods§

source

fn deref_all(self) -> OpenAPI

Dereferences all the $ref refences in the OpenAPI description. Consumes the Spec object and creates a new one with all references resolved Note that because the inner structures are using ReferenceOr you will still need to use the methods from the ReferenceOr extension to access the data. But these methods will always succeed as all references have been resolved ahead of time.

§Panics

This method will panic if the referenced item is not present in the OpenAPI description. This method will panic AdditionalProperties

§Example
  let data = std::fs::read_to_string(filename).expect("OpenAPI file could not be read.");
  let deser = serde_yaml::from_str(&data).expect("Could not deserialize file as OpenAPI v3.0");
  let spec = spec::read(&deser).deref_all();
  let paths = spec.paths;

Implementations on Foreign Types§

source§

impl SpecExt for OpenAPI

source§

fn deref_all(self) -> OpenAPI

Dereferences all the internal references in a document by copying the items in the place of the references.

Implementors§