Skip to content

Commit

Permalink
tag = "type" is the best
Browse files Browse the repository at this point in the history
  • Loading branch information
jmpesp committed Apr 20, 2022
1 parent 3b516c4 commit 6b0a10f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 55 deletions.
1 change: 1 addition & 0 deletions nexus/src/external_api/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ impl JsonSchema for BlockSize {

/// Different sources for a disk
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
#[serde(tag = "type")]
pub enum DiskSource {
/// Create a blank disk
Blank {
Expand Down
102 changes: 47 additions & 55 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -4940,93 +4940,85 @@
"description": "Create a blank disk",
"type": "object",
"properties": {
"Blank": {
"type": "object",
"properties": {
"block_size": {
"description": "size of blocks for this Disk. valid values are: 512, 2048, or 4096",
"allOf": [
{
"$ref": "#/components/schemas/BlockSize"
}
]
"block_size": {
"description": "size of blocks for this Disk. valid values are: 512, 2048, or 4096",
"allOf": [
{
"$ref": "#/components/schemas/BlockSize"
}
},
"required": [
"block_size"
]
},
"type": {
"type": "string",
"enum": [
"Blank"
]
}
},
"required": [
"Blank"
],
"additionalProperties": false
"block_size",
"type"
]
},
{
"description": "Create a disk from a disk snapshot",
"type": "object",
"properties": {
"Snapshot": {
"type": "object",
"properties": {
"snapshot_id": {
"type": "string",
"format": "uuid"
}
},
"required": [
"snapshot_id"
"snapshot_id": {
"type": "string",
"format": "uuid"
},
"type": {
"type": "string",
"enum": [
"Snapshot"
]
}
},
"required": [
"Snapshot"
],
"additionalProperties": false
"snapshot_id",
"type"
]
},
{
"description": "Create a disk from a project image",
"type": "object",
"properties": {
"Image": {
"type": "object",
"properties": {
"image_id": {
"type": "string",
"format": "uuid"
}
},
"required": [
"image_id"
"image_id": {
"type": "string",
"format": "uuid"
},
"type": {
"type": "string",
"enum": [
"Image"
]
}
},
"required": [
"Image"
],
"additionalProperties": false
"image_id",
"type"
]
},
{
"description": "Create a disk from a global image",
"type": "object",
"properties": {
"GlobalImage": {
"type": "object",
"properties": {
"image_id": {
"type": "string",
"format": "uuid"
}
},
"required": [
"image_id"
"image_id": {
"type": "string",
"format": "uuid"
},
"type": {
"type": "string",
"enum": [
"GlobalImage"
]
}
},
"required": [
"GlobalImage"
],
"additionalProperties": false
"image_id",
"type"
]
}
]
},
Expand Down

0 comments on commit 6b0a10f

Please sign in to comment.