nautobot_openapi/models/content_type.rs
1/*
2 * API Documentation
3 *
4 * Source of truth and network automation platform
5 *
6 * The version of the OpenAPI document: 3.1.0 (3.1)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// ContentType : This base serializer implements common fields and logic for all ModelSerializers. Namely, it: - defines the `display` field which exposes a human friendly value for the given object. - ensures that `id` field is always present on the serializer as well. - ensures that `created` and `last_updated` fields are always present if applicable to this model and serializer. - ensures that `object_type` field is always present on the serializer which represents the content-type of this serializer's associated model (e.g. \"dcim.device\"). This is required as the OpenAPI schema, using the PolymorphicProxySerializer class defined below, relies upon this field as a way to identify to the client which of several possible serializers are in use for a given attribute. - supports `?depth` query parameter. It is passed in as `nested_depth` to the `build_nested_field()` function to enable the dynamic generation of nested serializers.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct ContentType {
15 #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16 pub id: Option<i32>,
17 #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
18 pub object_type: Option<String>,
19 #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
20 pub display: Option<String>,
21 #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
22 pub url: Option<String>,
23 #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
24 pub natural_slug: Option<String>,
25 #[serde(rename = "app_label")]
26 pub app_label: String,
27 #[serde(rename = "model")]
28 pub model: String,
29}
30
31impl ContentType {
32 /// This base serializer implements common fields and logic for all ModelSerializers. Namely, it: - defines the `display` field which exposes a human friendly value for the given object. - ensures that `id` field is always present on the serializer as well. - ensures that `created` and `last_updated` fields are always present if applicable to this model and serializer. - ensures that `object_type` field is always present on the serializer which represents the content-type of this serializer's associated model (e.g. \"dcim.device\"). This is required as the OpenAPI schema, using the PolymorphicProxySerializer class defined below, relies upon this field as a way to identify to the client which of several possible serializers are in use for a given attribute. - supports `?depth` query parameter. It is passed in as `nested_depth` to the `build_nested_field()` function to enable the dynamic generation of nested serializers.
33 pub fn new(app_label: String, model: String) -> ContentType {
34 ContentType {
35 id: None,
36 object_type: None,
37 display: None,
38 url: None,
39 natural_slug: None,
40 app_label,
41 model,
42 }
43 }
44}