-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Milestone
Description
I really love the jsonschema2pojo tool. :-)
It would be even greater, if you add support for YAML which uses the JSON Schema for defining Java POJOs.
So instead of using JSON for defining a "BotState" (in JSON Schema for format) with bot-state.json:
{
"id": "#bot-state.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Current state of a bot without an id. The id must be hidden for enemy bots",
"javaType": "BotState",
"properties": {
"energy": {
"description": "Energy level",
"type": "number"
},
"position": {
"description": "Position (x, y)",
"$ref": "../types/point.json"
},
"direction": {
"description": "Driving direction in degrees",
"$ref": "../types/angle.json"
},
"gun-direction": {
"description": "Gun direction in degrees",
"$ref": "../types/angle.json"
},
"radar-direction": {
"description": "Radar direction in degrees",
"$ref": "../types/angle.json"
},
"radar-spread-angle": {
"description": "Radar spread angle in degrees",
"$ref": "../types/angle.json"
},
"speed": {
"description": "Speed measured in units per turn",
"type": "number"
},
"scan-field": {
"description": "Scan field, where a positive arc angle means that scan is moving left and negative arc angle means that the scan is moving right",
"$ref": "../types/scan-field.json"
}
},
"required": [
"energy",
"position",
"direction",
"gun-direction",
"radar-direction",
"speed",
"scan-field"
]
}
... I can use YAML instead (bot-state.yaml):
---
id: "#bot-state.yaml"
"$schema": http://json-schema.org/draft-04/schema#
description: Current state of a bot without an id. The id must be hidden for enemy
bots
javaType: BotState
properties:
energy:
description: Energy level
type: number
position:
description: Position (x, y)
"$ref": "../types/point.yaml"
direction:
description: Driving direction in degrees
"$ref": "../types/angle.yaml"
gun-direction:
description: Gun direction in degrees
"$ref": "../types/angle.yaml"
radar-direction:
description: Radar direction in degrees
"$ref": "../types/angle.yaml"
radar-spread-angle:
description: Radar spread angle in degrees
"$ref": "../types/angle.yaml"
speed:
description: Speed measured in units per turn
type: number
scan-field:
description: Scan field, where a positive arc angle means that scan is moving
left and negative arc angle means that the scan is moving right
"$ref": "../types/scan-field.yaml"
required:
- energy
- position
- direction
- gun-direction
- radar-direction
- speed
- scan-field
Metadata
Metadata
Assignees
Labels
No labels