{
"definitions": {
"Student": {
"description": "A simple student struct",
"type": "struct",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
},
"root": "Student"
}
use serde::{Serialize, Deserialize};
// A simple student struct
#[derive(Serialize, Deserialize)]
pub struct Student {
#[serde(rename = "firstName")]
first_name: Option<String>,
#[serde(rename = "lastName")]
last_name: Option<String>,
#[serde(rename = "age")]
age: Option<u64>,
}
{
"definitions": {
"Human": {
"type": "struct",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
},
"Student": {
"parent": {
"type": "reference",
"target": "Human"
},
"type": "struct",
"properties": {
"studentId": {
"type": "string"
}
}
}
},
"root": "Student"
}
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
pub struct Human {
#[serde(rename = "firstName")]
first_name: Option<String>,
#[serde(rename = "lastName")]
last_name: Option<String>,
#[serde(rename = "age")]
age: Option<u64>,
}
use serde::{Serialize, Deserialize};
use human::Human;
#[derive(Serialize, Deserialize)]
pub struct Student {
#[serde(rename = "firstName")]
first_name: Option<String>,
#[serde(rename = "lastName")]
last_name: Option<String>,
#[serde(rename = "age")]
age: Option<u64>,
#[serde(rename = "studentId")]
student_id: Option<String>,
}
{
"definitions": {
"Student": {
"description": "A student struct with an assigned faculty",
"type": "struct",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"faculty": {
"type": "reference",
"target": "Faculty"
}
}
},
"Faculty": {
"type": "struct",
"properties": {
"name": {
"type": "string"
}
}
}
},
"root": "Student"
}
use serde::{Serialize, Deserialize};
use faculty::Faculty;
// A student struct with an assigned faculty
#[derive(Serialize, Deserialize)]
pub struct Student {
#[serde(rename = "firstName")]
first_name: Option<String>,
#[serde(rename = "lastName")]
last_name: Option<String>,
#[serde(rename = "age")]
age: Option<u64>,
#[serde(rename = "faculty")]
faculty: Option<Faculty>,
}
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
pub struct Faculty {
#[serde(rename = "name")]
name: Option<String>,
}
{
"definitions": {
"Student": {
"type": "struct",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"properties": {
"type": "map",
"schema": {
"type": "string"
}
}
}
}
},
"root": "Student"
}
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
pub struct Student {
#[serde(rename = "firstName")]
first_name: Option<String>,
#[serde(rename = "lastName")]
last_name: Option<String>,
#[serde(rename = "age")]
age: Option<u64>,
#[serde(rename = "properties")]
properties: Option<std::collections::HashMap<String, String>>,
}
{
"definitions": {
"Human": {
"type": "struct",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"location": {
"type": "reference",
"target": "Location"
}
}
},
"Location": {
"type": "struct",
"base": true,
"properties": {
"type": {
"type": "string"
}
},
"discriminator": "type",
"mapping": {
"Web": "web",
"World": "world"
}
},
"Web": {
"parent": {
"type": "reference",
"target": "Location"
},
"type": "struct",
"properties": {
"url": {
"type": "string"
}
}
},
"World": {
"parent": {
"type": "reference",
"target": "Location"
},
"type": "struct",
"properties": {
"lat": {
"type": "string"
},
"long": {
"type": "string"
}
}
}
},
"root": "Human"
}
use serde::{Serialize, Deserialize};
use location::Location;
#[derive(Serialize, Deserialize)]
pub struct Human {
#[serde(rename = "firstName")]
first_name: Option<String>,
#[serde(rename = "lastName")]
last_name: Option<String>,
#[serde(rename = "location")]
location: Option<Location>,
}
use serde::{Serialize, Deserialize};
use web::Web;
use world::World;
#[derive(Serialize, Deserialize)]
pub struct Location {
#[serde(rename = "type")]
_type: Option<String>,
}
use serde::{Serialize, Deserialize};
use location::Location;
#[derive(Serialize, Deserialize)]
pub struct Web {
#[serde(rename = "type")]
_type: Option<String>,
#[serde(rename = "url")]
url: Option<String>,
}
use serde::{Serialize, Deserialize};
use location::Location;
#[derive(Serialize, Deserialize)]
pub struct World {
#[serde(rename = "type")]
_type: Option<String>,
#[serde(rename = "lat")]
lat: Option<String>,
#[serde(rename = "long")]
long: Option<String>,
}
{
"definitions": {
"Student": {
"type": "struct",
"properties": {
"matricleNumber": {
"type": "integer"
}
}
},
"StudentMap": {
"type": "struct",
"parent": {
"type": "reference",
"target": "Map",
"template": {
"T": "Student"
}
}
},
"Map": {
"type": "struct",
"properties": {
"totalResults": {
"type": "integer"
},
"entries": {
"type": "array",
"schema": {
"type": "generic",
"name": "T"
}
}
}
}
},
"root": "StudentMap"
}
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
pub struct Student {
#[serde(rename = "matricleNumber")]
matricle_number: Option<u64>,
}
use serde::{Serialize, Deserialize};
use map::Map;
use student::Student;
#[derive(Serialize, Deserialize)]
pub struct StudentMap {
#[serde(rename = "totalResults")]
total_results: Option<u64>,
#[serde(rename = "entries")]
entries: Option<Vec<Student>>,
}
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)]
pub struct Map {
#[serde(rename = "totalResults")]
total_results: Option<u64>,
#[serde(rename = "entries")]
entries: Option<Vec<T>>,
}
{
"import": {
"my_ns": "file:///generic.json"
},
"definitions": {
"Faculty": {
"type": "struct",
"properties": {
"description": {
"type": "string"
},
"students": {
"type": "array",
"schema": {
"type": "reference",
"target": "my_ns:StudentMap"
}
}
}
}
},
"root": "Faculty"
}
use serde::{Serialize, Deserialize};
use student_map::StudentMap;
#[derive(Serialize, Deserialize)]
pub struct Faculty {
#[serde(rename = "description")]
description: Option<String>,
#[serde(rename = "students")]
students: Option<Vec<StudentMap>>,
}