Skip to main content

openapi_refs

Function openapi_refs 

Source
pub fn openapi_refs(schema: &Value) -> Vec<String>
Expand description

Collect all $ref paths from a schema object.

Designed to be used with to_openapi.

ยงExample

use vld_ts::openapi_refs;

let schema = serde_json::json!({
    "type": "object",
    "properties": {
        "address": { "$ref": "#/components/schemas/Address" }
    }
});

let refs = openapi_refs(&schema);
assert_eq!(refs, vec!["#/components/schemas/Address".to_string()]);