[][src]Trait openapi_utils::SpecExt

pub trait SpecExt {
    fn deref_all(self) -> OpenAPI;
}

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

Required methods

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 there are no components 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;
Loading content...

Implementations on Foreign Types

impl SpecExt for OpenAPI[src]

fn deref_all(self) -> OpenAPI[src]

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

Loading content...

Implementors

Loading content...