oas3/spec/license.rs
1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4use url::Url;
5
6use super::spec_extensions;
7
8/// License information for the exposed API.
9///
10/// See <https://spec.openapis.org/oas/v3.1.1#license-object>.
11#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
12pub struct License {
13 /// The license name used for the API.
14 pub name: String,
15
16 /// An SPDX license expression for the API. The identifier field is mutually exclusive of the url field.
17 #[serde(skip_serializing_if = "Option::is_none")]
18 pub identifier: Option<String>,
19
20 /// A URL to the license used for the API.
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub url: Option<Url>,
23
24 /// Specification extensions.
25 ///
26 /// Only "x-" prefixed keys are collected, and the prefix is stripped.
27 ///
28 /// See <https://spec.openapis.org/oas/v3.1.1#specification-extensions>.
29 #[serde(flatten, with = "spec_extensions")]
30 pub extensions: BTreeMap<String, serde_json::Value>,
31}