openrpc_types/resolved.rs
1// This file is @generated by library tests
2
3//! Parallel types where [`ReferenceOr<T>`] is replaced by item `T`.
4
5use crate::*;
6use semver::Version;
7use serde::{Deserialize, Serialize};
8
9/// > This is the root object of the OpenRPC document.
10/// > The contents of this object represent a whole OpenRPC document.
11/// > How this object is constructed or stored is outside the scope of the OpenRPC Specification.
12#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13#[serde(rename_all = "camelCase")]
14pub struct OpenRPC {
15 /// > REQUIRED.
16 /// > This string MUST be the semantic version number of the OpenRPC Specification version that the OpenRPC document uses.
17 /// > The openrpc field SHOULD be used by tooling specifications and clients to interpret the OpenRPC document.
18 /// > This is not related to the API info.version string.
19 pub openrpc: Version,
20 /// > REQUIRED.
21 /// > Provides metadata about the API.
22 /// > The metadata MAY be used by tooling as required.
23 pub info: Info,
24 /// > An array of Server Objects,
25 /// > which provide connectivity information to a target server.
26 /// > If the servers property is not provided, or is an empty array,
27 /// > the default value would be a Server Object with a url value of `localhost`.
28 #[serde(skip_serializing_if = "Option::is_none")]
29 pub servers: Option<Vec<Server>>,
30 /// > REQUIRED.
31 /// > The available methods for the API.
32 /// > While it is required, the array may be empty (to handle security filtering, for example).
33 pub methods: Vec<Method>,
34 /// > An element to hold various schemas for the specification.
35 #[serde(skip_serializing_if = "Option::is_none")]
36 pub components: Option<Components>,
37 /// > Additional external documentation.
38 #[serde(skip_serializing_if = "Option::is_none")]
39 pub external_docs: Option<ExternalDocumentation>,
40 #[serde(flatten)]
41 pub extensions: SpecificationExtensions,
42}
43/// > Describes the interface for the given method name.
44/// > The method name is used as the method field of the JSON-RPC body.
45/// > It therefore MUST be unique.
46#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
47#[serde(rename_all = "camelCase")]
48pub struct Method {
49 /// > REQUIRED.
50 /// > The cannonical name for the method.
51 /// > The name MUST be unique within the methods array.
52 pub name: String,
53 /// > A list of tags for API documentation control.
54 /// > Tags can be used for logical grouping of methods by resources or any other qualifier.
55 #[serde(skip_serializing_if = "Option::is_none")]
56 pub tags: Option<Vec<Tag>>,
57 /// > A short summary of what the method does.
58 #[serde(skip_serializing_if = "Option::is_none")]
59 pub summary: Option<String>,
60 /// > A verbose explanation of the method behavior.
61 /// > GitHub Flavored Markdown syntax MAY be used for rich text representation.
62 #[serde(skip_serializing_if = "Option::is_none")]
63 pub description: Option<String>,
64 /// > Additional external documentation for this method.
65 #[serde(skip_serializing_if = "Option::is_none")]
66 pub external_docs: Option<ExternalDocumentation>,
67 /// > REQUIRED.
68 /// > A list of parameters that are applicable for this method.
69 /// > The list MUST NOT include duplicated parameters and therefore require name to be unique.
70 /// > The list can use the Reference Object to link to parameters that are defined by the Content Descriptor Object.
71 /// > All optional params (content descriptor objects with “required”: false) MUST be positioned after all required params in the list.
72 pub params: Vec<ContentDescriptor>,
73 /// > The description of the result returned by the method.
74 /// > If defined, it MUST be a Content Descriptor or Reference Object.
75 /// > If undefined, the method MUST only be used as a notification.
76 #[serde(skip_serializing_if = "Option::is_none")]
77 pub result: Option<ContentDescriptor>,
78 /// > Declares this method to be deprecated.
79 /// > Consumers SHOULD refrain from usage of the declared method.
80 /// > Default value is `false`.
81 #[serde(skip_serializing_if = "Option::is_none")]
82 pub deprecated: Option<bool>,
83 /// > An alternative servers array to service this method.
84 /// > If an alternative servers array is specified at the Root level,
85 /// > it will be overridden by this value.
86 #[serde(skip_serializing_if = "Option::is_none")]
87 pub servers: Option<Vec<Server>>,
88 /// > A list of custom application defined errors that MAY be returned.
89 /// > The Errors MUST have unique error codes.
90 #[serde(skip_serializing_if = "Option::is_none")]
91 pub errors: Option<Vec<Error>>,
92 // /// > A list of possible links from this method call.
93 // pub links: Option<Vec<Link>>,
94 #[serde(skip_serializing_if = "Option::is_none")]
95 pub param_structure: Option<ParamStructure>,
96 /// > Array of Example Pairing Objects where each example includes a valid params-to-result Content Descriptor pairing.
97 #[serde(skip_serializing_if = "Option::is_none")]
98 pub examples: Option<Vec<ExamplePairing>>,
99 #[serde(flatten)]
100 pub extensions: SpecificationExtensions,
101}
102/// > The Example Pairing object consists of a set of example params and result.
103/// > The result is what you can expect from the JSON-RPC service given the exact params.
104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
105pub struct ExamplePairing {
106 /// > REQUIRED Name for the example pairing.
107 pub name: String,
108 /// > A verbose explanation of the example pairing.
109 #[serde(skip_serializing_if = "Option::is_none")]
110 pub description: Option<String>,
111 /// > Short description for the example pairing.
112 #[serde(skip_serializing_if = "Option::is_none")]
113 pub summary: Option<String>,
114 /// > REQUIRED Example parameters.
115 pub params: Vec<Example>,
116 /// > Example result.
117 /// > When undefined, the example pairing represents usage of the method as a notification.
118 #[serde(skip_serializing_if = "Option::is_none")]
119 pub result: Option<Example>,
120 #[serde(flatten)]
121 pub extensions: SpecificationExtensions,
122}