TypeSchema is a JSON format to describe data models in a language neutral format. A TypeSchema can be easily transformed into specific code for almost any programming language. This helps to reuse core data models in different environments.
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
},
"$ref": "Student"
}
public class Student
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
}
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
}
type Student {
firstName: String
lastName: String
age: Int
}
<div id="Student" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Student">Student</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"firstName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"lastName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"age"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Integer</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">firstName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">lastName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">age</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Integer">Integer</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Student {
private String firstName;
private String lastName;
private int age;
@JsonSetter("firstName")
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@JsonGetter("firstName")
public String getFirstName() {
return this.firstName;
}
@JsonSetter("lastName")
public void setLastName(String lastName) {
this.lastName = lastName;
}
@JsonGetter("lastName")
public String getLastName() {
return this.lastName;
}
@JsonSetter("age")
public void setAge(int age) {
this.age = age;
}
@JsonGetter("age")
public int getAge() {
return this.age;
}
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
},
"$ref": "#\/definitions\/Student"
}
open class Student {
var firstName: String? = null
var lastName: String? = null
var age: Int? = null
}
# Student
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
firstName | String | |
lastName | String | |
age | Integer | |
class Student implements \JsonSerializable
{
protected ?string $firstName = null;
protected ?string $lastName = null;
protected ?int $age = null;
public function setFirstName(?string $firstName) : void
{
$this->firstName = $firstName;
}
public function getFirstName() : ?string
{
return $this->firstName;
}
public function setLastName(?string $lastName) : void
{
$this->lastName = $lastName;
}
public function getLastName() : ?string
{
return $this->lastName;
}
public function setAge(?int $age) : void
{
$this->age = $age;
}
public function getAge() : ?int
{
return $this->age;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('firstName' => $this->firstName, 'lastName' => $this->lastName, 'age' => $this->age), static function ($value) : bool {
return $value !== null;
});
}
}
message Student {
string firstName = 1;
string lastName = 2;
int64 age = 3;
}
from typing import Any
class Student:
def __init__(self, first_name: str, last_name: str, age: int):
self.first_name = first_name
self.last_name = last_name
self.age = age
class Student
attr_accessor :first_name, :last_name, :age
def initialize(first_name, last_name, age)
@first_name = first_name
@last_name = last_name
@age = age
end
end
struct Student {
firstName: String,
lastName: String,
age: u64,
}
class Student: Codable {
var firstName: String
var lastName: String
var age: Int
}
export interface Student {
firstName?: string
lastName?: string
age?: number
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
},
"$ref": "Student"
}
{
"definitions": {
"Human": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
},
"Student": {
"$extends": "Human",
"type": "object",
"properties": {
"studentId": {
"type": "string"
}
}
}
},
"$ref": "Student"
}
public class Human
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
}
public class Student extends Human
{
public string StudentId { get; set; }
}
type Human struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
}
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
StudentId string `json:"studentId"`
}
type Human {
firstName: String
lastName: String
age: Int
}
type Student {
studentId: String
}
<div id="Human" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Human">Human</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"firstName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"lastName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"age"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Integer</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">firstName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">lastName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">age</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Integer">Integer</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
<div id="Student" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Student">Student</a> extends <a class="psx-type-link" data-name="Human">Human</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"studentId"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">studentId</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Human {
private String firstName;
private String lastName;
private int age;
@JsonSetter("firstName")
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@JsonGetter("firstName")
public String getFirstName() {
return this.firstName;
}
@JsonSetter("lastName")
public void setLastName(String lastName) {
this.lastName = lastName;
}
@JsonGetter("lastName")
public String getLastName() {
return this.lastName;
}
@JsonSetter("age")
public void setAge(int age) {
this.age = age;
}
@JsonGetter("age")
public int getAge() {
return this.age;
}
}
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Student extends Human {
private String studentId;
@JsonSetter("studentId")
public void setStudentId(String studentId) {
this.studentId = studentId;
}
@JsonGetter("studentId")
public String getStudentId() {
return this.studentId;
}
}
{
"definitions": {
"Human": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
},
"Student": {
"allOf": [
{
"$ref": "#\/definitions\/Human"
},
{
"type": "object",
"properties": {
"studentId": {
"type": "string"
}
}
}
]
}
},
"$ref": "#\/definitions\/Student"
}
open class Human {
var firstName: String? = null
var lastName: String? = null
var age: Int? = null
}
open class Student : Human {
var studentId: String? = null
}
# Human
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
firstName | String | |
lastName | String | |
age | Integer | |
# Student
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
studentId | String | |
class Human implements \JsonSerializable
{
protected ?string $firstName = null;
protected ?string $lastName = null;
protected ?int $age = null;
public function setFirstName(?string $firstName) : void
{
$this->firstName = $firstName;
}
public function getFirstName() : ?string
{
return $this->firstName;
}
public function setLastName(?string $lastName) : void
{
$this->lastName = $lastName;
}
public function getLastName() : ?string
{
return $this->lastName;
}
public function setAge(?int $age) : void
{
$this->age = $age;
}
public function getAge() : ?int
{
return $this->age;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('firstName' => $this->firstName, 'lastName' => $this->lastName, 'age' => $this->age), static function ($value) : bool {
return $value !== null;
});
}
}
class Student extends Human implements \JsonSerializable
{
protected ?string $studentId = null;
public function setStudentId(?string $studentId) : void
{
$this->studentId = $studentId;
}
public function getStudentId() : ?string
{
return $this->studentId;
}
public function jsonSerialize() : object
{
return (object) array_merge((array) parent::jsonSerialize(), array_filter(array('studentId' => $this->studentId), static function ($value) : bool {
return $value !== null;
}));
}
}
message Human {
string firstName = 1;
string lastName = 2;
int64 age = 3;
}
message Student {
string studentId = 1;
}
from typing import Any
class Human:
def __init__(self, first_name: str, last_name: str, age: int):
self.first_name = first_name
self.last_name = last_name
self.age = age
from typing import Any
class Student(Human):
def __init__(self, student_id: str):
self.student_id = student_id
class Human
attr_accessor :first_name, :last_name, :age
def initialize(first_name, last_name, age)
@first_name = first_name
@last_name = last_name
@age = age
end
end
class Student
extend Human
attr_accessor :student_id
def initialize(student_id)
@student_id = student_id
end
end
struct Human {
firstName: String,
lastName: String,
age: u64,
}
struct Student {
*Human
studentId: String,
}
class Human: Codable {
var firstName: String
var lastName: String
var age: Int
}
class Student: Human {
var studentId: String
}
export interface Human {
firstName?: string
lastName?: string
age?: number
}
import {Human} from "./Human";
export interface Student extends Human {
studentId?: string
}
{
"definitions": {
"Human": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
}
}
},
"Student": {
"$extends": "Human",
"type": "object",
"properties": {
"studentId": {
"type": "string"
}
}
}
},
"$ref": "Student"
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"faculty": {
"$ref": "Faculty"
}
}
},
"Faculty": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
}
},
"$ref": "Student"
}
public class Student
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public Faculty Faculty { get; set; }
}
public class Faculty
{
public string Name { get; set; }
}
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
Faculty Faculty `json:"faculty"`
}
type Faculty struct {
Name string `json:"name"`
}
type Student {
firstName: String
lastName: String
age: Int
faculty: Faculty
}
type Faculty {
name: String
}
<div id="Student" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Student">Student</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"firstName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"lastName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"age"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Integer</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"faculty"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Faculty</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">firstName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">lastName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">age</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Integer">Integer</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">faculty</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Faculty">Faculty</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
<div id="Faculty" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Faculty">Faculty</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"name"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">name</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Student {
private String firstName;
private String lastName;
private int age;
private Faculty faculty;
@JsonSetter("firstName")
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@JsonGetter("firstName")
public String getFirstName() {
return this.firstName;
}
@JsonSetter("lastName")
public void setLastName(String lastName) {
this.lastName = lastName;
}
@JsonGetter("lastName")
public String getLastName() {
return this.lastName;
}
@JsonSetter("age")
public void setAge(int age) {
this.age = age;
}
@JsonGetter("age")
public int getAge() {
return this.age;
}
@JsonSetter("faculty")
public void setFaculty(Faculty faculty) {
this.faculty = faculty;
}
@JsonGetter("faculty")
public Faculty getFaculty() {
return this.faculty;
}
}
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Faculty {
private String name;
@JsonSetter("name")
public void setName(String name) {
this.name = name;
}
@JsonGetter("name")
public String getName() {
return this.name;
}
}
{
"definitions": {
"Faculty": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"faculty": {
"$ref": "#\/definitions\/Faculty"
}
}
}
},
"$ref": "#\/definitions\/Student"
}
open class Student {
var firstName: String? = null
var lastName: String? = null
var age: Int? = null
var faculty: Faculty? = null
}
open class Faculty {
var name: String? = null
}
# Student
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
firstName | String | |
lastName | String | |
age | Integer | |
faculty | Faculty | |
# Faculty
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
name | String | |
class Student implements \JsonSerializable
{
protected ?string $firstName = null;
protected ?string $lastName = null;
protected ?int $age = null;
protected ?Faculty $faculty = null;
public function setFirstName(?string $firstName) : void
{
$this->firstName = $firstName;
}
public function getFirstName() : ?string
{
return $this->firstName;
}
public function setLastName(?string $lastName) : void
{
$this->lastName = $lastName;
}
public function getLastName() : ?string
{
return $this->lastName;
}
public function setAge(?int $age) : void
{
$this->age = $age;
}
public function getAge() : ?int
{
return $this->age;
}
public function setFaculty(?Faculty $faculty) : void
{
$this->faculty = $faculty;
}
public function getFaculty() : ?Faculty
{
return $this->faculty;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('firstName' => $this->firstName, 'lastName' => $this->lastName, 'age' => $this->age, 'faculty' => $this->faculty), static function ($value) : bool {
return $value !== null;
});
}
}
class Faculty implements \JsonSerializable
{
protected ?string $name = null;
public function setName(?string $name) : void
{
$this->name = $name;
}
public function getName() : ?string
{
return $this->name;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('name' => $this->name), static function ($value) : bool {
return $value !== null;
});
}
}
message Student {
string firstName = 1;
string lastName = 2;
int64 age = 3;
Faculty faculty = 4;
}
message Faculty {
string name = 1;
}
from typing import Any
class Student:
def __init__(self, first_name: str, last_name: str, age: int, faculty: Faculty):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.faculty = faculty
from typing import Any
class Faculty:
def __init__(self, name: str):
self.name = name
class Student
attr_accessor :first_name, :last_name, :age, :faculty
def initialize(first_name, last_name, age, faculty)
@first_name = first_name
@last_name = last_name
@age = age
@faculty = faculty
end
end
class Faculty
attr_accessor :name
def initialize(name)
@name = name
end
end
struct Student {
firstName: String,
lastName: String,
age: u64,
faculty: Faculty,
}
struct Faculty {
name: String,
}
class Student: Codable {
var firstName: String
var lastName: String
var age: Int
var faculty: Faculty
}
class Faculty: Codable {
var name: String
}
import {Faculty} from "./Faculty";
export interface Student {
firstName?: string
lastName?: string
age?: number
faculty?: Faculty
}
export interface Faculty {
name?: string
}
{
"definitions": {
"Faculty": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"faculty": {
"$ref": "Faculty"
}
}
}
},
"$ref": "Student"
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"properties": {
"$ref": "Student_Properties"
}
}
},
"Student_Properties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"$ref": "Student"
}
public class Student
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public StudentProperties Properties { get; set; }
}
using System.Collections.Generic;
public class StudentProperties : Dictionary<string, string>
{
}
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
Properties StudentProperties `json:"properties"`
}
type StudentProperties = map[string]string
type Student {
firstName: String
lastName: String
age: Int
properties: [String]
}
<div id="Student" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Student">Student</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"firstName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"lastName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"age"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Integer</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"properties"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Student_Properties</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">firstName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">lastName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">age</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Integer">Integer</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">properties</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Student_Properties">Student_Properties</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
<div id="StudentProperties" class="psx-object psx-map"><h1><a class="psx-type-link" data-name="StudentProperties">StudentProperties</a></h1><pre class="psx-object-json">Map (String)</pre></div>
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Student {
private String firstName;
private String lastName;
private int age;
private StudentProperties properties;
@JsonSetter("firstName")
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@JsonGetter("firstName")
public String getFirstName() {
return this.firstName;
}
@JsonSetter("lastName")
public void setLastName(String lastName) {
this.lastName = lastName;
}
@JsonGetter("lastName")
public String getLastName() {
return this.lastName;
}
@JsonSetter("age")
public void setAge(int age) {
this.age = age;
}
@JsonGetter("age")
public int getAge() {
return this.age;
}
@JsonSetter("properties")
public void setProperties(StudentProperties properties) {
this.properties = properties;
}
@JsonGetter("properties")
public StudentProperties getProperties() {
return this.properties;
}
}
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
import java.util.HashMap;
public class StudentProperties extends HashMap<String, String> {
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"properties": {
"$ref": "#\/definitions\/Student_Properties"
}
}
},
"Student_Properties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"$ref": "#\/definitions\/Student"
}
open class Student {
var firstName: String? = null
var lastName: String? = null
var age: Int? = null
var properties: StudentProperties? = null
}
import java.util.HashMap;
open class StudentProperties : HashMap<String, String>() {
}
# Student
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
firstName | String | |
lastName | String | |
age | Integer | |
properties | Student_Properties | |
# StudentProperties
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
* | Map (String) | |
class Student implements \JsonSerializable
{
protected ?string $firstName = null;
protected ?string $lastName = null;
protected ?int $age = null;
protected ?StudentProperties $properties = null;
public function setFirstName(?string $firstName) : void
{
$this->firstName = $firstName;
}
public function getFirstName() : ?string
{
return $this->firstName;
}
public function setLastName(?string $lastName) : void
{
$this->lastName = $lastName;
}
public function getLastName() : ?string
{
return $this->lastName;
}
public function setAge(?int $age) : void
{
$this->age = $age;
}
public function getAge() : ?int
{
return $this->age;
}
public function setProperties(?StudentProperties $properties) : void
{
$this->properties = $properties;
}
public function getProperties() : ?StudentProperties
{
return $this->properties;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('firstName' => $this->firstName, 'lastName' => $this->lastName, 'age' => $this->age, 'properties' => $this->properties), static function ($value) : bool {
return $value !== null;
});
}
}
/**
* @extends \PSX\Record\Record<string>
*/
class StudentProperties extends \PSX\Record\Record
{
}
message Student {
string firstName = 1;
string lastName = 2;
int64 age = 3;
map<string, string> properties = 4;
}
from typing import Any
class Student:
def __init__(self, first_name: str, last_name: str, age: int, properties: StudentProperties):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.properties = properties
from typing import Any
from typing import Dict
class StudentProperties(Dict[str, str]):
class Student
attr_accessor :first_name, :last_name, :age, :properties
def initialize(first_name, last_name, age, properties)
@first_name = first_name
@last_name = last_name
@age = age
@properties = properties
end
end
struct Student {
firstName: String,
lastName: String,
age: u64,
properties: StudentProperties,
}
type StudentProperties = HashMap<String, String>() {
}
class Student: Codable {
var firstName: String
var lastName: String
var age: Int
var properties: StudentProperties
}
typealias StudentProperties = Dictionary<String, String>;
import {StudentProperties} from "./StudentProperties";
export interface Student {
firstName?: string
lastName?: string
age?: number
properties?: StudentProperties
}
export type StudentProperties = Record<string, string>;
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"properties": {
"$ref": "Student_Properties"
}
}
},
"Student_Properties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"$ref": "Student"
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"properties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"$ref": "Student"
}
using System.Collections.Generic;
public class Student
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public Dictionary<string, string> Properties { get; set; }
}
type Student struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Age int `json:"age"`
Properties map[string]string `json:"properties"`
}
type Student {
firstName: String
lastName: String
age: Int
properties: [String]
}
<div id="Student" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Student">Student</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"firstName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"lastName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"age"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Integer</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"properties"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Map (String)</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">firstName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">lastName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">age</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Integer">Integer</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">properties</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Map (String)">Map (String)</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
import java.util.HashMap;
public class Student {
private String firstName;
private String lastName;
private int age;
private HashMap<String, String> properties;
@JsonSetter("firstName")
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@JsonGetter("firstName")
public String getFirstName() {
return this.firstName;
}
@JsonSetter("lastName")
public void setLastName(String lastName) {
this.lastName = lastName;
}
@JsonGetter("lastName")
public String getLastName() {
return this.lastName;
}
@JsonSetter("age")
public void setAge(int age) {
this.age = age;
}
@JsonGetter("age")
public int getAge() {
return this.age;
}
@JsonSetter("properties")
public void setProperties(HashMap<String, String> properties) {
this.properties = properties;
}
@JsonGetter("properties")
public HashMap<String, String> getProperties() {
return this.properties;
}
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"properties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"$ref": "#\/definitions\/Student"
}
import java.util.HashMap;
open class Student {
var firstName: String? = null
var lastName: String? = null
var age: Int? = null
var properties: HashMap<String, String>? = null
}
# Student
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
firstName | String | |
lastName | String | |
age | Integer | |
properties | Map (String) | |
class Student implements \JsonSerializable
{
protected ?string $firstName = null;
protected ?string $lastName = null;
protected ?int $age = null;
/**
* @var \PSX\Record\Record<string>|null
*/
protected ?\PSX\Record\Record $properties = null;
public function setFirstName(?string $firstName) : void
{
$this->firstName = $firstName;
}
public function getFirstName() : ?string
{
return $this->firstName;
}
public function setLastName(?string $lastName) : void
{
$this->lastName = $lastName;
}
public function getLastName() : ?string
{
return $this->lastName;
}
public function setAge(?int $age) : void
{
$this->age = $age;
}
public function getAge() : ?int
{
return $this->age;
}
public function setProperties(?\PSX\Record\Record $properties) : void
{
$this->properties = $properties;
}
public function getProperties() : ?\PSX\Record\Record
{
return $this->properties;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('firstName' => $this->firstName, 'lastName' => $this->lastName, 'age' => $this->age, 'properties' => $this->properties), static function ($value) : bool {
return $value !== null;
});
}
}
message Student {
string firstName = 1;
string lastName = 2;
int64 age = 3;
map<string, string> properties = 4;
}
from typing import Any
from typing import Dict
class Student:
def __init__(self, first_name: str, last_name: str, age: int, properties: Dict[str, str]):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.properties = properties
class Student
attr_accessor :first_name, :last_name, :age, :properties
def initialize(first_name, last_name, age, properties)
@first_name = first_name
@last_name = last_name
@age = age
@properties = properties
end
end
struct Student {
firstName: String,
lastName: String,
age: u64,
properties: HashMap<String, String>,
}
class Student: Codable {
var firstName: String
var lastName: String
var age: Int
var properties: Dictionary<String, String>
}
export interface Student {
firstName?: string
lastName?: string
age?: number
properties?: Record<string, string>
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"type": "integer"
},
"properties": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"$ref": "Student"
}
{
"definitions": {
"Human": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"location": {
"oneOf": [{
"$ref": "Web"
}, {
"$ref": "World"
}],
"discriminator": {
"propertyName": "type"
}
}
}
},
"Location": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
},
"required": ["type"]
},
"Web": {
"$extends": "Location",
"type": "object",
"properties": {
"url": {
"type": "string"
}
}
},
"World": {
"$extends": "Location",
"type": "object",
"properties": {
"lat": {
"type": "string"
},
"long": {
"type": "string"
}
}
}
},
"$ref": "Human"
}
public class Human
{
public string FirstName { get; set; }
public string LastName { get; set; }
public object Location { get; set; }
}
public class Location
{
public string Type { get; set; }
}
public class Web extends Location
{
public string Url { get; set; }
}
public class World extends Location
{
public string Lat { get; set; }
public string Long { get; set; }
}
type Human struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Location interface{} `json:"location"`
}
type Location struct {
Type string `json:"type"`
}
type Web struct {
Type string `json:"type"`
Url string `json:"url"`
}
type World struct {
Type string `json:"type"`
Lat string `json:"lat"`
Long string `json:"long"`
}
type Human {
firstName: String
lastName: String
location: Web | World
}
type Location {
type: String!
}
type Web {
url: String
}
type World {
lat: String
long: String
}
<div id="Human" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Human">Human</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"firstName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"lastName"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"location"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Web | World</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">firstName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">lastName</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">location</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Web | World">Web | World</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
<div id="Location" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Location">Location</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"type"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-required">type</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
<div id="Web" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Web">Web</a> extends <a class="psx-type-link" data-name="Location">Location</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"url"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">url</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
<div id="World" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="World">World</a> extends <a class="psx-type-link" data-name="Location">Location</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"lat"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"long"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">lat</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">long</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Human {
private String firstName;
private String lastName;
private Object location;
@JsonSetter("firstName")
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@JsonGetter("firstName")
public String getFirstName() {
return this.firstName;
}
@JsonSetter("lastName")
public void setLastName(String lastName) {
this.lastName = lastName;
}
@JsonGetter("lastName")
public String getLastName() {
return this.lastName;
}
@JsonSetter("location")
public void setLocation(Object location) {
this.location = location;
}
@JsonGetter("location")
public Object getLocation() {
return this.location;
}
}
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Location {
private String type;
@JsonSetter("type")
public void setType(String type) {
this.type = type;
}
@JsonGetter("type")
public String getType() {
return this.type;
}
}
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Web extends Location {
private String url;
@JsonSetter("url")
public void setUrl(String url) {
this.url = url;
}
@JsonGetter("url")
public String getUrl() {
return this.url;
}
}
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class World extends Location {
private String lat;
private String _long;
@JsonSetter("lat")
public void setLat(String lat) {
this.lat = lat;
}
@JsonGetter("lat")
public String getLat() {
return this.lat;
}
@JsonSetter("long")
public void setLong(String _long) {
this._long = _long;
}
@JsonGetter("long")
public String getLong() {
return this._long;
}
}
{
"definitions": {
"Human": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"location": {
"oneOf": [
{
"$ref": "#\/definitions\/Web"
},
{
"$ref": "#\/definitions\/World"
}
],
"discriminator": {
"propertyName": "type"
}
}
}
},
"Location": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
},
"required": [
"type"
]
},
"Web": {
"allOf": [
{
"$ref": "#\/definitions\/Location"
},
{
"type": "object",
"properties": {
"url": {
"type": "string"
}
}
}
]
},
"World": {
"allOf": [
{
"$ref": "#\/definitions\/Location"
},
{
"type": "object",
"properties": {
"lat": {
"type": "string"
},
"long": {
"type": "string"
}
}
}
]
}
},
"$ref": "#\/definitions\/Human"
}
open class Human {
var firstName: String? = null
var lastName: String? = null
var location: Any? = null
}
open class Location {
var type: String? = null
}
open class Web : Location {
var url: String? = null
}
open class World : Location {
var lat: String? = null
var long: String? = null
}
# Human
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
firstName | String | |
lastName | String | |
location | Web | World | |
# Location
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
type | String | **REQUIRED**. |
# Web
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
url | String | |
# World
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
lat | String | |
long | String | |
use PSX\Schema\Attribute\Discriminator;
class Human implements \JsonSerializable
{
protected ?string $firstName = null;
protected ?string $lastName = null;
#[Discriminator('type')]
protected Web|World|null $location = null;
public function setFirstName(?string $firstName) : void
{
$this->firstName = $firstName;
}
public function getFirstName() : ?string
{
return $this->firstName;
}
public function setLastName(?string $lastName) : void
{
$this->lastName = $lastName;
}
public function getLastName() : ?string
{
return $this->lastName;
}
public function setLocation(Web|World|null $location) : void
{
$this->location = $location;
}
public function getLocation() : Web|World|null
{
return $this->location;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('firstName' => $this->firstName, 'lastName' => $this->lastName, 'location' => $this->location), static function ($value) : bool {
return $value !== null;
});
}
}
use PSX\Schema\Attribute\Required;
#[Required(array('type'))]
class Location implements \JsonSerializable
{
protected ?string $type = null;
public function setType(?string $type) : void
{
$this->type = $type;
}
public function getType() : ?string
{
return $this->type;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('type' => $this->type), static function ($value) : bool {
return $value !== null;
});
}
}
class Web extends Location implements \JsonSerializable
{
protected ?string $url = null;
public function setUrl(?string $url) : void
{
$this->url = $url;
}
public function getUrl() : ?string
{
return $this->url;
}
public function jsonSerialize() : object
{
return (object) array_merge((array) parent::jsonSerialize(), array_filter(array('url' => $this->url), static function ($value) : bool {
return $value !== null;
}));
}
}
class World extends Location implements \JsonSerializable
{
protected ?string $lat = null;
protected ?string $long = null;
public function setLat(?string $lat) : void
{
$this->lat = $lat;
}
public function getLat() : ?string
{
return $this->lat;
}
public function setLong(?string $long) : void
{
$this->long = $long;
}
public function getLong() : ?string
{
return $this->long;
}
public function jsonSerialize() : object
{
return (object) array_merge((array) parent::jsonSerialize(), array_filter(array('lat' => $this->lat, 'long' => $this->long), static function ($value) : bool {
return $value !== null;
}));
}
}
message Human {
string firstName = 1;
string lastName = 2;
Struct location = 3;
}
message Location {
string type = 1;
}
message Web {
string url = 1;
}
message World {
string lat = 1;
string long = 2;
}
from typing import Any
from typing import Union
class Human:
def __init__(self, first_name: str, last_name: str, location: Union[Web, World]):
self.first_name = first_name
self.last_name = last_name
self.location = location
from typing import Any
class Location:
def __init__(self, type: str):
self.type = type
from typing import Any
class Web(Location):
def __init__(self, url: str):
self.url = url
from typing import Any
class World(Location):
def __init__(self, lat: str, long: str):
self.lat = lat
self.long = long
class Human
attr_accessor :first_name, :last_name, :location
def initialize(first_name, last_name, location)
@first_name = first_name
@last_name = last_name
@location = location
end
end
class Location
attr_accessor :type
def initialize(type)
@type = type
end
end
class Web
extend Location
attr_accessor :url
def initialize(url)
@url = url
end
end
class World
extend Location
attr_accessor :lat, :long
def initialize(lat, long)
@lat = lat
@long = long
end
end
struct Human {
firstName: String,
lastName: String,
location: Object,
}
struct Location {
_type: String,
}
struct Web {
*Location
url: String,
}
struct World {
*Location
lat: String,
long: String,
}
class Human: Codable {
var firstName: String
var lastName: String
var location: Web | World
}
class Location: Codable {
var _type: String
}
class Web: Location {
var url: String
}
class World: Location {
var lat: String
var long: String
}
import {Web} from "./Web";
import {World} from "./World";
export interface Human {
firstName?: string
lastName?: string
location?: Web | World
}
export interface Location {
type: string
}
import {Location} from "./Location";
export interface Web extends Location {
url?: string
}
import {Location} from "./Location";
export interface World extends Location {
lat?: string
long?: string
}
{
"definitions": {
"Human": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"location": {
"oneOf": [
{
"$ref": "Web"
},
{
"$ref": "World"
}
],
"discriminator": {
"propertyName": "type"
}
}
}
},
"Location": {
"type": "object",
"properties": {
"type": {
"type": "string"
}
},
"required": [
"type"
]
},
"Web": {
"$extends": "Location",
"type": "object",
"properties": {
"url": {
"type": "string"
}
}
},
"World": {
"$extends": "Location",
"type": "object",
"properties": {
"lat": {
"type": "string"
},
"long": {
"type": "string"
}
}
}
},
"$ref": "Human"
}
{
"definitions": {
"Student": {
"type": "object",
"properties": {
"matricleNumber": {
"type": "integer"
}
}
},
"StudentMap": {
"$ref": "Map",
"$template": {
"T": "Student"
}
},
"Map": {
"type": "object",
"properties": {
"totalResults": {
"type": "integer"
},
"entries": {
"type": "array",
"items": {
"$generic": "T"
}
}
}
}
},
"$ref": "StudentMap"
}
public class Student
{
public int MatricleNumber { get; set; }
}
public class StudentMap : Map<Student>
{
}
public class Map<T>
{
public int TotalResults { get; set; }
public T[] Entries { get; set; }
}
type Student struct {
MatricleNumber int `json:"matricleNumber"`
}
type StudentMap = Map[Student]
type Map[T any] struct {
TotalResults int `json:"totalResults"`
Entries []T `json:"entries"`
}
type Student {
matricleNumber: Int
}
type Map {
totalResults: Int
entries: [T]
}
<div id="Student" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Student">Student</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"matricleNumber"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Integer</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">matricleNumber</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Integer">Integer</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
<div id="StudentMap" class="psx-object psx-reference"><h1><a href="#StudentMap">StudentMap</a></h1><pre class="psx-object-json">Reference: Map
<span class="psx-object-json-key">"T"</span><span class="psx-object-json-pun"> = </span><span class="psx-property-type"><a href="#Student">Student</a></span></pre></div>
<div id="Map" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Map">Map</a><T></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"totalResults"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Integer</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"entries"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Array (T)</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">totalResults</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Integer">Integer</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">entries</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Array (T)">Array (T)</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Student {
private int matricleNumber;
@JsonSetter("matricleNumber")
public void setMatricleNumber(int matricleNumber) {
this.matricleNumber = matricleNumber;
}
@JsonGetter("matricleNumber")
public int getMatricleNumber() {
return this.matricleNumber;
}
}
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class StudentMap extends Map<Student> {
}
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Map<T> {
private int totalResults;
private T[] entries;
@JsonSetter("totalResults")
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
@JsonGetter("totalResults")
public int getTotalResults() {
return this.totalResults;
}
@JsonSetter("entries")
public void setEntries(T[] entries) {
this.entries = entries;
}
@JsonGetter("entries")
public T[] getEntries() {
return this.entries;
}
}
{
"definitions": {
"Map": {
"type": "object",
"properties": {
"totalResults": {
"type": "integer"
},
"entries": {
"type": "array",
"items": {
"$generic": "T"
}
}
}
},
"Student": {
"type": "object",
"properties": {
"matricleNumber": {
"type": "integer"
}
}
},
"StudentMap": {
"$ref": "#\/definitions\/Map"
}
},
"$ref": "#\/definitions\/StudentMap"
}
open class Student {
var matricleNumber: Int? = null
}
typealias StudentMap = Map<Student>
open class Map<T> {
var totalResults: Int? = null
var entries: Array<T>? = null
}
# Student
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
matricleNumber | Integer | |
# Map
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
totalResults | Integer | |
entries | Array (T) | |
class Student implements \JsonSerializable
{
protected ?int $matricleNumber = null;
public function setMatricleNumber(?int $matricleNumber) : void
{
$this->matricleNumber = $matricleNumber;
}
public function getMatricleNumber() : ?int
{
return $this->matricleNumber;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('matricleNumber' => $this->matricleNumber), static function ($value) : bool {
return $value !== null;
});
}
}
/**
* @extends Map<Student>
*/
class StudentMap extends Map
{
}
/**
* @template T
*/
class Map implements \JsonSerializable
{
protected ?int $totalResults = null;
/**
* @var array<T>|null
*/
protected ?array $entries = null;
public function setTotalResults(?int $totalResults) : void
{
$this->totalResults = $totalResults;
}
public function getTotalResults() : ?int
{
return $this->totalResults;
}
/**
* @param array<T>|null $entries
*/
public function setEntries(?array $entries) : void
{
$this->entries = $entries;
}
public function getEntries() : ?array
{
return $this->entries;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('totalResults' => $this->totalResults, 'entries' => $this->entries), static function ($value) : bool {
return $value !== null;
});
}
}
message Student {
int64 matricleNumber = 1;
}
message Map {
int64 totalResults = 1;
repeated T entries = 2;
}
from typing import Any
class Student:
def __init__(self, matricle_number: int):
self.matricle_number = matricle_number
from typing import Any
class StudentMap(Map):
from typing import Any
from typing import List
class Map:
def __init__(self, total_results: int, entries: List[T]):
self.total_results = total_results
self.entries = entries
class Student
attr_accessor :matricle_number
def initialize(matricle_number)
@matricle_number = matricle_number
end
end
class StudentMap
extend Map
end
class Map
attr_accessor :total_results, :entries
def initialize(total_results, entries)
@total_results = total_results
@entries = entries
end
end
struct Student {
matricleNumber: u64,
}
type StudentMap = Map
struct Map {
totalResults: u64,
entries: Vec<T>,
}
class Student: Codable {
var matricleNumber: Int
}
typealias StudentMap = Map<Student>;
class Map: Codable {
var totalResults: Int
var entries: Array<T>
}
export interface Student {
matricleNumber?: number
}
import {Map} from "./Map";
import {Student} from "./Student";
export type StudentMap = Map<Student>;
export interface Map<T> {
totalResults?: number
entries?: Array<T>
}
{
"definitions": {
"Map": {
"type": "object",
"properties": {
"totalResults": {
"type": "integer"
},
"entries": {
"type": "array",
"items": {
"$generic": "T"
}
}
}
},
"Student": {
"type": "object",
"properties": {
"matricleNumber": {
"type": "integer"
}
}
},
"StudentMap": {
"$ref": "Map",
"$template": {
"T": "Student"
}
}
},
"$ref": "StudentMap"
}
{
"$import": {
"my_ns": "file:///generic.json"
},
"definitions": {
"Faculty": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"students": {
"type": "array",
"items": {
"$ref": "my_ns:StudentMap"
}
}
}
}
},
"$ref": "Faculty"
}
public class Faculty
{
public string Description { get; set; }
public StudentMap[] Students { get; set; }
}
type Faculty struct {
Description string `json:"description"`
Students []StudentMap `json:"students"`
}
type Faculty {
description: String
students: [StudentMap]
}
<div id="Faculty" class="psx-object psx-struct"><h1><a class="psx-type-link" data-name="Faculty">Faculty</a></h1><pre class="psx-object-json"><span class="psx-object-json-pun">{</span>
<span class="psx-object-json-key">"description"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">String</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-key">"students"</span><span class="psx-object-json-pun">: </span><span class="psx-property-type">Array (my_ns:StudentMap)</span><span class="psx-object-json-pun">,</span>
<span class="psx-object-json-pun">}</span></pre><table class="table psx-object-properties"><colgroup><col width="30%" /><col width="70%" /></colgroup><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><span class="psx-property-name psx-property-optional">description</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="String">String</a></span><br /><div class="psx-property-description"></div></td></tr><tr><td><span class="psx-property-name psx-property-optional">students</span></td><td><span class="psx-property-type"><a class="psx-type-link" data-name="Array (my_ns:StudentMap)">Array (my_ns:StudentMap)</a></span><br /><div class="psx-property-description"></div></td></tr></tbody></table></div>
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonSetter;
public class Faculty {
private String description;
private StudentMap[] students;
@JsonSetter("description")
public void setDescription(String description) {
this.description = description;
}
@JsonGetter("description")
public String getDescription() {
return this.description;
}
@JsonSetter("students")
public void setStudents(StudentMap[] students) {
this.students = students;
}
@JsonGetter("students")
public StudentMap[] getStudents() {
return this.students;
}
}
{
"definitions": {
"Map": {
"type": "object",
"properties": {
"totalResults": {
"type": "integer"
},
"entries": {
"type": "array",
"items": {
"$generic": "T"
}
}
}
},
"Student": {
"type": "object",
"properties": {
"matricleNumber": {
"type": "integer"
}
}
},
"StudentMap": {
"$ref": "#\/definitions\/Map"
},
"Faculty": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"students": {
"type": "array",
"items": {
"$ref": "#\/definitions\/StudentMap"
}
}
}
}
},
"$ref": "#\/definitions\/Faculty"
}
open class Faculty {
var description: String? = null
var students: Array<StudentMap>? = null
}
# Faculty
Field | Type | Description | Constraints
----- | ---- | ----------- | -----------
description | String | |
students | Array (my_ns:StudentMap) | |
class Faculty implements \JsonSerializable
{
protected ?string $description = null;
/**
* @var array<StudentMap>|null
*/
protected ?array $students = null;
public function setDescription(?string $description) : void
{
$this->description = $description;
}
public function getDescription() : ?string
{
return $this->description;
}
/**
* @param array<StudentMap>|null $students
*/
public function setStudents(?array $students) : void
{
$this->students = $students;
}
public function getStudents() : ?array
{
return $this->students;
}
public function jsonSerialize() : object
{
return (object) array_filter(array('description' => $this->description, 'students' => $this->students), static function ($value) : bool {
return $value !== null;
});
}
}
message Faculty {
string description = 1;
repeated StudentMap students = 2;
}
from typing import Any
from typing import List
class Faculty:
def __init__(self, description: str, students: List[StudentMap]):
self.description = description
self.students = students
class Faculty
attr_accessor :description, :students
def initialize(description, students)
@description = description
@students = students
end
end
struct Faculty {
description: String,
students: Vec<StudentMap>,
}
class Faculty: Codable {
var description: String
var students: Array<StudentMap>
}
import {StudentMap} from "./StudentMap";
export interface Faculty {
description?: string
students?: Array<StudentMap>
}
{
"definitions": {
"my_ns:Map": {
"type": "object",
"properties": {
"totalResults": {
"type": "integer"
},
"entries": {
"type": "array",
"items": {
"$generic": "T"
}
}
}
},
"my_ns:Student": {
"type": "object",
"properties": {
"matricleNumber": {
"type": "integer"
}
}
},
"my_ns:StudentMap": {
"$ref": "my_ns:Map",
"$template": {
"T": "my_ns:Student"
}
},
"Faculty": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"students": {
"type": "array",
"items": {
"$ref": "my_ns:StudentMap"
}
}
}
}
},
"$ref": "Faculty"
}