MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / generates_document

Function generates_document

ra-rpc/src/openapi.rs:1124–1141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1122
1123 #[test]
1124 fn generates_document() {
1125 let descriptor = test_descriptor();
1126 let sources = vec![DescriptorSource::new(
1127 &descriptor,
1128 vec![ServiceConfig::new("TestService", "/prpc")],
1129 )];
1130 let info = DocumentInfo::new("Test API", "1.0.0")
1131 .with_description("test-only spec")
1132 .add_server("http://localhost:8000/prpc");
1133 let json = generate_document(&sources, &info).expect("spec");
1134 let doc: Value = serde_json::from_str(&json).expect("valid json");
1135 assert_eq!(doc["info"]["title"], "Test API");
1136 assert!(
1137 doc["paths"]["/prpc/Ping"]["post"]["requestBody"]["content"]["application/json"]
1138 ["schema"]
1139 .is_object()
1140 );
1141 }
1142}

Callers

nothing calls this directly

Calls 4

test_descriptorFunction · 0.85
generate_documentFunction · 0.85
add_serverMethod · 0.80
with_descriptionMethod · 0.80

Tested by

no test coverage detected