Last active
January 24, 2019 08:13
-
-
Save honmaaax/9172374e57f15a431d801020cebffcb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface Coordinate { | |
| contacts: { [key: string]: Contact }; | |
| } | |
| export interface Contact { | |
| birthday?: Date; | |
| emails: string[]; | |
| firstName: string; | |
| highScore: number; | |
| lastName?: string; | |
| phones: PhoneNumber[]; | |
| title?: Title; | |
| } | |
| export interface PhoneNumber { | |
| /** | |
| * An optional label (e.g. "mobile") | |
| */ | |
| label?: string; | |
| number: string; | |
| } | |
| export enum Title { | |
| MS = "Ms.", | |
| Mr = "Mr.", | |
| Mrs = "Mrs.", | |
| Prof = "Prof.", | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Coordinate struct { | |
| Contacts map[string]Contact `json:"contacts"` | |
| } | |
| type Contact struct { | |
| Birthday *string `json:"birthday,omitempty"` | |
| Emails []string `json:"emails"` | |
| FirstName string `json:"firstName"` | |
| HighScore float64 `json:"highScore"` | |
| LastName *string `json:"lastName,omitempty"` | |
| Phones []PhoneNumber `json:"phones"` | |
| Title *Title `json:"title,omitempty"` | |
| } | |
| type PhoneNumber struct { | |
| Label *string `json:"label,omitempty"`// An optional label (e.g. "mobile") | |
| Number string `json:"number"` | |
| } | |
| type Title string | |
| const ( | |
| MS Title = "Ms." | |
| Mr Title = "Mr." | |
| Mrs Title = "Mrs." | |
| Prof Title = "Prof." | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "http://json-schema.org/draft-07/schema#", | |
| "type": "object", | |
| "properties": { | |
| "contacts": { | |
| "type": "object", | |
| "additionalProperties": { | |
| "$ref": "#/definitions/Contact" | |
| } | |
| } | |
| }, | |
| "required": [ | |
| "contacts" | |
| ], | |
| "definitions": { | |
| "Contact": { | |
| "type": "object", | |
| "properties": { | |
| "firstName": { | |
| "type": "string" | |
| }, | |
| "lastName": { | |
| "type": "string" | |
| }, | |
| "birthday": { | |
| "type": "string", | |
| "format": "date-time" | |
| }, | |
| "title": { | |
| "enum": [ | |
| "Mr.", | |
| "Mrs.", | |
| "Ms.", | |
| "Prof." | |
| ], | |
| "type": "string" | |
| }, | |
| "emails": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| } | |
| }, | |
| "phones": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/PhoneNumber" | |
| } | |
| }, | |
| "highScore": { | |
| "type": "integer" | |
| } | |
| }, | |
| "required": [ | |
| "emails", | |
| "firstName", | |
| "highScore", | |
| "phones" | |
| ] | |
| }, | |
| "PhoneNumber": { | |
| "type": "object", | |
| "properties": { | |
| "number": { | |
| "type": "string" | |
| }, | |
| "label": { | |
| "description": "An optional label (e.g. \"mobile\")", | |
| "type": "string" | |
| } | |
| }, | |
| "required": [ | |
| "number" | |
| ] | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment