Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

json validation cleanup, part 1 #1066

Merged
merged 7 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Successful (HTTP 2xx code) response structures are as described for each endpoin
(HTTP 4xx) responses are also listed, as well as the normal errors common across all endpoints, as
noted below:

* failure to validate query parameters: HTTP 400, [response.json#/definitions/QueryParamsValidationError](json-schema/response.json#/definitions/QueryParamsValidationError)
* failure to validate request body payload: HTTP 400, [response.json#/definitions/RequestValidationError](json-schema/response.json#/definitions/RequestValidationError)
* all other errors, unless specified, use the generic error structure, [response.json#/definitions/Error](json-schema/response.json#/definitions/Error)
* failure to validate query parameters: HTTP 400, [response.json#/$defs/QueryParamsValidationError](json-schema/response.json#/$defs/QueryParamsValidationError)
* failure to validate request body payload: HTTP 400, [response.json#/$defs/RequestValidationError](json-schema/response.json#/$defs/RequestValidationError)
* all other errors, unless specified, use the generic error structure, [response.json#/$defs/Error](json-schema/response.json#/$defs/Error)
* failure to properly authenticate (user not found, password incorrect, missing authentication token): HTTP 401
* user is not authorized for this endpoint: HTTP 403

Expand Down
18 changes: 9 additions & 9 deletions docs/json-schema/common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/common/$schema_name' endpoints, or within conch itself, json-schema/common.yaml.",
"$schema" : "http://json-schema.org/draft-07/schema#",
"definitions" : {
"$defs" : {
"HardwareProductSpecification" : {
"description" : "this is the structure of the hardware_product.specification database column",
"properties" : {
Expand Down Expand Up @@ -64,7 +63,7 @@
"type" : "string"
},
{
"$ref" : "#/definitions/mojo_relaxed_placeholder"
"$ref" : "#/$defs/mojo_relaxed_placeholder"
}
]
},
Expand All @@ -86,12 +85,12 @@
"type" : "string"
},
{
"$ref" : "#/definitions/mojo_standard_placeholder"
"$ref" : "#/$defs/mojo_standard_placeholder"
}
]
},
"device_setting_key" : {
"$ref" : "#/definitions/mojo_relaxed_placeholder"
"$ref" : "#/$defs/mojo_relaxed_placeholder"
},
"disk_serial_number" : {
"pattern" : "^\\S+$",
Expand All @@ -104,7 +103,7 @@
"type" : "string"
},
{
"$ref" : "#/definitions/mojo_relaxed_placeholder"
"$ref" : "#/$defs/mojo_relaxed_placeholder"
}
]
},
Expand Down Expand Up @@ -153,7 +152,7 @@
"non_zero_uuid" : {
"allOf" : [
{
"$ref" : "#/definitions/uuid"
"$ref" : "#/$defs/uuid"
},
{
"not" : {
Expand Down Expand Up @@ -184,7 +183,7 @@
"type" : "string"
},
"user_setting_key" : {
"$ref" : "#/definitions/mojo_relaxed_placeholder"
"$ref" : "#/$defs/mojo_relaxed_placeholder"
},
"uuid" : {
"pattern" : "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
Expand All @@ -199,5 +198,6 @@
],
"type" : "string"
}
}
},
"$schema" : "http://json-schema.org/draft-07/schema#"
}
46 changes: 23 additions & 23 deletions docs/json-schema/device_report.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/device_report/$schema_name' endpoints, or within conch itself, json-schema/device_report.yaml.",
"$schema" : "http://json-schema.org/draft-07/schema#",
"definitions" : {
"$defs" : {
"DeviceReport_v3_0_0" : {
"description" : "the contents of a posted device report from relays and reporters",
"properties" : {
Expand Down Expand Up @@ -30,7 +29,7 @@
"memory-serial-number" : {
"oneOf" : [
{
"$ref" : "common.json#/definitions/non_empty_string"
"$ref" : "common.json#/$defs/non_empty_string"
},
{
"type" : "null"
Expand All @@ -40,7 +39,7 @@
"memory-size" : {
"oneOf" : [
{
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
{
"type" : "null"
Expand All @@ -66,13 +65,13 @@
"type" : "string"
},
"enclosure" : {
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
"firmware" : {
"type" : "string"
},
"hba" : {
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
"health" : {
"type" : "string"
Expand All @@ -84,10 +83,10 @@
"type" : "integer"
},
"slot" : {
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
"temp" : {
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
"transport" : {
"type" : "string"
Expand All @@ -99,7 +98,7 @@
"type" : "object"
},
"propertyNames" : {
"$ref" : "common.json#/definitions/disk_serial_number"
"$ref" : "common.json#/$defs/disk_serial_number"
},
"type" : "object"
},
Expand All @@ -109,20 +108,20 @@
"ipaddr" : {
"oneOf" : [
{
"$ref" : "common.json#/definitions/ipaddr"
"$ref" : "common.json#/$defs/ipaddr"
},
{
"type" : "null"
}
]
},
"mac" : {
"$ref" : "common.json#/definitions/macaddr"
"$ref" : "common.json#/$defs/macaddr"
},
"mtu" : {
"oneOf" : [
{
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
{
"type" : "null"
Expand All @@ -132,7 +131,7 @@
"peer_mac" : {
"oneOf" : [
{
"$ref" : "common.json#/definitions/macaddr"
"$ref" : "common.json#/$defs/macaddr"
},
{
"type" : "null"
Expand Down Expand Up @@ -164,14 +163,14 @@
"type" : "object"
},
"propertyNames" : {
"$ref" : "common.json#/definitions/device_interface_name"
"$ref" : "common.json#/$defs/device_interface_name"
},
"type" : "object"
},
"links" : {
"allOf" : [
{
"$ref" : "common.json#/definitions/links"
"$ref" : "common.json#/$defs/links"
},
{
"minItems" : 1
Expand All @@ -195,7 +194,7 @@
"relay" : {
"properties" : {
"serial" : {
"$ref" : "common.json#/definitions/relay_serial_number"
"$ref" : "common.json#/$defs/relay_serial_number"
}
},
"required" : [
Expand All @@ -204,27 +203,27 @@
"type" : "object"
},
"serial_number" : {
"$ref" : "common.json#/definitions/device_serial_number"
"$ref" : "common.json#/$defs/device_serial_number"
},
"sku" : {
"type" : "string"
},
"system_uuid" : {
"$ref" : "common.json#/definitions/non_zero_uuid"
"$ref" : "common.json#/$defs/non_zero_uuid"
},
"temp" : {
"properties" : {
"cpu0" : {
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
"cpu1" : {
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
"exhaust" : {
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
},
"inlet" : {
"$ref" : "#/definitions/int_or_stringy_int"
"$ref" : "#/$defs/int_or_stringy_int"
}
},
"required" : [
Expand Down Expand Up @@ -258,5 +257,6 @@
}
]
}
}
},
"$schema" : "http://json-schema.org/draft-07/schema#"
}
4 changes: 2 additions & 2 deletions docs/json-schema/other.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"definitions" : {
"$defs" : {
"RollbarPayload" : {
"additionalProperties" : false,
"properties" : {
Expand Down Expand Up @@ -233,7 +233,7 @@
"type" : "integer"
},
"uuid" : {
"$ref" : "common.json#/definitions/uuid"
"$ref" : "common.json#/$defs/uuid"
}
},
"required" : [
Expand Down