refine open doc types
@@ -2,8 +2,21 @@ use std::collections::HashMap;
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
-pub(crate) struct DocSchema {
+pub(crate) struct DocSchema {}
+#[derive(Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub(crate) struct DocContact {
+ name: Option<String>,
+ url: Option<String>,
+ email: Option<String>,
+}
+
+#[derive(Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub(crate) struct DocLicense {
+ name: String,
+ url: Option<String>,
}
#[derive(Serialize, Deserialize)]
@@ -12,14 +25,14 @@ pub(crate) struct DocInfo {
title: String,
description: Option<String>,
terms_of_service: Option<String>,
- contact: Option<String>,
- license: Option<String>,
+ contact: Option<DocContact>,
+ license: Option<DocLicense>,
version: String,
}
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
-pub(crate) struct DocExternal {
+pub(crate) struct DocExternalDocumentation {
url: String,
description: Option<String>,
}
@@ -30,7 +43,7 @@ pub(crate) struct DocTag {
name: String,
summary: Option<String>,
description: Option<String>,
- external_docs: Option<DocExternal>,
+ external_docs: Option<DocExternalDocumentation>,
}
#[derive(Serialize, Deserialize)]
@@ -100,7 +113,7 @@ pub(crate) struct DocMethod {
tags: Option<Vec<DocTag>>,
summary: Option<String>,
description: Option<String>,
- external_docs: Option<DocExternal>,
+ external_docs: Option<DocExternalDocumentation>,
params: Vec<DocContentDescriptor>,
result: DocContentDescriptor,
deprecated: Option<bool>,
@@ -112,8 +125,24 @@ pub(crate) struct DocMethod {
}
#[derive(Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub(crate) struct DocComponents {
+ content_descriptors: Option<HashMap<String, DocContentDescriptor>>,
+ schemas: Option<HashMap<String, DocSchema>>,
+ examples: Option<HashMap<String, DocExample>>,
+ links: Option<HashMap<String, DocLink>>,
+ errors: Option<HashMap<String, DocError>>,
+ example_pairing_objects: Option<HashMap<String, DocExamplePairing>>,
+ tags: Option<HashMap<String, DocTag>>,
+}
+
+#[derive(Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub(crate) struct OpenDoc {
openrpc: String,
info: DocInfo,
methods: Vec<DocMethod>,
+ servers: Option<Vec<DocServer>>,
+ external_docs: Option<DocExternalDocumentation>,
+ components: Option<DocComponents>,
}
