From 11384e15df938ecf890c688e916718237163587d Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 31 Jan 2020 13:35:02 -0800 Subject: [PATCH 1/7] render these validation failure log messages nicer --- lib/Conch/Plugin/JSONValidator.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Conch/Plugin/JSONValidator.pm b/lib/Conch/Plugin/JSONValidator.pm index 60f86b25b..be06b0c72 100644 --- a/lib/Conch/Plugin/JSONValidator.pm +++ b/lib/Conch/Plugin/JSONValidator.pm @@ -68,7 +68,7 @@ F json response schema. } if (my @errors = $validator->validate($data, $schema)) { - $c->log->warn("FAILED query_params validation for schema $schema_name: ".join(' // ', @errors)); + $c->log->warn("FAILED query_params validation for schema $schema_name: ".join(' ', @errors)); return $c->status(400, { error => 'query parameters did not match required format', data => $data, @@ -101,7 +101,7 @@ using the F json response sch } if (my @errors = $validator->validate($data, $schema)) { - $c->log->warn("FAILED request payload validation for schema $schema_name: ".join(' // ', @errors)); + $c->log->warn("FAILED request payload validation for schema $schema_name: ".join(' ', @errors)); return $c->status(400, { error => 'request did not match required format', details => \@errors, From dac1847eda3b4ce49d656ddc994afb8d211451af Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 14 Feb 2020 10:31:36 -0800 Subject: [PATCH 2/7] add a few more basic checks for http standards conformance --- docs/modules/Test::Conch.md | 16 +++++++------- lib/Test/Conch.pm | 42 ++++++++++++++++++++++++------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/docs/modules/Test::Conch.md b/docs/modules/Test::Conch.md index 761263b51..a075fbbf4 100644 --- a/docs/modules/Test::Conch.md +++ b/docs/modules/Test::Conch.md @@ -61,13 +61,15 @@ Returns a read-only connection to an existing [Test::PostgreSQL](https://metacpa Wrapper around ["status\_is" in Test::Mojo](https://metacpan.org/pod/Test%3A%3AMojo#status_is), adding some additional checks. ``` -* successful GET requests should not return 201, 202 (ideally just 200, 204). -* successful DELETE requests should not return 201 -* GET requests should not have request body content -* 200 and most 4xx responses should have content. -* 201 and most 3xx responses should have a Location header. -* 204 and most 3xx responses should not have body content. -* 302 should not be used at all +0. GET requests should not have request body content +1. successful GET requests should not return 201, 202 (ideally just 200, 204) +2. successful DELETE requests should not return 201 +3. 201 and most 3xx responses should have a Location header +4. HEAD requests should not have body content +5. 200, 203, 206, 207 and most 4xx responses should have body content +6. 201, 204, 205 and most 3xx responses should not have body content +7. 302 should not be used at all +8. 401, 403 responses should have a WWW-Authenticate header ``` Also, unexpected responses will dump the response payload. diff --git a/lib/Test/Conch.pm b/lib/Test/Conch.pm index 0e7096a4f..8d2d2a83f 100644 --- a/lib/Test/Conch.pm +++ b/lib/Test/Conch.pm @@ -237,13 +237,15 @@ sub ro_schema ($class, $pgsql) { Wrapper around L, adding some additional checks. - * successful GET requests should not return 201, 202 (ideally just 200, 204). - * successful DELETE requests should not return 201 - * GET requests should not have request body content - * 200 and most 4xx responses should have content. - * 201 and most 3xx responses should have a Location header. - * 204 and most 3xx responses should not have body content. - * 302 should not be used at all + 0. GET requests should not have request body content + 1. successful GET requests should not return 201, 202 (ideally just 200, 204) + 2. successful DELETE requests should not return 201 + 3. 201 and most 3xx responses should have a Location header + 4. HEAD requests should not have body content + 5. 200, 203, 206, 207 and most 4xx responses should have body content + 6. 201, 204, 205 and most 3xx responses should not have body content + 7. 302 should not be used at all + 8. 401, 403 responses should have a WWW-Authenticate header Also, unexpected responses will dump the response payload. @@ -258,30 +260,42 @@ sub status_is ($self, $status, $desc = undef) { my $method = $self->tx->req->method; my $code = $self->tx->res->code; + # 0. $self->test('fail', 'GET requests should not have request body content') if $method eq 'GET' and $self->tx->req->text; - $self->test('fail', 'HEAD requests should not have body content') - if $method eq 'HEAD' and $self->tx->res->text; - - $self->test('fail', $code.' responses should have a Location header') - if any { $code == $_ } 201,301,302,303,305,307,308 and not $self->header_exists('Location'); - + # 1. $self->test('fail', $method.' requests should not return '.$code) if $method eq 'GET' and any { $code == $_ } 201,202; + # 2. $self->test('fail', $method.' requests should not return '.$code) if $method eq 'DELETE' and $code == 201; + # 3. + $self->test('fail', $code.' responses should have a Location header') + if any { $code == $_ } 201,301,302,303,305,307,308 and not $self->header_exists('Location'); + + # 4. + $self->test('fail', 'HEAD requests should not have response body content') + if $method eq 'HEAD' and $self->tx->res->text; + + # 5. $self->test('fail', $code.' responses should have content') - if $method ne 'HEAD' and any { $code == $_ } 200,400,401,403,404,409,422 and not $self->tx->res->text; + if $method ne 'HEAD' and any { $code == $_ } 200,203,206,207,400,401,403,404,409,422 and not $self->tx->res->text; + # 6. $self->test('fail', $code.' responses should not have content') if any { $code == $_ } 204,301,302,303,304,305,307,308 and $self->tx->res->text; + # 7. $self->test('fail', 'HTTP 302 is superseded by 303 and 307') if $code == 302; + # 8. + $self->test('fail', 'HTTP 401 and 403 responses must have a WWW-Authenticate header') + if ($code == 401 or $code == 403) and not $self->header_exists('WWW-Authenticate'); + Test::More::diag('got response: ', Data::Dumper->new([ $self->tx->res->json ]) ->Sortkeys(1)->Indent(1)->Terse(1)->Maxdepth(5)->Dump) if $self->tx->res->code != $status; From 93ff391a655453a23608e2ff2f2c70853c95f179 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 30 Mar 2020 11:45:23 -0700 Subject: [PATCH 3/7] remove numeric coercion in query_params validation We can just define our data in terms of the original strings. --- docs/json-schema/query_params.json | 85 +++++++++++--------- docs/json-schema/response.json | 18 +---- docs/modules/Conch::Plugin::JSONValidator.md | 6 +- json-schema/device_report.yaml | 1 - json-schema/query_params.yaml | 75 ++++++++--------- json-schema/response.yaml | 7 +- lib/Conch/Plugin/JSONValidator.pm | 8 +- t/integration/json_schema-unauthed.t | 4 +- 8 files changed, 99 insertions(+), 105 deletions(-) diff --git a/docs/json-schema/query_params.json b/docs/json-schema/query_params.json index bbc3c609d..eea924a1f 100644 --- a/docs/json-schema/query_params.json +++ b/docs/json-schema/query_params.json @@ -1,5 +1,5 @@ { - "$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/query_params/$schema_name' endpoints, or within conch itself, json-schema/query_params.yaml.\nNote: for now, defaults are for documentation purposes only. see https://github.com/mojolicious/json-validator/issues/158", + "$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/query_params/$schema_name' endpoints, or within conch itself, json-schema/query_params.yaml.\nNote that all parameters are parsed internally from the request URI as strings, so all type checks here use strings. When a query parameter is used more than once, its values are parsed as an arrayref. See ../modules/Conch::Plugin::JSONValidator#validate_query_params. For now, defaults are for documentation purposes only. see https://github.com/mojolicious/json-validator/issues/158", "$schema" : "http://json-schema.org/draft-07/schema#", "definitions" : { "BuildDevices" : { @@ -9,10 +9,10 @@ "not" : { "properties" : { "ids_only" : { - "const" : 1 + "const" : "1" }, "serials_only" : { - "const" : 1 + "const" : "1" } }, "required" : [ @@ -34,7 +34,7 @@ ], "properties" : { "active_minutes" : { - "$ref" : "common.json#/definitions/non_negative_integer" + "$ref" : "#/definitions/non_negative_integer_string" }, "health" : { "oneOf" : [ @@ -52,7 +52,7 @@ ] }, "ids_only" : { - "$ref" : "#/definitions/boolean_integer_default_false" + "$ref" : "#/definitions/boolean_string_default_false" }, "phase" : { "oneOf" : [ @@ -70,7 +70,7 @@ ] }, "serials_only" : { - "$ref" : "#/definitions/boolean_integer_default_false" + "$ref" : "#/definitions/boolean_string_default_false" } }, "type" : "object" @@ -79,7 +79,7 @@ "additionalProperties" : false, "properties" : { "ids_only" : { - "$ref" : "#/definitions/boolean_integer_default_false" + "$ref" : "#/definitions/boolean_string_default_false" }, "phase" : { "oneOf" : [ @@ -150,10 +150,10 @@ }, "properties" : { "completed" : { - "$ref" : "#/definitions/boolean_integer" + "$ref" : "#/definitions/boolean_string" }, "started" : { - "$ref" : "#/definitions/boolean_integer" + "$ref" : "#/definitions/boolean_string" } }, "type" : "object" @@ -223,7 +223,7 @@ "description" : "used for operations where email can optionally be sent", "properties" : { "send_mail" : { - "$ref" : "#/definitions/boolean_integer_default_true" + "$ref" : "#/definitions/boolean_string_default_true" } }, "type" : "object" @@ -232,7 +232,7 @@ "additionalProperties" : false, "properties" : { "no_save_db" : { - "$ref" : "#/definitions/boolean_integer_default_false" + "$ref" : "#/definitions/boolean_string_default_false" } }, "type" : "object" @@ -250,7 +250,7 @@ "type" : "string" }, "send_mail" : { - "$ref" : "#/definitions/boolean_integer_default_true" + "$ref" : "#/definitions/boolean_string_default_true" } }, "type" : "object" @@ -261,13 +261,13 @@ "additionalProperties" : false, "properties" : { "api_only" : { - "$ref" : "#/definitions/boolean_integer_default_false" + "$ref" : "#/definitions/boolean_string_default_false" }, "login_only" : { - "$ref" : "#/definitions/boolean_integer_default_false" + "$ref" : "#/definitions/boolean_string_default_false" }, "send_mail" : { - "$ref" : "#/definitions/boolean_integer_default_true" + "$ref" : "#/definitions/boolean_string_default_true" } }, "type" : "object" @@ -276,10 +276,10 @@ "not" : { "properties" : { "api_only" : { - "const" : 1 + "const" : "1" }, "login_only" : { - "const" : 1 + "const" : "1" } }, "required" : [ @@ -295,7 +295,7 @@ "additionalProperties" : false, "properties" : { "rack_only" : { - "$ref" : "#/definitions/boolean_integer_default_false" + "$ref" : "#/definitions/boolean_string_default_false" } }, "type" : "object" @@ -304,44 +304,55 @@ "additionalProperties" : true, "properties" : { "with_device_health" : { - "$ref" : "#/definitions/boolean_integer_or_flag" + "$ref" : "#/definitions/boolean_string_or_flag" }, "with_device_phases" : { - "$ref" : "#/definitions/boolean_integer_or_flag" + "$ref" : "#/definitions/boolean_string_or_flag" }, "with_rack_phases" : { - "$ref" : "#/definitions/boolean_integer_or_flag" + "$ref" : "#/definitions/boolean_string_or_flag" } }, "type" : "object" }, - "boolean_integer" : { - "maximum" : 1, - "minimum" : 0, - "type" : "integer" + "boolean_string" : { + "enum" : [ + "0", + "1" + ], + "type" : "string" }, - "boolean_integer_default_false" : { - "default" : 0, - "maximum" : 1, - "minimum" : 0, - "type" : "integer" + "boolean_string_default_false" : { + "default" : "0", + "enum" : [ + "0", + "1" + ], + "type" : "string" }, - "boolean_integer_default_true" : { - "default" : 1, - "maximum" : 1, - "minimum" : 0, - "type" : "integer" + "boolean_string_default_true" : { + "default" : "1", + "enum" : [ + "0", + "1" + ], + "type" : "string" }, - "boolean_integer_or_flag" : { + "boolean_string_or_flag" : { "description" : "\"?foo\" and \"?foo=1\" are true; \"?foo=0\" is false", "oneOf" : [ { "const" : "" }, { - "$ref" : "#/definitions/boolean_integer" + "$ref" : "#/definitions/boolean_string" } ] + }, + "non_negative_integer_string" : { + "description" : "see common.json#/definitions/non_negative_integer", + "pattern" : "^[0-9]+$", + "type" : "string" } } } diff --git a/docs/json-schema/response.json b/docs/json-schema/response.json index 0724b0a9d..28ecfc9a4 100644 --- a/docs/json-schema/response.json +++ b/docs/json-schema/response.json @@ -2222,28 +2222,12 @@ "data" : { "additionalProperties" : { "anyOf" : [ - { - "type" : "integer" - }, - { - "type" : "number" - }, { "type" : "string" }, { "items" : { - "anyOf" : [ - { - "type" : "integer" - }, - { - "type" : "number" - }, - { - "type" : "string" - } - ] + "type" : "string" }, "minItems" : 2, "type" : "array" diff --git a/docs/modules/Conch::Plugin::JSONValidator.md b/docs/modules/Conch::Plugin::JSONValidator.md index 3a8d2a2d9..4f1c79d12 100644 --- a/docs/modules/Conch::Plugin::JSONValidator.md +++ b/docs/modules/Conch::Plugin::JSONValidator.md @@ -60,8 +60,10 @@ using the [response.json#/definitions/RequestValidationError](../json-schema/res Returns a [JSON::Validator](https://metacpan.org/pod/JSON%3A%3AValidator) object suitable for validating an endpoint's query parameters (when transformed into a hashref: see ["validate\_query\_params"](#validate_query_params)). -Strings that look like numbers are converted into numbers, so strict 'integer' and 'number' -typing is possible. No default population is done yet though; see +Because values are being parsed from the URI string, all values are strings even if they look like +numbers. + +No default population is done yet though; see [https://github.com/mojolicious/json-validator/issues/158](https://github.com/mojolicious/json-validator/issues/158). ### get\_request\_validator diff --git a/json-schema/device_report.yaml b/json-schema/device_report.yaml index 887d563e3..8110f456f 100644 --- a/json-schema/device_report.yaml +++ b/json-schema/device_report.yaml @@ -3,7 +3,6 @@ $schema: 'http://json-schema.org/draft-07/schema#' definitions: int_or_stringy_int: description: an integer that may be presented as a json string - # note that when JSON::Validator has 'coerce' mode on, both of these rules will match. oneOf: - type: integer - type: string diff --git a/json-schema/query_params.yaml b/json-schema/query_params.yaml index 421dd45bb..82b12a27c 100644 --- a/json-schema/query_params.yaml +++ b/json-schema/query_params.yaml @@ -1,28 +1,29 @@ # Note: for now, defaults are for documentation purposes only. # see https://github.com/mojolicious/json-validator/issues/158 --- -$comment: 'Note: for now, defaults are for documentation purposes only. see https://github.com/mojolicious/json-validator/issues/158' +$comment: 'Note that all parameters are parsed internally from the request URI as strings, so all type checks here use strings. When a query parameter is used more than once, its values are parsed as an arrayref. See ../modules/Conch::Plugin::JSONValidator#validate_query_params. For now, defaults are for documentation purposes only. see https://github.com/mojolicious/json-validator/issues/158' $schema: 'http://json-schema.org/draft-07/schema#' definitions: - boolean_integer: - type: integer - minimum: 0 - maximum: 1 - boolean_integer_default_false: - type: integer - minimum: 0 - maximum: 1 - default: 0 - boolean_integer_default_true: - type: integer - minimum: 0 - maximum: 1 - default: 1 - boolean_integer_or_flag: + boolean_string: + type: string + enum: [ '0', '1' ] + boolean_string_default_false: + type: string + enum: [ '0', '1' ] + default: '0' + boolean_string_default_true: + type: string + enum: [ '0', '1' ] + default: '1' + boolean_string_or_flag: description: '"?foo" and "?foo=1" are true; "?foo=0" is false' oneOf: - const: '' - - $ref: '#/definitions/boolean_integer' + - $ref: '#/definitions/boolean_string' + non_negative_integer_string: + description: see common.yaml#/definitions/non_negative_integer + type: string + pattern: '^[0-9]+$' RevokeUserTokens: allOf: @@ -30,11 +31,11 @@ definitions: additionalProperties: false properties: login_only: - $ref: '#/definitions/boolean_integer_default_false' + $ref: '#/definitions/boolean_string_default_false' api_only: - $ref: '#/definitions/boolean_integer_default_false' + $ref: '#/definitions/boolean_string_default_false' send_mail: - $ref: '#/definitions/boolean_integer_default_true' + $ref: '#/definitions/boolean_string_default_true' - not: type: object required: @@ -42,9 +43,9 @@ definitions: - api_only properties: login_only: - const: 1 + const: '1' api_only: - const: 1 + const: '1' ChangePassword: type: object additionalProperties: false @@ -70,14 +71,14 @@ definitions: - all default: login_only send_mail: - $ref: '#/definitions/boolean_integer_default_true' + $ref: '#/definitions/boolean_string_default_true' NotifyUsers: description: used for operations where email can optionally be sent type: object additionalProperties: false properties: send_mail: - $ref: '#/definitions/boolean_integer_default_true' + $ref: '#/definitions/boolean_string_default_true' GetDeviceByAttribute: type: object minProperties: 1 @@ -113,14 +114,14 @@ definitions: additionalProperties: false properties: rack_only: - $ref: '#/definitions/boolean_integer_default_false' + $ref: '#/definitions/boolean_string_default_false' GetBuilds: type: object properties: started: - $ref: '#/definitions/boolean_integer' + $ref: '#/definitions/boolean_string' completed: - $ref: '#/definitions/boolean_integer' + $ref: '#/definitions/boolean_string' not: required: - started @@ -135,11 +136,11 @@ definitions: additionalProperties: true # overlays with other schemas properties: with_device_health: - $ref: '#/definitions/boolean_integer_or_flag' + $ref: '#/definitions/boolean_string_or_flag' with_device_phases: - $ref: '#/definitions/boolean_integer_or_flag' + $ref: '#/definitions/boolean_string_or_flag' with_rack_phases: - $ref: '#/definitions/boolean_integer_or_flag' + $ref: '#/definitions/boolean_string_or_flag' FindDevice: type: object additionalProperties: true # may be used at the same time as other schemas @@ -169,20 +170,20 @@ definitions: items: $ref: common.yaml#/definitions/device_phase active_minutes: - $ref: common.yaml#/definitions/non_negative_integer + $ref: '#/definitions/non_negative_integer_string' ids_only: - $ref: '#/definitions/boolean_integer_default_false' + $ref: '#/definitions/boolean_string_default_false' serials_only: - $ref: '#/definitions/boolean_integer_default_false' + $ref: '#/definitions/boolean_string_default_false' allOf: - not: type: object required: [ ids_only, serials_only ] properties: ids_only: - const: 1 + const: '1' serials_only: - const: 1 + const: '1' - not: type: object required: [ phase_earlier_than, phase ] @@ -199,13 +200,13 @@ definitions: items: $ref: common.yaml#/definitions/device_phase ids_only: - $ref: '#/definitions/boolean_integer_default_false' + $ref: '#/definitions/boolean_string_default_false' ProcessDeviceReport: type: object additionalProperties: false properties: no_save_db: - $ref: '#/definitions/boolean_integer_default_false' + $ref: '#/definitions/boolean_string_default_false' HardwareProductSpecification: type: object additionalProperties: false diff --git a/json-schema/response.yaml b/json-schema/response.yaml index 8636f85b6..2dd681b50 100644 --- a/json-schema/response.yaml +++ b/json-schema/response.yaml @@ -52,16 +52,11 @@ definitions: type: object additionalProperties: anyOf: - - type: integer - - type: number - type: string - type: array minItems: 2 items: - anyOf: - - type: integer - - type: number - - type: string + type: string RequestValidationError: allOf: - $ref: '#/definitions/ValidationError' diff --git a/lib/Conch/Plugin/JSONValidator.pm b/lib/Conch/Plugin/JSONValidator.pm index be06b0c72..8d32fcaad 100644 --- a/lib/Conch/Plugin/JSONValidator.pm +++ b/lib/Conch/Plugin/JSONValidator.pm @@ -118,8 +118,10 @@ using the F json response sch Returns a L object suitable for validating an endpoint's query parameters (when transformed into a hashref: see L). -Strings that look like numbers are converted into numbers, so strict 'integer' and 'number' -typing is possible. No default population is done yet though; see +Because values are being parsed from the URI string, all values are strings even if they look like +numbers. + +No default population is done yet though; see L. =cut @@ -128,7 +130,7 @@ L. $app->helper(get_query_params_validator => sub ($c) { return $_query_params_validator if $_query_params_validator; # TODO: ->new(coerce => '...,defaults') - $_query_params_validator = JSON::Validator->new(coerce => 'numbers'); + $_query_params_validator = JSON::Validator->new; $_query_params_validator->formats->@{qw(json-pointer uri uri-reference)} = (\&_check_json_pointer, \&_check_uri, \&_check_uri_reference); # FIXME: JSON::Validator should be extracting $schema out of the document - see https://github.com/mojolicious/json-validator/pull/152 diff --git a/t/integration/json_schema-unauthed.t b/t/integration/json_schema-unauthed.t index 84be6a1f8..dbb70a2c3 100644 --- a/t/integration/json_schema-unauthed.t +++ b/t/integration/json_schema-unauthed.t @@ -376,13 +376,13 @@ $t->get_ok('/json_schema/query_params/ResetUserPassword') '$schema' => 'http://json-schema.org/draft-07/schema#', '$id' => $base_uri.'json_schema/query_params/ResetUserPassword', definitions => { - boolean_integer_default_true => { type => 'integer', minimum => 0, maximum => 1, default => 1 }, + boolean_string_default_true => { type => 'string', enum => [ '0', '1' ], default => '1' }, }, type => 'object', additionalProperties => bool(0), properties => { clear_tokens => { type => 'string', enum => [ qw(none login_only all) ], default => 'login_only' }, - send_mail => { '$ref' => '#/definitions/boolean_integer_default_true' }, + send_mail => { '$ref' => '#/definitions/boolean_string_default_true' }, }, }); From bf67241cc044387e107bfa9ef48bcbf260c8e6e3 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 11 Feb 2020 15:50:11 -0800 Subject: [PATCH 4/7] apply defaults when parsing query parameters Note: it is *not* correct to use default coercions within JSON::Validator, as its usage violates the spec for how to apply annotations (for example, a missing property cannot have an annotation and therefore cannot have a default: default values must be specified at the object level for each property, rather than in the individual properties' subschemas). --- docs/json-schema/query_params.json | 118 ++++++++++--------- docs/json-schema/request.json | 4 +- docs/modules/Conch::Plugin::JSONValidator.md | 5 +- json-schema/query_params.yaml | 87 +++++++------- json-schema/request.yaml | 3 +- lib/Conch/Controller/Build.pm | 12 +- lib/Conch/Controller/DeviceReport.pm | 2 +- lib/Conch/Controller/Organization.pm | 6 +- lib/Conch/Controller/Rack.pm | 2 +- lib/Conch/Controller/User.pm | 18 +-- lib/Conch/Plugin/JSONValidator.pm | 12 +- t/integration/json_schema-unauthed.t | 13 +- t/integration/users.t | 2 +- t/json-validation.t | 21 ++++ 14 files changed, 173 insertions(+), 132 deletions(-) diff --git a/docs/json-schema/query_params.json b/docs/json-schema/query_params.json index eea924a1f..ad59e7d42 100644 --- a/docs/json-schema/query_params.json +++ b/docs/json-schema/query_params.json @@ -1,5 +1,5 @@ { - "$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/query_params/$schema_name' endpoints, or within conch itself, json-schema/query_params.yaml.\nNote that all parameters are parsed internally from the request URI as strings, so all type checks here use strings. When a query parameter is used more than once, its values are parsed as an arrayref. See ../modules/Conch::Plugin::JSONValidator#validate_query_params. For now, defaults are for documentation purposes only. see https://github.com/mojolicious/json-validator/issues/158", + "$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/query_params/$schema_name' endpoints, or within conch itself, json-schema/query_params.yaml.\nNote that all parameters are parsed internally from the request URI as strings, so all type checks here use strings. When a query parameter is used more than once, its values are parsed as an arrayref. See ../modules/Conch::Plugin::JSONValidator#validate_query_params.", "$schema" : "http://json-schema.org/draft-07/schema#", "definitions" : { "BuildDevices" : { @@ -32,6 +32,10 @@ } } ], + "default" : { + "ids_only" : "0", + "serials_only" : "0" + }, "properties" : { "active_minutes" : { "$ref" : "#/definitions/non_negative_integer_string" @@ -52,7 +56,7 @@ ] }, "ids_only" : { - "$ref" : "#/definitions/boolean_string_default_false" + "$ref" : "#/definitions/boolean_string" }, "phase" : { "oneOf" : [ @@ -70,16 +74,19 @@ ] }, "serials_only" : { - "$ref" : "#/definitions/boolean_string_default_false" + "$ref" : "#/definitions/boolean_string" } }, "type" : "object" }, "BuildRacks" : { "additionalProperties" : false, + "default" : { + "ids_only" : "0" + }, "properties" : { "ids_only" : { - "$ref" : "#/definitions/boolean_string_default_false" + "$ref" : "#/definitions/boolean_string" }, "phase" : { "oneOf" : [ @@ -101,9 +108,11 @@ }, "ChangePassword" : { "additionalProperties" : false, + "default" : { + "clear_tokens" : "login_only" + }, "properties" : { "clear_tokens" : { - "default" : "login_only", "enum" : [ "none", "login_only", @@ -220,28 +229,37 @@ }, "NotifyUsers" : { "additionalProperties" : false, + "default" : { + "send_mail" : "1" + }, "description" : "used for operations where email can optionally be sent", "properties" : { "send_mail" : { - "$ref" : "#/definitions/boolean_string_default_true" + "$ref" : "#/definitions/boolean_string" } }, "type" : "object" }, "ProcessDeviceReport" : { "additionalProperties" : false, + "default" : { + "no_save_db" : "0" + }, "properties" : { "no_save_db" : { - "$ref" : "#/definitions/boolean_string_default_false" + "$ref" : "#/definitions/boolean_string" } }, "type" : "object" }, "ResetUserPassword" : { "additionalProperties" : false, + "default" : { + "clear_tokens" : "login_only", + "send_mail" : "1" + }, "properties" : { "clear_tokens" : { - "default" : "login_only", "enum" : [ "none", "login_only", @@ -250,52 +268,54 @@ "type" : "string" }, "send_mail" : { - "$ref" : "#/definitions/boolean_string_default_true" + "$ref" : "#/definitions/boolean_string" } }, "type" : "object" }, "RevokeUserTokens" : { - "allOf" : [ - { - "additionalProperties" : false, - "properties" : { - "api_only" : { - "$ref" : "#/definitions/boolean_string_default_false" - }, - "login_only" : { - "$ref" : "#/definitions/boolean_string_default_false" - }, - "send_mail" : { - "$ref" : "#/definitions/boolean_string_default_true" - } + "additionalProperties" : false, + "default" : { + "api_only" : "0", + "login_only" : "0", + "send_mail" : "1" + }, + "not" : { + "properties" : { + "api_only" : { + "const" : "1" }, - "type" : "object" - }, - { - "not" : { - "properties" : { - "api_only" : { - "const" : "1" - }, - "login_only" : { - "const" : "1" - } - }, - "required" : [ - "login_only", - "api_only" - ], - "type" : "object" + "login_only" : { + "const" : "1" } + }, + "required" : [ + "login_only", + "api_only" + ], + "type" : "object" + }, + "properties" : { + "api_only" : { + "$ref" : "#/definitions/boolean_string" + }, + "login_only" : { + "$ref" : "#/definitions/boolean_string" + }, + "send_mail" : { + "$ref" : "#/definitions/boolean_string" } - ] + }, + "type" : "object" }, "SetPhase" : { "additionalProperties" : false, + "default" : { + "rack_only" : "0" + }, "properties" : { "rack_only" : { - "$ref" : "#/definitions/boolean_string_default_false" + "$ref" : "#/definitions/boolean_string" } }, "type" : "object" @@ -322,22 +342,6 @@ ], "type" : "string" }, - "boolean_string_default_false" : { - "default" : "0", - "enum" : [ - "0", - "1" - ], - "type" : "string" - }, - "boolean_string_default_true" : { - "default" : "1", - "enum" : [ - "0", - "1" - ], - "type" : "string" - }, "boolean_string_or_flag" : { "description" : "\"?foo\" and \"?foo=1\" are true; \"?foo=0\" is false", "oneOf" : [ diff --git a/docs/json-schema/request.json b/docs/json-schema/request.json index 1da03dcfe..9ed6b6274 100644 --- a/docs/json-schema/request.json +++ b/docs/json-schema/request.json @@ -701,6 +701,9 @@ }, "Login" : { "additionalProperties" : false, + "default" : { + "set_session" : false + }, "oneOf" : [ { "required" : [ @@ -721,7 +724,6 @@ "$ref" : "common.json#/definitions/non_empty_string" }, "set_session" : { - "default" : false, "type" : "boolean" }, "user_id" : { diff --git a/docs/modules/Conch::Plugin::JSONValidator.md b/docs/modules/Conch::Plugin::JSONValidator.md index 4f1c79d12..c2c9d3291 100644 --- a/docs/modules/Conch::Plugin::JSONValidator.md +++ b/docs/modules/Conch::Plugin::JSONValidator.md @@ -47,6 +47,8 @@ arrayref). On success, returns the validated data; on failure, an HTTP 400 response is prepared, using the [response.json#/definitions/QueryParamsValidationError](../json-schema/response.json#/definitions/QueryParamsValidationError) json response schema. +Population of missing data from specified defaults is performed. + ### validate\_request Given the name of a json schema in the request namespace, validate the provided payload against @@ -63,9 +65,6 @@ Returns a [JSON::Validator](https://metacpan.org/pod/JSON%3A%3AValidator) object Because values are being parsed from the URI string, all values are strings even if they look like numbers. -No default population is done yet though; see -[https://github.com/mojolicious/json-validator/issues/158](https://github.com/mojolicious/json-validator/issues/158). - ### get\_request\_validator Returns a [JSON::Validator](https://metacpan.org/pod/JSON%3A%3AValidator) object suitable for validating an endpoint's json request payload. diff --git a/json-schema/query_params.yaml b/json-schema/query_params.yaml index 82b12a27c..a1880023b 100644 --- a/json-schema/query_params.yaml +++ b/json-schema/query_params.yaml @@ -1,20 +1,10 @@ -# Note: for now, defaults are for documentation purposes only. -# see https://github.com/mojolicious/json-validator/issues/158 --- -$comment: 'Note that all parameters are parsed internally from the request URI as strings, so all type checks here use strings. When a query parameter is used more than once, its values are parsed as an arrayref. See ../modules/Conch::Plugin::JSONValidator#validate_query_params. For now, defaults are for documentation purposes only. see https://github.com/mojolicious/json-validator/issues/158' +$comment: 'Note that all parameters are parsed internally from the request URI as strings, so all type checks here use strings. When a query parameter is used more than once, its values are parsed as an arrayref. See ../modules/Conch::Plugin::JSONValidator#validate_query_params.' $schema: 'http://json-schema.org/draft-07/schema#' definitions: boolean_string: type: string enum: [ '0', '1' ] - boolean_string_default_false: - type: string - enum: [ '0', '1' ] - default: '0' - boolean_string_default_true: - type: string - enum: [ '0', '1' ] - default: '1' boolean_string_or_flag: description: '"?foo" and "?foo=1" are true; "?foo=0" is false' oneOf: @@ -26,26 +16,29 @@ definitions: pattern: '^[0-9]+$' RevokeUserTokens: - allOf: - - type: object - additionalProperties: false - properties: - login_only: - $ref: '#/definitions/boolean_string_default_false' - api_only: - $ref: '#/definitions/boolean_string_default_false' - send_mail: - $ref: '#/definitions/boolean_string_default_true' - - not: - type: object - required: - - login_only - - api_only - properties: - login_only: - const: '1' - api_only: - const: '1' + type: object + additionalProperties: false + properties: + login_only: + $ref: '#/definitions/boolean_string' + api_only: + $ref: '#/definitions/boolean_string' + send_mail: + $ref: '#/definitions/boolean_string' + default: + login_only: '0' + api_only: '0' + send_mail: '1' + not: + type: object + required: + - login_only + - api_only + properties: + login_only: + const: '1' + api_only: + const: '1' ChangePassword: type: object additionalProperties: false @@ -56,7 +49,8 @@ definitions: - none - login_only - all - default: login_only + default: + clear_tokens: login_only DeactivateUser: $ref: '#/definitions/ChangePassword' ResetUserPassword: @@ -69,16 +63,20 @@ definitions: - none - login_only - all - default: login_only send_mail: - $ref: '#/definitions/boolean_string_default_true' + $ref: '#/definitions/boolean_string' + default: + clear_tokens: login_only + send_mail: '1' NotifyUsers: description: used for operations where email can optionally be sent type: object additionalProperties: false properties: send_mail: - $ref: '#/definitions/boolean_string_default_true' + $ref: '#/definitions/boolean_string' + default: + send_mail: '1' GetDeviceByAttribute: type: object minProperties: 1 @@ -114,7 +112,9 @@ definitions: additionalProperties: false properties: rack_only: - $ref: '#/definitions/boolean_string_default_false' + $ref: '#/definitions/boolean_string' + default: + rack_only: '0' GetBuilds: type: object properties: @@ -172,9 +172,9 @@ definitions: active_minutes: $ref: '#/definitions/non_negative_integer_string' ids_only: - $ref: '#/definitions/boolean_string_default_false' + $ref: '#/definitions/boolean_string' serials_only: - $ref: '#/definitions/boolean_string_default_false' + $ref: '#/definitions/boolean_string' allOf: - not: type: object @@ -187,6 +187,9 @@ definitions: - not: type: object required: [ phase_earlier_than, phase ] + default: + ids_only: '0' + serials_only: '0' BuildRacks: type: object additionalProperties: false @@ -200,13 +203,17 @@ definitions: items: $ref: common.yaml#/definitions/device_phase ids_only: - $ref: '#/definitions/boolean_string_default_false' + $ref: '#/definitions/boolean_string' + default: + ids_only: '0' ProcessDeviceReport: type: object additionalProperties: false properties: no_save_db: - $ref: '#/definitions/boolean_string_default_false' + $ref: '#/definitions/boolean_string' + default: + no_save_db: '0' HardwareProductSpecification: type: object additionalProperties: false diff --git a/json-schema/request.yaml b/json-schema/request.yaml index 297804a39..d188f591e 100644 --- a/json-schema/request.yaml +++ b/json-schema/request.yaml @@ -391,7 +391,8 @@ definitions: $ref: common.yaml#/definitions/non_empty_string set_session: type: boolean - default: false + default: + set_session: false UserIdOrEmail: type: object additionalProperties: true diff --git a/lib/Conch/Controller/Build.pm b/lib/Conch/Controller/Build.pm index 6a095a1a8..78d61bae0 100644 --- a/lib/Conch/Controller/Build.pm +++ b/lib/Conch/Controller/Build.pm @@ -345,7 +345,7 @@ sub add_user ($c) { $c->log->info('Updated access for user '.$user->id.' ('.$user->name.') in build ' .$c->stash('build_id_or_name').' to the '.$input->{role}.' role'); - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { $c->send_mail( template_file => 'build_user_update_user', From => 'noreply', @@ -375,7 +375,7 @@ sub add_user ($c) { }); $c->log->info('Added user '.$user->id.' ('.$user->name.') to build '.$c->stash('build_id_or_name').' with the '.$input->{role}.' role'); - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { $c->send_mail( template_file => 'build_user_add_user', From => 'noreply', @@ -428,7 +428,7 @@ sub remove_user ($c) { $c->log->info('removing user '.$user->id.' ('.$user->name.') from build '.$c->stash('build_id_or_name')); my $deleted = $rs->delete; - if ($deleted > 0 and $params->{send_mail} // 1) { + if ($deleted > 0 and $params->{send_mail}) { my $build_name = $c->stash('build_name') // $c->stash('build_rs')->get_column('name')->single; $c->send_mail( template_file => 'build_user_remove_user', @@ -541,7 +541,7 @@ sub add_organization ($c) { $c->log->info('Upgraded organization '.$organization->id.' in build '.$build_id.' to '.$input->{role}); my $build_name = $c->stash('build_name') // $c->stash('build_rs')->get_column('name')->single; - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { $c->send_mail( template_file => 'build_organization_update_members', To => $c->construct_address_list($organization->user_accounts->order_by('user_account.name')), @@ -579,7 +579,7 @@ sub add_organization ($c) { }); $c->log->info('Added organization '.$organization->id.' to build '.$build_id.' with the '.$input->{role}.' role'); - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { my $build_name = $c->stash('build_name') // $c->stash('build_rs')->get_column('name')->single; $c->send_mail( template_file => 'build_organization_add_members', @@ -637,7 +637,7 @@ sub remove_organization ($c) { $rs->delete; - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { $c->send_mail( template_file => 'build_organization_remove_members', To => $c->construct_address_list($organization->user_accounts->order_by('user_account.name')), diff --git a/lib/Conch/Controller/DeviceReport.pm b/lib/Conch/Controller/DeviceReport.pm index dad38b04f..034ca7827 100644 --- a/lib/Conch/Controller/DeviceReport.pm +++ b/lib/Conch/Controller/DeviceReport.pm @@ -26,7 +26,7 @@ Response contains no data but returns the resource to fetch the result in the Lo sub process ($c) { my $params = $c->validate_query_params('ProcessDeviceReport'); return if not $params; - return 1 if $params->{no_save_db} // 0; # dispatch to device_report#validate_report + return 1 if $params->{no_save_db}; # dispatch to device_report#validate_report my $unserialized_report = $c->validate_request('DeviceReport'); return if not $unserialized_report; diff --git a/lib/Conch/Controller/Organization.pm b/lib/Conch/Controller/Organization.pm index 98f6fce82..79b9a79e8 100644 --- a/lib/Conch/Controller/Organization.pm +++ b/lib/Conch/Controller/Organization.pm @@ -229,7 +229,7 @@ sub add_user ($c) { $c->log->info('Updated access for user '.$user->id.' ('.$user->name.') in organization ' .$c->stash('organization_id_or_name').' to the '.$input->{role}.' role'); - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { $c->send_mail( template_file => 'organization_user_update_user', From => 'noreply', @@ -259,7 +259,7 @@ sub add_user ($c) { }); $c->log->info('Added user '.$user->id.' ('.$user->name.') to organization '.$c->stash('organization_id_or_name').' with the '.$input->{role}.' role'); - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { $c->send_mail( template_file => 'organization_user_add_user', From => 'noreply', @@ -310,7 +310,7 @@ sub remove_user ($c) { $c->log->info('removing user '.$user->id.' ('.$user->name.') from organization '.$c->stash('organization_id_or_name')); my $deleted = $rs->delete; - if ($deleted > 0 and $params->{send_mail} // 1) { + if ($deleted > 0 and $params->{send_mail}) { my $organization_name = $c->stash('organization_name') // $c->stash('organization_rs')->get_column('name')->single; $c->send_mail( template_file => 'organization_user_remove_user', diff --git a/lib/Conch/Controller/Rack.pm b/lib/Conch/Controller/Rack.pm index 8f1fb6426..8aa726d16 100644 --- a/lib/Conch/Controller/Rack.pm +++ b/lib/Conch/Controller/Rack.pm @@ -552,7 +552,7 @@ sub set_phase ($c) { $rack->update({ updated => \'now()' }) if $rack->is_changed; $c->log->debug('set the phase for rack '.$rack->id.' to '.$input->{phase}); - if (not $params->{rack_only} // 0) { + if (not $params->{rack_only}) { $c->stash('rack_rs') ->related_resultset('device_locations') ->related_resultset('device') diff --git a/lib/Conch/Controller/User.pm b/lib/Conch/Controller/User.pm index 73bc84087..4d99594c8 100644 --- a/lib/Conch/Controller/User.pm +++ b/lib/Conch/Controller/User.pm @@ -75,15 +75,15 @@ sub revoke_user_tokens ($c) { $c->validate_request('Null'); return if $c->res->code; - my $login_only = $params->{login_only} // 0; - my $api_only = $params->{api_only} // 0; + my $login_only = $params->{login_only}; + my $api_only = $params->{api_only}; my $user = $c->stash('target_user'); $c->log->debug('revoking ' .($login_only ? 'login' : $api_only ? 'api' : 'all') .' tokens for user '.$user->name.', forcing them to /login again'); - my $send_mail = $user->id ne $c->stash('user_id') && ($params->{send_mail} // 1); + my $send_mail = $user->id ne $c->stash('user_id') && $params->{send_mail}; my $rs = $user->user_session_tokens->unexpired; $rs = $rs->login_only if $login_only; @@ -247,7 +247,7 @@ sub change_own_password ($c) { my $input = $c->validate_request('UserPassword'); return if not $input; - my $clear_tokens = $params->{clear_tokens} // 'login_only'; + my $clear_tokens = $params->{clear_tokens}; my $user = $c->stash('user'); $user->update({ @@ -293,7 +293,7 @@ sub reset_user_password ($c) { my $params = $c->validate_query_params('ResetUserPassword'); return if not $params; - my $clear_tokens = $params->{clear_tokens} // 'login_only'; + my $clear_tokens = $params->{clear_tokens}; my $user = $c->stash('target_user'); my %update = ( @@ -331,7 +331,7 @@ sub reset_user_password ($c) { From => 'noreply', Subject => 'Your Conch password has changed', password => $update{password}, - ) if $params->{send_mail} // 1; + ) if $params->{send_mail}; return $c->status(204); } @@ -401,7 +401,7 @@ sub update ($c) { }); } - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { %orig_columns = %orig_columns{keys %dirty_columns}; if (exists $dirty_columns{is_admin}) { @@ -477,7 +477,7 @@ sub create ($c) { my $user = $c->db_user_accounts->create({ $input->%*, force_password_change => 1 }); $c->log->info('created user: '.$user->name.', email: '.$user->email.', id: '.$user->id); - if ($params->{send_mail} // 1) { + if ($params->{send_mail}) { $c->stash('target_user', $user); $c->send_mail( template_file => 'new_user_account', @@ -549,7 +549,7 @@ sub deactivate ($c) { $user->delete_related('user_organization_roles'); $user->delete_related('user_build_roles'); - if ($params->{clear_tokens} // 1) { + if ($params->{clear_tokens}) { $c->log->warn('user '.$c->stash('user')->name.' deleting all user session tokens for user '.$user->name); $user->delete_related('user_session_tokens'); } diff --git a/lib/Conch/Plugin/JSONValidator.pm b/lib/Conch/Plugin/JSONValidator.pm index 8d32fcaad..c5cd57fb8 100644 --- a/lib/Conch/Plugin/JSONValidator.pm +++ b/lib/Conch/Plugin/JSONValidator.pm @@ -3,7 +3,7 @@ package Conch::Plugin::JSONValidator; use Mojo::Base 'Mojolicious::Plugin', -signatures; use feature 'unicode_strings', 'fc'; -use JSON::Validator; +use JSON::Validator 3.20; =pod @@ -56,6 +56,8 @@ arrayref). On success, returns the validated data; on failure, an HTTP 400 response is prepared, using the F json response schema. +Population of missing data from specified defaults is performed. + =cut $app->helper(validate_query_params => sub ($c, $schema_name, $data = $c->req->query_params->to_hash) { @@ -77,6 +79,10 @@ F json response schema. }); } + # now underlay data defaults + # (FIXME: we should be receiving these as annotations from the validator) + $data->%* = ( ($schema->{default} // {})->%*, $data->%* ); + $c->log->debug("Passed data validation for query_params schema $schema_name"); return $data; }); @@ -121,15 +127,11 @@ Returns a L object suitable for validating an endpoint's query Because values are being parsed from the URI string, all values are strings even if they look like numbers. -No default population is done yet though; see -L. - =cut my $_query_params_validator; $app->helper(get_query_params_validator => sub ($c) { return $_query_params_validator if $_query_params_validator; - # TODO: ->new(coerce => '...,defaults') $_query_params_validator = JSON::Validator->new; $_query_params_validator->formats->@{qw(json-pointer uri uri-reference)} = (\&_check_json_pointer, \&_check_uri, \&_check_uri_reference); diff --git a/t/integration/json_schema-unauthed.t b/t/integration/json_schema-unauthed.t index dbb70a2c3..ab309026b 100644 --- a/t/integration/json_schema-unauthed.t +++ b/t/integration/json_schema-unauthed.t @@ -358,7 +358,7 @@ $t->get_ok('/json_schema/request/Login') user_id => { '$ref' => '#/definitions/uuid' }, email => { '$ref' => '#/definitions/email_address' }, password => { '$ref' => '#/definitions/non_empty_string' }, - set_session => { type => 'boolean', default => JSON::PP::false }, + set_session => { type => 'boolean' }, }, definitions => { non_empty_string => { type => 'string', minLength => 1 }, @@ -366,6 +366,7 @@ $t->get_ok('/json_schema/request/Login') email_address => superhashof({}), mojo_relaxed_placeholder => superhashof({}), }, + default => { set_session => bool(0) }, }); $t->get_ok('/json_schema/query_params/ResetUserPassword') @@ -376,13 +377,17 @@ $t->get_ok('/json_schema/query_params/ResetUserPassword') '$schema' => 'http://json-schema.org/draft-07/schema#', '$id' => $base_uri.'json_schema/query_params/ResetUserPassword', definitions => { - boolean_string_default_true => { type => 'string', enum => [ '0', '1' ], default => '1' }, + boolean_string => { type => 'string', enum => [ '0', '1' ] }, }, type => 'object', additionalProperties => bool(0), properties => { - clear_tokens => { type => 'string', enum => [ qw(none login_only all) ], default => 'login_only' }, - send_mail => { '$ref' => '#/definitions/boolean_string_default_true' }, + clear_tokens => { type => 'string', enum => [ qw(none login_only all) ] }, + send_mail => { '$ref' => '#/definitions/boolean_string' }, + }, + default => { + clear_tokens => 'login_only', + send_mail => '1', }, }); diff --git a/t/integration/users.t b/t/integration/users.t index 0b66a3536..20703c3ee 100644 --- a/t/integration/users.t +++ b/t/integration/users.t @@ -578,7 +578,7 @@ subtest 'JWT authentication' => sub { $t_super->post_ok('/user/'.$ro_user->email.'/revoke?login_only=1&api_only=1') ->status_is(400) ->json_schema_is('QueryParamsValidationError') - ->json_cmp_deeply('/details', [ { path => '/', message => re(qr{allOf/1 should not match}i) } ]) + ->json_cmp_deeply('/details', [ { path => '/', message => re(qr{Should not match}) } ]) ->email_not_sent; $t_super->post_ok('/user/'.$ro_user->email.'/revoke?api_only=1') diff --git a/t/json-validation.t b/t/json-validation.t index 635f52a10..98560969c 100644 --- a/t/json-validation.t +++ b/t/json-validation.t @@ -33,6 +33,27 @@ subtest 'failed query params validation' => sub { ->log_warn_like(qr{^FAILED query_params validation for schema ChangePassword: /clear_tokens: Not in enum list}); }; +subtest 'insert defaults for missing query parameter values' => sub { + my $validator = $t->app->get_query_params_validator; + my $schema = $validator->get('/definitions/RevokeUserTokens'); + my $data = {}; + + my @errors = $validator->validate($data, $schema); + cmp_deeply(\@errors, [], 'got no validation errors'); + cmp_deeply($data, {}, 'no default coercion from the validator itself'); + + ok($t->app->validate_query_params('RevokeUserTokens', $data), 'no validation errors here either'); + cmp_deeply( + $data, + { + login_only => 0, + api_only => 0, + send_mail => 1, + }, + 'empty params hash populated with default values', + ); +}; + subtest 'failed request validation' => sub { $t->post_ok('/login', json => { email => 'foo@bar.com' }) ->status_is(400) From ef5556f8507a280efd9fe697d0f20ce26d090ab8 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 30 Jan 2020 16:12:02 -0800 Subject: [PATCH 5/7] eliminate some unneeded local variables --- lib/Test/Conch.pm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Test/Conch.pm b/lib/Test/Conch.pm index 8d2d2a83f..472603031 100644 --- a/lib/Test/Conch.pm +++ b/lib/Test/Conch.pm @@ -334,12 +334,11 @@ the hash as the schema to validate. =cut sub json_schema_is ($self, $schema, $message = undef) { - my @errors; return $self->test('fail', 'No request has been made') unless $self->tx; my $data = $self->tx->res->json; return $self->test('fail', 'No JSON in response') unless $data; - my $schema_name; + my ($schema_name, @errors); if (ref $schema) { $schema_name = ''; } @@ -350,15 +349,15 @@ sub json_schema_is ($self, $schema, $message = undef) { } @errors = $self->validator->validate($data, $schema); - my $error_count = @errors; - return $self->test('ok', !$error_count, $message // 'JSON response has no schema validation errors') + + return $self->test('ok', !@errors, $message // 'JSON response has no schema validation errors') ->or(sub ($self) { - my $errors = [ map +{ path => $_->path, message => $_->message }, @errors ]; - Test::More::diag($error_count - .' error(s) occurred when validating ' + Test::More::diag( + @errors.' error(s) occurred when validating ' .$self->tx->req->method.' '.$self->tx->req->url->path .' with schema '.$schema_name.":\n\t" - .Data::Dumper->new([ $errors ])->Sortkeys(1)->Indent(1)->Terse(1)->Dump); + .Data::Dumper->new([[ map +{ path => $_->path, message => $_->message }, @errors ]]) + ->Sortkeys(1)->Indent(1)->Terse(1)->Dump); 0; } From b03734b2889d0bf951f7757f6cc55ac6ec85bf02 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 13 Feb 2020 13:40:48 -0800 Subject: [PATCH 6/7] support $t->json_schema_is('http...') --- docs/modules/Test::Conch.md | 8 +++---- lib/Test/Conch.pm | 23 +++++++++++++------ t/integration/json_schema-unauthed.t | 34 ++++++++++++++-------------- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/docs/modules/Test::Conch.md b/docs/modules/Test::Conch.md index a075fbbf4..402001cc9 100644 --- a/docs/modules/Test::Conch.md +++ b/docs/modules/Test::Conch.md @@ -84,10 +84,10 @@ As ["location\_is"](#location_is), but takes a regular expression. ### json\_schema\_is -Validates the JSON response of -the most recent request. If given a string, looks up the schema in -\#/definitions in the JSON Schema spec to validate. If given a hash, uses -the hash as the schema to validate. +Validates the JSON response of the most recent request. If given a string that looks like a URL, +fetches that URL; otherwise if a string, looks up the schema in `#/definitions` in the JSON Schema +response specification document to validate. If given a hash, uses the hash as the schema to +validate. ### json\_cmp\_deeply diff --git a/lib/Test/Conch.pm b/lib/Test/Conch.pm index 472603031..75f983852 100644 --- a/lib/Test/Conch.pm +++ b/lib/Test/Conch.pm @@ -326,10 +326,10 @@ sub location_like ($self, $pattern, $desc = 'location header') { =head2 json_schema_is -Validates the JSON response of -the most recent request. If given a string, looks up the schema in -#/definitions in the JSON Schema spec to validate. If given a hash, uses -the hash as the schema to validate. +Validates the JSON response of the most recent request. If given a string that looks like a URL, +fetches that URL; otherwise if a string, looks up the schema in C<#/definitions> in the JSON Schema +response specification document to validate. If given a hash, uses the hash as the schema to +validate. =cut @@ -338,17 +338,26 @@ sub json_schema_is ($self, $schema, $message = undef) { my $data = $self->tx->res->json; return $self->test('fail', 'No JSON in response') unless $data; + my $validator; + my ($schema_name, @errors); if (ref $schema) { $schema_name = ''; + $validator = $self->validator; + } + elsif ($schema =~ /^http/) { + # do not use the network, but rely solely on JSON::Validator's internal cache + $validator = JSON::Validator->new(ua => undef, version => 7)->schema($schema); + ($schema_name, $schema) = ($schema, undef); } else { $schema_name = $schema; - $schema = $self->validator->get('/definitions/'.$schema_name); - die "schema '$schema_name' not found" if not $schema; + $validator = $self->validator; + $schema = $validator->get('/definitions/'.$schema_name) + or die "schema '$schema_name' not found"; } - @errors = $self->validator->validate($data, $schema); + @errors = $validator->validate($data, $schema); return $self->test('ok', !@errors, $message // 'JSON response has no schema validation errors') ->or(sub ($self) { diff --git a/t/integration/json_schema-unauthed.t b/t/integration/json_schema-unauthed.t index ab309026b..99365e56a 100644 --- a/t/integration/json_schema-unauthed.t +++ b/t/integration/json_schema-unauthed.t @@ -272,9 +272,9 @@ subtest 'extraction with $refs' => sub { foreach @tests; }; +use constant SPEC_URL => 'http://json-schema.org/draft-07/schema#'; my $t = Test::Conch->new(pg => undef); -my $json_spec_schema = $_validator->schema->data; my $base_uri = $t->ua->server->url; # used as the base uri for all requests $t->get_ok('/schema/request/foo') @@ -304,9 +304,9 @@ $t->get_ok('/json_schema/response/Ping' => { 'If-Modified-Since' => 'Sun, 01 Jan ->status_is(200) ->header_is('Last-Modified', $t->app->startup_time->strftime('%a, %d %b %Y %T GMT')) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) + ->json_schema_is(SPEC_URL) ->json_cmp_deeply({ - '$schema' => 'http://json-schema.org/draft-07/schema#', + '$schema' => SPEC_URL, '$id' => $base_uri.'json_schema/response/Ping', type => 'object', additionalProperties => bool(0), @@ -326,9 +326,9 @@ $t->ua->max_redirects(10); $t->get_ok('/schema/response/login_token') ->status_is(200) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) + ->json_schema_is(SPEC_URL) ->json_cmp_deeply(my $response_login_token = { - '$schema' => 'http://json-schema.org/draft-07/schema#', + '$schema' => SPEC_URL, '$id' => $base_uri.'json_schema/response/LoginToken', type => 'object', additionalProperties => bool(0), @@ -340,15 +340,15 @@ $t->ua->max_redirects(0); $t->get_ok('/json_schema/response/LoginToken') ->status_is(200) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) + ->json_schema_is(SPEC_URL) ->json_cmp_deeply($response_login_token); $t->get_ok('/json_schema/request/Login') ->status_is(200) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) + ->json_schema_is(SPEC_URL) ->json_cmp_deeply({ - '$schema' => 'http://json-schema.org/draft-07/schema#', + '$schema' => SPEC_URL, '$id' => $base_uri.'json_schema/request/Login', type => 'object', additionalProperties => bool(0), @@ -372,9 +372,9 @@ $t->get_ok('/json_schema/request/Login') $t->get_ok('/json_schema/query_params/ResetUserPassword') ->status_is(200) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) + ->json_schema_is(SPEC_URL) ->json_cmp_deeply({ - '$schema' => 'http://json-schema.org/draft-07/schema#', + '$schema' => SPEC_URL, '$id' => $base_uri.'json_schema/query_params/ResetUserPassword', definitions => { boolean_string => { type => 'string', enum => [ '0', '1' ] }, @@ -394,7 +394,7 @@ $t->get_ok('/json_schema/query_params/ResetUserPassword') $t->get_ok('/json_schema/request/HardwareProductCreate') ->status_is(200) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) + ->json_schema_is(SPEC_URL) ->json_cmp_deeply('', superhashof({ '$id' => $base_uri.'json_schema/request/HardwareProductCreate', definitions => { @@ -412,16 +412,16 @@ $t->get_ok('/json_schema/request/HardwareProductCreate') $t->get_ok('/json_schema/request/DeviceReport') ->status_is(200) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) - ->json_is('/$schema', 'http://json-schema.org/draft-07/schema#'); + ->json_schema_is(SPEC_URL) + ->json_is('/$schema', SPEC_URL); $t->get_ok('/json_schema/common/non_zero_uuid') ->status_is(200) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) + ->json_schema_is(SPEC_URL) ->json_cmp_deeply({ '$id' => $base_uri.'json_schema/common/non_zero_uuid', - '$schema' => 'http://json-schema.org/draft-07/schema#', + '$schema' => SPEC_URL, allOf => [ { '$ref' => '#/definitions/uuid' }, { not => { const => '00000000-0000-0000-0000-000000000000' } }, @@ -436,10 +436,10 @@ $t->get_ok('/json_schema/common/non_zero_uuid') $t->get_ok('/json_schema/device_report/DeviceReport_v3_0_0') ->status_is(200) ->header_is('Content-Type', 'application/schema+json') - ->json_schema_is($json_spec_schema) + ->json_schema_is(SPEC_URL) ->json_cmp_deeply({ '$id' => $base_uri.'json_schema/device_report/DeviceReport_v3_0_0', - '$schema' => 'http://json-schema.org/draft-07/schema#', + '$schema' => SPEC_URL, description => ignore, type => 'object', required => ignore, From f308f3468fb77b584ee0c867c1c4b36f957a5811 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 14 Sep 2020 16:22:41 -0700 Subject: [PATCH 7/7] s/definitions/$defs/ in all JSON schemas --- docs/index.md | 6 +- docs/json-schema/common.json | 18 +- docs/json-schema/device_report.json | 46 +- docs/json-schema/other.json | 4 +- docs/json-schema/query_params.json | 68 +-- docs/json-schema/request.json | 260 +++++------ docs/json-schema/response.json | 422 +++++++++--------- .../Conch::Controller::HardwareProduct.md | 4 +- docs/modules/Conch::Controller::JSONSchema.md | 6 +- docs/modules/Conch::DB::ResultSet::Device.md | 2 +- docs/modules/Conch::Plugin::JSONValidator.md | 4 +- docs/modules/Conch::Route.md | 20 +- docs/modules/Conch::Route::Build.md | 28 +- docs/modules/Conch::Route::Datacenter.md | 10 +- docs/modules/Conch::Route::DatacenterRoom.md | 10 +- docs/modules/Conch::Route::Device.md | 52 +-- docs/modules/Conch::Route::DeviceReport.md | 8 +- docs/modules/Conch::Route::HardwareProduct.md | 12 +- docs/modules/Conch::Route::HardwareVendor.md | 6 +- docs/modules/Conch::Route::Organization.md | 10 +- docs/modules/Conch::Route::Rack.md | 22 +- docs/modules/Conch::Route::RackLayout.md | 8 +- docs/modules/Conch::Route::RackRole.md | 8 +- docs/modules/Conch::Route::Relay.md | 6 +- docs/modules/Conch::Route::User.md | 46 +- docs/modules/Conch::Route::ValidationPlan.md | 6 +- docs/modules/Conch::Route::ValidationState.md | 2 +- docs/modules/Test::Conch.md | 2 +- json-schema/common.yaml | 14 +- json-schema/device_report.yaml | 42 +- json-schema/other.yaml | 12 +- json-schema/query_params.yaml | 64 +-- json-schema/request.yaml | 256 +++++------ json-schema/response.yaml | 418 ++++++++--------- lib/Conch/Controller/HardwareProduct.pm | 4 +- lib/Conch/Controller/JSONSchema.pm | 18 +- lib/Conch/DB/ResultSet/Device.pm | 2 +- lib/Conch/Plugin/JSONValidator.pm | 8 +- lib/Conch/Plugin/Rollbar.pm | 2 +- lib/Conch/Route.pm | 20 +- lib/Conch/Route/Build.pm | 28 +- lib/Conch/Route/Datacenter.pm | 10 +- lib/Conch/Route/DatacenterRoom.pm | 10 +- lib/Conch/Route/Device.pm | 52 +-- lib/Conch/Route/DeviceReport.pm | 8 +- lib/Conch/Route/HardwareProduct.pm | 12 +- lib/Conch/Route/HardwareVendor.pm | 6 +- lib/Conch/Route/Organization.pm | 10 +- lib/Conch/Route/Rack.pm | 22 +- lib/Conch/Route/RackLayout.pm | 8 +- lib/Conch/Route/RackRole.pm | 8 +- lib/Conch/Route/Relay.pm | 6 +- lib/Conch/Route/User.pm | 46 +- lib/Conch/Route/ValidationPlan.pm | 6 +- lib/Conch/Route/ValidationState.pm | 2 +- lib/Test/Conch.pm | 4 +- misc/extract-schema | 2 +- t/data/test-schema.yaml | 34 +- t/data/test-schema2.yaml | 6 +- t/integration/crud/devices.t | 4 +- t/integration/json_schema-unauthed.t | 64 +-- t/json-validation.t | 14 +- t/pod-spelling.t | 2 +- 63 files changed, 1160 insertions(+), 1160 deletions(-) diff --git a/docs/index.md b/docs/index.md index 9ab55bf28..c51fd5199 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 diff --git a/docs/json-schema/common.json b/docs/json-schema/common.json index b90a31825..ee24379eb 100644 --- a/docs/json-schema/common.json +++ b/docs/json-schema/common.json @@ -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" : { @@ -64,7 +63,7 @@ "type" : "string" }, { - "$ref" : "#/definitions/mojo_relaxed_placeholder" + "$ref" : "#/$defs/mojo_relaxed_placeholder" } ] }, @@ -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+$", @@ -104,7 +103,7 @@ "type" : "string" }, { - "$ref" : "#/definitions/mojo_relaxed_placeholder" + "$ref" : "#/$defs/mojo_relaxed_placeholder" } ] }, @@ -153,7 +152,7 @@ "non_zero_uuid" : { "allOf" : [ { - "$ref" : "#/definitions/uuid" + "$ref" : "#/$defs/uuid" }, { "not" : { @@ -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}$", @@ -199,5 +198,6 @@ ], "type" : "string" } - } + }, + "$schema" : "http://json-schema.org/draft-07/schema#" } diff --git a/docs/json-schema/device_report.json b/docs/json-schema/device_report.json index e936cdf7e..cd3864be8 100644 --- a/docs/json-schema/device_report.json +++ b/docs/json-schema/device_report.json @@ -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" : { @@ -30,7 +29,7 @@ "memory-serial-number" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, { "type" : "null" @@ -40,7 +39,7 @@ "memory-size" : { "oneOf" : [ { - "$ref" : "#/definitions/int_or_stringy_int" + "$ref" : "#/$defs/int_or_stringy_int" }, { "type" : "null" @@ -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" @@ -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" @@ -99,7 +98,7 @@ "type" : "object" }, "propertyNames" : { - "$ref" : "common.json#/definitions/disk_serial_number" + "$ref" : "common.json#/$defs/disk_serial_number" }, "type" : "object" }, @@ -109,7 +108,7 @@ "ipaddr" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/ipaddr" + "$ref" : "common.json#/$defs/ipaddr" }, { "type" : "null" @@ -117,12 +116,12 @@ ] }, "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" @@ -132,7 +131,7 @@ "peer_mac" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/macaddr" + "$ref" : "common.json#/$defs/macaddr" }, { "type" : "null" @@ -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 @@ -195,7 +194,7 @@ "relay" : { "properties" : { "serial" : { - "$ref" : "common.json#/definitions/relay_serial_number" + "$ref" : "common.json#/$defs/relay_serial_number" } }, "required" : [ @@ -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" : [ @@ -258,5 +257,6 @@ } ] } - } + }, + "$schema" : "http://json-schema.org/draft-07/schema#" } diff --git a/docs/json-schema/other.json b/docs/json-schema/other.json index 26ae6170d..9b48e9258 100644 --- a/docs/json-schema/other.json +++ b/docs/json-schema/other.json @@ -1,5 +1,5 @@ { - "definitions" : { + "$defs" : { "RollbarPayload" : { "additionalProperties" : false, "properties" : { @@ -233,7 +233,7 @@ "type" : "integer" }, "uuid" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "required" : [ diff --git a/docs/json-schema/query_params.json b/docs/json-schema/query_params.json index ad59e7d42..89604851f 100644 --- a/docs/json-schema/query_params.json +++ b/docs/json-schema/query_params.json @@ -1,7 +1,6 @@ { "$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/query_params/$schema_name' endpoints, or within conch itself, json-schema/query_params.yaml.\nNote that all parameters are parsed internally from the request URI as strings, so all type checks here use strings. When a query parameter is used more than once, its values are parsed as an arrayref. See ../modules/Conch::Plugin::JSONValidator#validate_query_params.", - "$schema" : "http://json-schema.org/draft-07/schema#", - "definitions" : { + "$defs" : { "BuildDevices" : { "additionalProperties" : true, "allOf" : [ @@ -38,16 +37,16 @@ }, "properties" : { "active_minutes" : { - "$ref" : "#/definitions/non_negative_integer_string" + "$ref" : "#/$defs/non_negative_integer_string" }, "health" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_health" + "$ref" : "common.json#/$defs/device_health" }, { "items" : { - "$ref" : "common.json#/definitions/device_health" + "$ref" : "common.json#/$defs/device_health" }, "minItems" : 2, "type" : "array", @@ -56,16 +55,16 @@ ] }, "ids_only" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" }, "phase" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, { "items" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "minItems" : 2, "type" : "array", @@ -74,7 +73,7 @@ ] }, "serials_only" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" } }, "type" : "object" @@ -86,16 +85,16 @@ }, "properties" : { "ids_only" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" }, "phase" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, { "items" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "minItems" : 2, "type" : "array", @@ -124,7 +123,7 @@ "type" : "object" }, "DeactivateUser" : { - "$ref" : "#/definitions/ChangePassword" + "$ref" : "#/$defs/ChangePassword" }, "FindDevice" : { "additionalProperties" : true, @@ -135,7 +134,7 @@ "const" : "" }, { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" } ] } @@ -159,10 +158,10 @@ }, "properties" : { "completed" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" }, "started" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" } }, "type" : "object" @@ -178,18 +177,18 @@ "type" : "string" }, "ipaddr" : { - "$ref" : "common.json#/definitions/ipaddr" + "$ref" : "common.json#/$defs/ipaddr" }, "link" : { "format" : "uri", "type" : "string" }, "mac" : { - "$ref" : "common.json#/definitions/macaddr" + "$ref" : "common.json#/$defs/macaddr" } }, "propertyNames" : { - "$ref" : "common.json#/definitions/device_setting_key" + "$ref" : "common.json#/$defs/device_setting_key" }, "type" : "object" }, @@ -199,11 +198,11 @@ "status" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/validation_status" + "$ref" : "common.json#/$defs/validation_status" }, { "items" : { - "$ref" : "common.json#/definitions/validation_status" + "$ref" : "common.json#/$defs/validation_status" }, "minItems" : 2, "type" : "array", @@ -235,7 +234,7 @@ "description" : "used for operations where email can optionally be sent", "properties" : { "send_mail" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" } }, "type" : "object" @@ -247,7 +246,7 @@ }, "properties" : { "no_save_db" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" } }, "type" : "object" @@ -268,7 +267,7 @@ "type" : "string" }, "send_mail" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" } }, "type" : "object" @@ -297,13 +296,13 @@ }, "properties" : { "api_only" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" }, "login_only" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" }, "send_mail" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" } }, "type" : "object" @@ -315,7 +314,7 @@ }, "properties" : { "rack_only" : { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" } }, "type" : "object" @@ -324,13 +323,13 @@ "additionalProperties" : true, "properties" : { "with_device_health" : { - "$ref" : "#/definitions/boolean_string_or_flag" + "$ref" : "#/$defs/boolean_string_or_flag" }, "with_device_phases" : { - "$ref" : "#/definitions/boolean_string_or_flag" + "$ref" : "#/$defs/boolean_string_or_flag" }, "with_rack_phases" : { - "$ref" : "#/definitions/boolean_string_or_flag" + "$ref" : "#/$defs/boolean_string_or_flag" } }, "type" : "object" @@ -349,14 +348,15 @@ "const" : "" }, { - "$ref" : "#/definitions/boolean_string" + "$ref" : "#/$defs/boolean_string" } ] }, "non_negative_integer_string" : { - "description" : "see common.json#/definitions/non_negative_integer", + "description" : "see common.json#/$defs/non_negative_integer", "pattern" : "^[0-9]+$", "type" : "string" } - } + }, + "$schema" : "http://json-schema.org/draft-07/schema#" } diff --git a/docs/json-schema/request.json b/docs/json-schema/request.json index 9ed6b6274..db9874108 100644 --- a/docs/json-schema/request.json +++ b/docs/json-schema/request.json @@ -1,15 +1,14 @@ { "$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/request/$schema_name' endpoints, or within conch itself, json-schema/request.yaml.", - "$schema" : "http://json-schema.org/draft-07/schema#", - "definitions" : { + "$defs" : { "BuildAddOrganization" : { "additionalProperties" : false, "properties" : { "organization_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" } }, "required" : [ @@ -34,13 +33,13 @@ ], "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" }, "user_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "required" : [ @@ -80,10 +79,10 @@ ], "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "user_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "type" : "object" @@ -93,16 +92,16 @@ "uniqueItems" : true }, "build_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "description" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "started" : { "format" : "date-time", @@ -133,7 +132,7 @@ "asset_tag" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_asset_tag" + "$ref" : "common.json#/$defs/device_asset_tag" }, { "type" : "null" @@ -141,16 +140,16 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "serial_number" : { - "$ref" : "common.json#/definitions/device_serial_number" + "$ref" : "common.json#/$defs/device_serial_number" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "required" : [ @@ -168,7 +167,7 @@ "links" : { "allOf" : [ { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, { "minItems" : 1 @@ -187,7 +186,7 @@ "type" : "null" }, { - "$ref" : "#/definitions/BuildLinks" + "$ref" : "#/$defs/BuildLinks" } ] }, @@ -212,15 +211,15 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } ] }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "started" : { "oneOf" : [ @@ -240,16 +239,16 @@ "additionalProperties" : false, "properties" : { "location" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "region" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "vendor" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "vendor_name" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } }, "required" : [ @@ -263,16 +262,16 @@ "additionalProperties" : false, "properties" : { "alias" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "az" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "datacenter_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "vendor_name" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" } }, "required" : [ @@ -288,16 +287,16 @@ "minProperties" : 1, "properties" : { "alias" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "az" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "datacenter_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "vendor_name" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" } }, "type" : "object" @@ -307,16 +306,16 @@ "minProperties" : 1, "properties" : { "location" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "region" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "vendor" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "vendor_name" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } }, "type" : "object" @@ -327,7 +326,7 @@ "asset_tag" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_asset_tag" + "$ref" : "common.json#/$defs/device_asset_tag" }, { "type" : "null" @@ -344,7 +343,7 @@ "additionalProperties" : false, "properties" : { "build_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "required" : [ @@ -358,10 +357,10 @@ "minProperties" : 1, "properties" : { "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "type" : "object" @@ -372,7 +371,7 @@ "links" : { "allOf" : [ { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, { "minItems" : 1 @@ -391,7 +390,7 @@ "type" : "null" }, { - "$ref" : "#/definitions/DeviceLinks" + "$ref" : "#/$defs/DeviceLinks" } ] }, @@ -399,10 +398,10 @@ "additionalProperties" : false, "properties" : { "rack_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "required" : [ @@ -415,7 +414,7 @@ "additionalProperties" : false, "properties" : { "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" } }, "required" : [ @@ -424,12 +423,12 @@ "type" : "object" }, "DeviceReport" : { - "$ref" : "device_report.json#/definitions/DeviceReport_v3_0_0" + "$ref" : "device_report.json#/$defs/DeviceReport_v3_0_0" }, "DeviceSetting" : { "allOf" : [ { - "$ref" : "#/definitions/DeviceSettings" + "$ref" : "#/$defs/DeviceSettings" }, { "maxProperties" : 1, @@ -441,7 +440,7 @@ "additionalProperties" : { "anyOf" : [ { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, { "type" : "number" @@ -453,14 +452,14 @@ }, "minProperties" : 1, "propertyNames" : { - "$ref" : "common.json#/definitions/device_setting_key" + "$ref" : "common.json#/$defs/device_setting_key" }, "type" : "object" }, "HardwareProductCreate" : { "allOf" : [ { - "$ref" : "#/definitions/HardwareProductUpdate" + "$ref" : "#/$defs/HardwareProductUpdate" }, { "required" : [ @@ -478,14 +477,14 @@ ] }, "HardwareProductSpecification" : { - "$ref" : "common.json#/definitions/HardwareProductSpecification" + "$ref" : "common.json#/$defs/HardwareProductSpecification" }, "HardwareProductUpdate" : { "additionalProperties" : false, "minProperties" : 1, "properties" : { "alias" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "bios_firmware" : { "type" : "string" @@ -500,10 +499,10 @@ "type" : "integer" }, "generation_name" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "hardware_vendor_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "hba_firmware" : { "oneOf" : [ @@ -518,7 +517,7 @@ "legacy_product_name" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, { "type" : "null" @@ -526,7 +525,7 @@ ] }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "nics_num" : { "type" : "integer" @@ -557,7 +556,7 @@ "prefix" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, { "type" : "null" @@ -571,7 +570,7 @@ "type" : "string" }, "rack_unit_size" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, "raid_lun_num" : { "type" : "integer" @@ -672,12 +671,12 @@ ] }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "specification" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/HardwareProductSpecification" + "$ref" : "common.json#/$defs/HardwareProductSpecification" }, { "type" : "null" @@ -691,7 +690,7 @@ "$comment" : "this property will become nullable in v3.3 and removed in v4.0", "allOf" : [ { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ], "deprecated" : true @@ -718,16 +717,16 @@ ], "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "password" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "set_session" : { "type" : "boolean" }, "user_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "required" : [ @@ -739,16 +738,16 @@ "additionalProperties" : false, "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "is_admin" : { "type" : "boolean" }, "name" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "password" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } }, "required" : [ @@ -761,7 +760,7 @@ "additionalProperties" : false, "properties" : { "name" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } }, "required" : [ @@ -788,13 +787,13 @@ ], "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" }, "user_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "required" : [ @@ -822,10 +821,10 @@ ], "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "user_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "type" : "object" @@ -835,10 +834,10 @@ "uniqueItems" : true }, "description" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "required" : [ @@ -857,12 +856,12 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } ] }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "type" : "object" @@ -871,10 +870,10 @@ "additionalProperties" : false, "properties" : { "device_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "required" : [ @@ -885,7 +884,7 @@ }, "RackAssignmentDeletes" : { "items" : { - "$ref" : "#/definitions/RackAssignmentDelete" + "$ref" : "#/$defs/RackAssignmentDelete" }, "minItems" : 1, "type" : "array", @@ -909,7 +908,7 @@ "device_asset_tag" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_asset_tag" + "$ref" : "common.json#/$defs/device_asset_tag" }, { "type" : "null" @@ -917,13 +916,13 @@ ] }, "device_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "device_serial_number" : { - "$ref" : "common.json#/definitions/device_serial_number" + "$ref" : "common.json#/$defs/device_serial_number" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "required" : [ @@ -933,7 +932,7 @@ }, "RackAssignmentUpdates" : { "items" : { - "$ref" : "#/definitions/RackAssignmentUpdate" + "$ref" : "#/$defs/RackAssignmentUpdate" }, "minItems" : 1, "type" : "array", @@ -943,28 +942,28 @@ "additionalProperties" : false, "properties" : { "asset_tag" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "build_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "datacenter_room_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "name" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" }, "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "rack_role_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "serial_number" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } }, "required" : [ @@ -979,13 +978,13 @@ "additionalProperties" : false, "properties" : { "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "required" : [ @@ -1000,10 +999,10 @@ "minProperties" : 1, "properties" : { "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "type" : "object" @@ -1013,10 +1012,10 @@ "additionalProperties" : false, "properties" : { "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "required" : [ @@ -1034,7 +1033,7 @@ "links" : { "allOf" : [ { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, { "minItems" : 1 @@ -1053,7 +1052,7 @@ "type" : "null" }, { - "$ref" : "#/definitions/BuildLinks" + "$ref" : "#/$defs/BuildLinks" } ] }, @@ -1061,7 +1060,7 @@ "additionalProperties" : false, "properties" : { "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" } }, "required" : [ @@ -1073,10 +1072,10 @@ "additionalProperties" : false, "properties" : { "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "rack_size" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "required" : [ @@ -1090,10 +1089,10 @@ "minProperties" : 1, "properties" : { "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "rack_size" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "type" : "object" @@ -1108,27 +1107,27 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } ] }, "build_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "datacenter_room_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "name" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" }, "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "rack_role_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "serial_number" : { "oneOf" : [ @@ -1136,7 +1135,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } ] } @@ -1151,13 +1150,13 @@ "type" : "string" }, "name" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "serial" : { - "$ref" : "common.json#/definitions/relay_serial_number" + "$ref" : "common.json#/$defs/relay_serial_number" }, "ssh_port" : { - "$ref" : "common.json#/definitions/non_negative_integer" + "$ref" : "common.json#/$defs/non_negative_integer" }, "version" : { "description" : "usually a git commit SHA", @@ -1174,13 +1173,13 @@ "minProperties" : 1, "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "is_admin" : { "type" : "boolean" }, "name" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } }, "type" : "object" @@ -1201,10 +1200,10 @@ ], "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "user_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "type" : "object" @@ -1213,7 +1212,7 @@ "additionalProperties" : false, "properties" : { "password" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" } }, "required" : [ @@ -1224,7 +1223,7 @@ "UserSetting" : { "allOf" : [ { - "$ref" : "#/definitions/UserSettings" + "$ref" : "#/$defs/UserSettings" }, { "maxProperties" : 1, @@ -1234,13 +1233,14 @@ }, "UserSettings" : { "additionalProperties" : { - "$ref" : "common.json#/definitions/non_empty_string" + "$ref" : "common.json#/$defs/non_empty_string" }, "minProperties" : 1, "propertyNames" : { - "$ref" : "common.json#/definitions/user_setting_key" + "$ref" : "common.json#/$defs/user_setting_key" }, "type" : "object" } - } + }, + "$schema" : "http://json-schema.org/draft-07/schema#" } diff --git a/docs/json-schema/response.json b/docs/json-schema/response.json index 28ecfc9a4..f3dc48d13 100644 --- a/docs/json-schema/response.json +++ b/docs/json-schema/response.json @@ -1,7 +1,6 @@ { "$comment" : "NOTE: This file is for human reference ONLY. For programmatic use, use the GET '/json_schema/response/$schema_name' endpoints, or within conch itself, json-schema/response.yaml.", - "$schema" : "http://json-schema.org/draft-07/schema#", - "definitions" : { + "$defs" : { "Build" : { "additionalProperties" : false, "else" : { @@ -17,7 +16,7 @@ ] }, "completed_user" : { - "$ref" : "#/definitions/UserTerse" + "$ref" : "#/$defs/UserTerse" } } }, @@ -31,7 +30,7 @@ "properties" : { "admins" : { "items" : { - "$ref" : "#/definitions/UserTerse" + "$ref" : "#/$defs/UserTerse" }, "minItems" : 1, "type" : "array", @@ -56,43 +55,43 @@ }, "device_health" : { "additionalProperties" : { - "$ref" : "common.json#/definitions/non_negative_integer" + "$ref" : "common.json#/$defs/non_negative_integer" }, "maxProperties" : 4, "minProperties" : 4, "propertyNames" : { - "$ref" : "common.json#/definitions/device_health" + "$ref" : "common.json#/$defs/device_health" }, "type" : "object" }, "device_phases" : { "additionalProperties" : { - "$ref" : "common.json#/definitions/non_negative_integer" + "$ref" : "common.json#/$defs/non_negative_integer" }, "maxProperties" : 5, "minProperties" : 5, "propertyNames" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "type" : "object" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "rack_phases" : { "additionalProperties" : { - "$ref" : "common.json#/definitions/non_negative_integer" + "$ref" : "common.json#/$defs/non_negative_integer" }, "maxProperties" : 5, "minProperties" : 5, "propertyNames" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "type" : "object" }, @@ -138,7 +137,7 @@ "properties" : { "admins" : { "items" : { - "$ref" : "#/definitions/UserTerse" + "$ref" : "#/$defs/UserTerse" }, "minItems" : 1, "type" : "array", @@ -155,13 +154,13 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { "type" : "string" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" } }, "required" : [ @@ -189,16 +188,16 @@ "additionalProperties" : false, "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { "type" : "string" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" } }, "required" : [ @@ -255,13 +254,13 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "started" : { "oneOf" : [ @@ -305,7 +304,7 @@ "type" : "string" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "location" : { "type" : "string" @@ -347,7 +346,7 @@ "additionalProperties" : false, "properties" : { "alias" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "az" : { "type" : "string" @@ -357,17 +356,17 @@ "type" : "string" }, "datacenter_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "updated" : { "format" : "date-time", "type" : "string" }, "vendor_name" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" } }, "required" : [ @@ -383,14 +382,14 @@ }, "DatacenterRoomsDetailed" : { "items" : { - "$ref" : "#/definitions/DatacenterRoomDetailed" + "$ref" : "#/$defs/DatacenterRoomDetailed" }, "type" : "array", "uniqueItems" : true }, "Datacenters" : { "items" : { - "$ref" : "#/definitions/Datacenter" + "$ref" : "#/$defs/Datacenter" }, "type" : "array", "uniqueItems" : true @@ -433,7 +432,7 @@ "asset_tag" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_asset_tag" + "$ref" : "common.json#/$defs/device_asset_tag" }, { "type" : "null" @@ -446,7 +445,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ] }, @@ -456,7 +455,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } ] }, @@ -524,7 +523,7 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "model" : { "oneOf" : [ @@ -537,12 +536,12 @@ ] }, "serial_number" : { - "$ref" : "common.json#/definitions/disk_serial_number" + "$ref" : "common.json#/$defs/disk_serial_number" }, "size" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/non_negative_integer" + "$ref" : "common.json#/$defs/non_negative_integer" }, { "type" : "null" @@ -552,7 +551,7 @@ "slot" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/non_negative_integer" + "$ref" : "common.json#/$defs/non_negative_integer" }, { "type" : "null" @@ -605,10 +604,10 @@ "uniqueItems" : true }, "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "health" : { - "$ref" : "common.json#/definitions/device_health" + "$ref" : "common.json#/$defs/device_health" }, "hostname" : { "oneOf" : [ @@ -621,7 +620,7 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "last_seen" : { "oneOf" : [ @@ -640,7 +639,7 @@ "type" : "null" }, { - "$ref" : "device_report.json#/definitions/DeviceReport_v3_0_0" + "$ref" : "device_report.json#/$defs/DeviceReport_v3_0_0" }, { "type" : "object" @@ -649,13 +648,13 @@ "description" : "the contents of the device report. Given its age we cannot provide a schema." }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "location" : { "$comment" : "location is included only when device 'phase' is earlier than 'production'", "oneOf" : [ { - "$ref" : "#/definitions/DeviceLocation" + "$ref" : "#/$defs/DeviceLocation" }, { "type" : "null" @@ -668,7 +667,7 @@ "additionalProperties" : false, "properties" : { "iface_name" : { - "$ref" : "common.json#/definitions/device_interface_name" + "$ref" : "common.json#/$defs/device_interface_name" }, "iface_type" : { "type" : "string" @@ -677,7 +676,7 @@ "type" : "string" }, "mac" : { - "$ref" : "common.json#/definitions/macaddr" + "$ref" : "common.json#/$defs/macaddr" }, "peer_mac" : { "oneOf" : [ @@ -724,13 +723,13 @@ "uniqueItems" : true }, "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "serial_number" : { - "$ref" : "common.json#/definitions/device_serial_number" + "$ref" : "common.json#/$defs/device_serial_number" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "system_uuid" : { "oneOf" : [ @@ -738,7 +737,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ] }, @@ -836,7 +835,7 @@ "asset_tag" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_asset_tag" + "$ref" : "common.json#/$defs/device_asset_tag" }, { "type" : "null" @@ -849,7 +848,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ] }, @@ -859,7 +858,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } ] }, @@ -868,10 +867,10 @@ "type" : "string" }, "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "health" : { - "$ref" : "common.json#/definitions/device_health" + "$ref" : "common.json#/$defs/device_health" }, "hostname" : { "oneOf" : [ @@ -884,7 +883,7 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "last_seen" : { "oneOf" : [ @@ -898,15 +897,15 @@ ] }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "rack_id" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, { "type" : "null" @@ -917,7 +916,7 @@ "description" : "rack.full_rack_name (datacenter_room.vendor_name + ':' + rack.name)", "oneOf" : [ { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" }, { "type" : "null" @@ -927,7 +926,7 @@ "rack_unit_start" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, { "type" : "null" @@ -935,10 +934,10 @@ ] }, "serial_number" : { - "$ref" : "common.json#/definitions/device_serial_number" + "$ref" : "common.json#/$defs/device_serial_number" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "system_uuid" : { "oneOf" : [ @@ -946,7 +945,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ] }, @@ -1007,7 +1006,7 @@ }, "DeviceIds" : { "items" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "type" : "array", "uniqueItems" : true @@ -1019,13 +1018,13 @@ "type" : "string" }, "datacenter_room" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "rack" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, "target_hardware_product" : { "additionalProperties" : false, @@ -1036,7 +1035,7 @@ "type" : "string" }, "hardware_vendor_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "id" : { "allOf" : [ @@ -1044,7 +1043,7 @@ "description" : "hardware product ID" }, { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ] }, @@ -1053,7 +1052,7 @@ "type" : "string" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "required" : [ @@ -1078,7 +1077,7 @@ "DeviceNic" : { "allOf" : [ { - "$ref" : "#/definitions/DeviceNicFields" + "$ref" : "#/$defs/DeviceNicFields" }, { "required" : [ @@ -1097,7 +1096,7 @@ "DeviceNicField" : { "allOf" : [ { - "$ref" : "#/definitions/DeviceNicFields" + "$ref" : "#/$defs/DeviceNicFields" }, { "maxProperties" : 1, @@ -1118,10 +1117,10 @@ "additionalProperties" : false, "properties" : { "device_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "iface_name" : { - "$ref" : "common.json#/definitions/device_interface_name" + "$ref" : "common.json#/$defs/device_interface_name" }, "iface_type" : { "type" : "string" @@ -1132,7 +1131,7 @@ "ipaddr" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/ipaddr" + "$ref" : "common.json#/$defs/ipaddr" }, { "type" : "null" @@ -1140,7 +1139,7 @@ ] }, "mac" : { - "$ref" : "common.json#/definitions/macaddr" + "$ref" : "common.json#/$defs/macaddr" }, "mtu" : { "oneOf" : [ @@ -1167,7 +1166,7 @@ }, "DeviceNics" : { "items" : { - "$ref" : "#/definitions/DeviceNic" + "$ref" : "#/$defs/DeviceNic" }, "type" : "array", "uniqueItems" : true @@ -1194,7 +1193,7 @@ }, "properties" : { "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "ipmi" : { "oneOf" : [ @@ -1210,12 +1209,12 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/ipaddr" + "$ref" : "common.json#/$defs/ipaddr" } ] }, "mac" : { - "$ref" : "common.json#/definitions/macaddr" + "$ref" : "common.json#/$defs/macaddr" } }, "required" : [ @@ -1232,12 +1231,12 @@ "type" : "null" }, { - "$ref" : "#/definitions/DeviceLocation" + "$ref" : "#/$defs/DeviceLocation" } ] }, "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "pxe" : { "oneOf" : [ @@ -1248,7 +1247,7 @@ "additionalProperties" : false, "properties" : { "mac" : { - "$ref" : "common.json#/definitions/macaddr" + "$ref" : "common.json#/$defs/macaddr" } }, "required" : [ @@ -1274,7 +1273,7 @@ }, "DevicePXEs" : { "items" : { - "$ref" : "#/definitions/DevicePXE" + "$ref" : "#/$defs/DevicePXE" }, "type" : "array", "uniqueItems" : true @@ -1283,10 +1282,10 @@ "additionalProperties" : false, "properties" : { "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" } }, "required" : [ @@ -1303,10 +1302,10 @@ "type" : "string" }, "device_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "report" : { "description" : "the contents of the device report. Given its age we cannot provide a schema.", @@ -1330,7 +1329,7 @@ }, "DeviceSerials" : { "items" : { - "$ref" : "common.json#/definitions/device_serial_number" + "$ref" : "common.json#/$defs/device_serial_number" }, "type" : "array", "uniqueItems" : true @@ -1338,7 +1337,7 @@ "DeviceSetting" : { "allOf" : [ { - "$ref" : "#/definitions/DeviceSettings" + "$ref" : "#/$defs/DeviceSettings" }, { "maxProperties" : 1, @@ -1351,7 +1350,7 @@ "type" : "string" }, "propertyNames" : { - "$ref" : "common.json#/definitions/device_setting_key" + "$ref" : "common.json#/$defs/device_setting_key" }, "type" : "object" }, @@ -1359,13 +1358,13 @@ "additionalProperties" : false, "properties" : { "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "required" : [ @@ -1377,7 +1376,7 @@ }, "Devices" : { "items" : { - "$ref" : "#/definitions/Device" + "$ref" : "#/$defs/Device" }, "type" : "array", "uniqueItems" : true @@ -1399,7 +1398,7 @@ "additionalProperties" : false, "properties" : { "alias" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "bios_firmware" : { "type" : "string" @@ -1428,7 +1427,7 @@ ] }, "hardware_vendor_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "hba_firmware" : { "oneOf" : [ @@ -1441,7 +1440,7 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "legacy_product_name" : { "oneOf" : [ @@ -1454,7 +1453,7 @@ ] }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "nics_num" : { "type" : "integer" @@ -1499,7 +1498,7 @@ "type" : "string" }, "rack_unit_size" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, "raid_lun_num" : { "type" : "integer" @@ -1600,12 +1599,12 @@ ] }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "specification" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/HardwareProductSpecification" + "$ref" : "common.json#/$defs/HardwareProductSpecification" }, { "type" : "null" @@ -1623,7 +1622,7 @@ "$comment" : "this property will become nullable in v3.3 and removed in v4.0", "allOf" : [ { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ], "deprecated" : true @@ -1677,7 +1676,7 @@ "additionalProperties" : false, "properties" : { "alias" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "created" : { "format" : "date-time", @@ -1694,13 +1693,13 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "updated" : { "format" : "date-time", @@ -1729,10 +1728,10 @@ "type" : "string" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "updated" : { "format" : "date-time", @@ -1749,7 +1748,7 @@ }, "HardwareVendors" : { "items" : { - "$ref" : "#/definitions/HardwareVendor" + "$ref" : "#/$defs/HardwareVendor" }, "type" : "array", "uniqueItems" : true @@ -1796,17 +1795,17 @@ "type" : "string" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "updated" : { "format" : "date-time", "type" : "string" }, "version" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "required" : [ @@ -1833,10 +1832,10 @@ "type" : "string" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "required" : [ @@ -1851,7 +1850,7 @@ "$comment" : "this definition will be removed in v4.0", "deprecated" : true, "items" : { - "$ref" : "#/definitions/LegacyValidationPlan" + "$ref" : "#/$defs/LegacyValidationPlan" }, "type" : "array", "uniqueItems" : true @@ -1891,7 +1890,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ] }, @@ -1899,16 +1898,16 @@ "type" : "string" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "status" : { - "$ref" : "common.json#/definitions/validation_status" + "$ref" : "common.json#/$defs/validation_status" }, "validation_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "version" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" } }, "required" : [ @@ -1927,7 +1926,7 @@ }, "LegacyValidationResults" : { "items" : { - "$ref" : "#/definitions/LegacyValidationResult" + "$ref" : "#/$defs/LegacyValidationResult" }, "type" : "array", "uniqueItems" : true @@ -1936,7 +1935,7 @@ "$comment" : "this definition will be removed in v4.0", "deprecated" : true, "items" : { - "$ref" : "#/definitions/LegacyValidation" + "$ref" : "#/$defs/LegacyValidation" }, "type" : "array", "uniqueItems" : true @@ -1958,10 +1957,10 @@ "additionalProperties" : false, "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { "type" : "string" @@ -2031,13 +2030,13 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" } }, "required" : [ @@ -2066,10 +2065,10 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "users" : { "contains" : { @@ -2084,16 +2083,16 @@ "additionalProperties" : false, "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { "type" : "string" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" } }, "required" : [ @@ -2125,7 +2124,7 @@ "properties" : { "admins" : { "items" : { - "$ref" : "#/definitions/UserTerse" + "$ref" : "#/$defs/UserTerse" }, "minItems" : 1, "type" : "array", @@ -2146,13 +2145,13 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" } }, "required" : [ @@ -2181,10 +2180,10 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "required" : [ @@ -2215,7 +2214,7 @@ "QueryParamsValidationError" : { "allOf" : [ { - "$ref" : "#/definitions/ValidationError" + "$ref" : "#/$defs/ValidationError" }, { "properties" : { @@ -2259,7 +2258,7 @@ "asset_tag" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_asset_tag" + "$ref" : "common.json#/$defs/device_asset_tag" }, { "type" : "null" @@ -2272,7 +2271,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } ] }, @@ -2282,7 +2281,7 @@ "type" : "null" }, { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } ] }, @@ -2291,31 +2290,31 @@ "type" : "string" }, "datacenter_room_alias" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "datacenter_room_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "full_rack_name" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "links" : { - "$ref" : "common.json#/definitions/links" + "$ref" : "common.json#/$defs/links" }, "name" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" }, "phase" : { - "$ref" : "common.json#/definitions/device_phase" + "$ref" : "common.json#/$defs/device_phase" }, "rack_role_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_role_name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "serial_number" : { "oneOf" : [ @@ -2357,7 +2356,7 @@ "device_asset_tag" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_asset_tag" + "$ref" : "common.json#/$defs/device_asset_tag" }, { "type" : "null" @@ -2367,7 +2366,7 @@ "device_id" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, { "type" : "null" @@ -2377,7 +2376,7 @@ "device_serial_number" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/device_serial_number" + "$ref" : "common.json#/$defs/device_serial_number" }, { "type" : "null" @@ -2388,13 +2387,13 @@ "type" : "string" }, "rack_unit_size" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" } }, "required" : [ @@ -2410,14 +2409,14 @@ }, "RackAssignments" : { "items" : { - "$ref" : "#/definitions/RackAssignment" + "$ref" : "#/$defs/RackAssignment" }, "type" : "array", "uniqueItems" : true }, "RackIds" : { "items" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "type" : "array", "uniqueItems" : true @@ -2430,25 +2429,25 @@ "type" : "string" }, "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "rack_name" : { - "$ref" : "common.json#/definitions/mojo_relaxed_placeholder" + "$ref" : "common.json#/$defs/mojo_relaxed_placeholder" }, "rack_unit_size" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, "rack_unit_start" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "updated" : { "format" : "date-time", @@ -2470,7 +2469,7 @@ }, "RackLayouts" : { "items" : { - "$ref" : "#/definitions/RackLayout" + "$ref" : "#/$defs/RackLayout" }, "type" : "array", "uniqueItems" : true @@ -2483,13 +2482,13 @@ "type" : "string" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "rack_size" : { - "$ref" : "common.json#/definitions/positive_integer" + "$ref" : "common.json#/$defs/positive_integer" }, "updated" : { "format" : "date-time", @@ -2507,14 +2506,14 @@ }, "RackRoles" : { "items" : { - "$ref" : "#/definitions/RackRole" + "$ref" : "#/$defs/RackRole" }, "type" : "array", "uniqueItems" : true }, "Racks" : { "items" : { - "$ref" : "#/definitions/Rack" + "$ref" : "#/$defs/Rack" }, "type" : "array", "uniqueItems" : true @@ -2527,12 +2526,12 @@ "type" : "string" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "ipaddr" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/ipaddr" + "$ref" : "common.json#/$defs/ipaddr" }, { "type" : "null" @@ -2554,12 +2553,12 @@ ] }, "serial_number" : { - "$ref" : "common.json#/definitions/relay_serial_number" + "$ref" : "common.json#/$defs/relay_serial_number" }, "ssh_port" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/non_negative_integer" + "$ref" : "common.json#/$defs/non_negative_integer" }, { "type" : "null" @@ -2571,7 +2570,7 @@ "type" : "string" }, "user_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "version" : { "oneOf" : [ @@ -2600,7 +2599,7 @@ }, "Relays" : { "items" : { - "$ref" : "#/definitions/Relay" + "$ref" : "#/$defs/Relay" }, "type" : "array", "uniqueItems" : true @@ -2609,19 +2608,19 @@ "additionalProperties" : false, "properties" : { "device_serial_number" : { - "$ref" : "common.json#/definitions/device_serial_number" + "$ref" : "common.json#/$defs/device_serial_number" }, "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "results" : { - "$ref" : "#/definitions/LegacyValidationResults" + "$ref" : "#/$defs/LegacyValidationResults" }, "sku" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "status" : { - "$ref" : "common.json#/definitions/validation_status" + "$ref" : "common.json#/$defs/validation_status" } }, "required" : [ @@ -2636,7 +2635,7 @@ "RequestValidationError" : { "allOf" : [ { - "$ref" : "#/definitions/ValidationError" + "$ref" : "#/$defs/ValidationError" }, { "properties" : { @@ -2673,16 +2672,16 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" }, "role_via_organization_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" } }, "required" : [ @@ -2701,13 +2700,13 @@ "type" : "string" }, "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "force_password_change" : { "type" : "boolean" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "is_admin" : { "type" : "boolean" @@ -2752,13 +2751,13 @@ ] }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { - "$ref" : "common.json#/definitions/mojo_standard_placeholder" + "$ref" : "common.json#/$defs/mojo_standard_placeholder" }, "role" : { - "$ref" : "common.json#/definitions/role" + "$ref" : "common.json#/$defs/role" } }, "required" : [ @@ -2816,10 +2815,10 @@ ] }, "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { "type" : "string" @@ -2844,7 +2843,7 @@ "UserSetting" : { "allOf" : [ { - "$ref" : "#/definitions/UserSettings" + "$ref" : "#/$defs/UserSettings" }, { "maxProperties" : 1, @@ -2857,7 +2856,7 @@ "type" : "string" }, "propertyNames" : { - "$ref" : "common.json#/definitions/user_setting_key" + "$ref" : "common.json#/$defs/user_setting_key" }, "type" : "object" }, @@ -2865,10 +2864,10 @@ "additionalProperties" : false, "properties" : { "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "name" : { "type" : "string" @@ -2895,7 +2894,7 @@ "last_ipaddr" : { "oneOf" : [ { - "$ref" : "common.json#/definitions/ipaddr" + "$ref" : "common.json#/$defs/ipaddr" }, { "type" : "null" @@ -2928,7 +2927,7 @@ }, "UserTokens" : { "items" : { - "$ref" : "#/definitions/UserToken" + "$ref" : "#/$defs/UserToken" }, "type" : "array", "uniqueItems" : true @@ -2942,13 +2941,13 @@ "type" : "string" }, "email" : { - "$ref" : "common.json#/definitions/email_address" + "$ref" : "common.json#/$defs/email_address" }, "force_password_change" : { "type" : "boolean" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "is_admin" : { "type" : "boolean" @@ -2999,7 +2998,7 @@ }, "details" : { "items" : { - "$ref" : "#/definitions/JSONValidatorError" + "$ref" : "#/$defs/JSONValidatorError" }, "minItems" : 1, "type" : "array", @@ -3030,26 +3029,26 @@ "type" : "string" }, "device_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "device_report_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "hardware_product_id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "id" : { - "$ref" : "common.json#/definitions/uuid" + "$ref" : "common.json#/$defs/uuid" }, "results" : { "items" : { - "$ref" : "#/definitions/LegacyValidationResult" + "$ref" : "#/$defs/LegacyValidationResult" }, "type" : "array", "uniqueItems" : true }, "status" : { - "$ref" : "common.json#/definitions/validation_status" + "$ref" : "common.json#/$defs/validation_status" } }, "required" : [ @@ -3075,5 +3074,6 @@ ], "type" : "object" } - } + }, + "$schema" : "http://json-schema.org/draft-07/schema#" } diff --git a/docs/modules/Conch::Controller::HardwareProduct.md b/docs/modules/Conch::Controller::HardwareProduct.md index 9d047e8f2..1a9a56f13 100644 --- a/docs/modules/Conch::Controller::HardwareProduct.md +++ b/docs/modules/Conch::Controller::HardwareProduct.md @@ -43,7 +43,7 @@ Uses the URI query parameter `path` as a json pointer to determine the path with without regard to type (so long as it conforms to the schema). After the update operation, the `specification` property must validate against -[common.json#/definitions/HardwareProductSpecification](../json-schema/common.json#/definitions/HardwareProductSpecification). +[common.json#/$defs/HardwareProductSpecification](../json-schema/common.json#/$defs/HardwareProductSpecification). ### delete\_specification @@ -51,7 +51,7 @@ Uses the URI query parameter `path` as a json pointer to determine the path with `specification` property to operate on. All of the data at the indicated path is deleted. After the delete operation, the `specification` property must validate against -[common.json#/definitions/HardwareProductSpecification](../json-schema/common.json#/definitions/HardwareProductSpecification). +[common.json#/$defs/HardwareProductSpecification](../json-schema/common.json#/$defs/HardwareProductSpecification). ## LICENSING diff --git a/docs/modules/Conch::Controller::JSONSchema.md b/docs/modules/Conch::Controller::JSONSchema.md index f462b3ef4..742423c05 100644 --- a/docs/modules/Conch::Controller::JSONSchema.md +++ b/docs/modules/Conch::Controller::JSONSchema.md @@ -15,15 +15,15 @@ respectively). Bundles all the referenced definitions together in the returned b ### \_extract\_schema\_definition Given a [JSON::Validator](https://metacpan.org/pod/JSON%3A%3AValidator) object containing a schema definition, extract the requested portion -out of the "definitions" section, including any named references, and add some standard +out of the `$defs` section, including any named references, and add some standard headers. TODO: this (plus addition of the header fields) could mostly be replaced with just: ```perl my $new_defs = $jv->bundle({ - schema => $jv->get('/definitions/'.$name), - ref_key => 'definitions', + schema => $jv->get('/$defs/'.$name), + ref_key => '$defs', }); ``` diff --git a/docs/modules/Conch::DB::ResultSet::Device.md b/docs/modules/Conch::DB::ResultSet::Device.md index f12be76c1..91af924cc 100644 --- a/docs/modules/Conch::DB::ResultSet::Device.md +++ b/docs/modules/Conch::DB::ResultSet::Device.md @@ -82,7 +82,7 @@ Modifies the resultset to add the `build_name` column. ### location\_data -Returns a resultset that provides location data ([response.json#/definitions/DeviceLocation](../json-schema/response.json#/definitions/DeviceLocation)), +Returns a resultset that provides location data ([response.json#/$defs/DeviceLocation](../json-schema/response.json#/$defs/DeviceLocation)), optionally returned under a hash using the provided key name. ## LICENSING diff --git a/docs/modules/Conch::Plugin::JSONValidator.md b/docs/modules/Conch::Plugin::JSONValidator.md index c2c9d3291..4542817ca 100644 --- a/docs/modules/Conch::Plugin::JSONValidator.md +++ b/docs/modules/Conch::Plugin::JSONValidator.md @@ -45,7 +45,7 @@ appearing once are scalars, parameters appearing more than once have their value arrayref). On success, returns the validated data; on failure, an HTTP 400 response is prepared, using the -[response.json#/definitions/QueryParamsValidationError](../json-schema/response.json#/definitions/QueryParamsValidationError) json response schema. +[response.json#/$defs/QueryParamsValidationError](../json-schema/response.json#/$defs/QueryParamsValidationError) json response schema. Population of missing data from specified defaults is performed. @@ -55,7 +55,7 @@ Given the name of a json schema in the request namespace, validate the provided it (defaulting to the request's json payload). On success, returns the validated payload data; on failure, an HTTP 400 response is prepared, -using the [response.json#/definitions/RequestValidationError](../json-schema/response.json#/definitions/RequestValidationError) json response schema. +using the [response.json#/$defs/RequestValidationError](../json-schema/response.json#/$defs/RequestValidationError) json response schema. ### get\_query\_params\_validator diff --git a/docs/modules/Conch::Route.md b/docs/modules/Conch::Route.md index b0a1ec98a..486d10925 100644 --- a/docs/modules/Conch::Route.md +++ b/docs/modules/Conch::Route.md @@ -41,37 +41,37 @@ Successful (HTTP 2xx code) response structures are as described for each endpoin Error responses will use: -- 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: HTTP 4xx, [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: HTTP 4xx, [response.json#/$defs/Error](../json-schema/response.json#/$defs/Error) ### `GET /ping` - Does not require authentication. -- Response: [response.json#/definitions/Ping](../json-schema/response.json#/definitions/Ping) +- Response: [response.json#/$defs/Ping](../json-schema/response.json#/$defs/Ping) ### `GET /version` - Does not require authentication. -- Response: [response.json#/definitions/Version](../json-schema/response.json#/definitions/Version) +- Response: [response.json#/$defs/Version](../json-schema/response.json#/$defs/Version) ### `POST /login` - Controller/Action: ["login" in Conch::Controller::Login](../modules/Conch%3A%3AController%3A%3ALogin#login) -- Request: [request.json#/definitions/Login](../json-schema/request.json#/definitions/Login) -- Response: [response.json#/definitions/LoginToken](../json-schema/response.json#/definitions/LoginToken) +- Request: [request.json#/$defs/Login](../json-schema/request.json#/$defs/Login) +- Response: [response.json#/$defs/LoginToken](../json-schema/response.json#/$defs/LoginToken) ### `POST /logout` - Controller/Action: ["logout" in Conch::Controller::Login](../modules/Conch%3A%3AController%3A%3ALogin#logout) -- Request: [request.json#/definitions/Null](../json-schema/request.json#/definitions/Null) +- Request: [request.json#/$defs/Null](../json-schema/request.json#/$defs/Null) - Response: `204 No Content` ### `POST /refresh_token` - Controller/Action: ["refresh\_token" in Conch::Controller::Login](../modules/Conch%3A%3AController%3A%3ALogin#refresh_token) -- Request: [request.json#/definitions/Null](../json-schema/request.json#/definitions/Null) -- Response: [response.json#/definitions/LoginToken](../json-schema/response.json#/definitions/LoginToken) +- Request: [request.json#/$defs/Null](../json-schema/request.json#/$defs/Null) +- Response: [response.json#/$defs/LoginToken](../json-schema/response.json#/$defs/LoginToken) ### `GET /me` diff --git a/docs/modules/Conch::Route::Build.md b/docs/modules/Conch::Route::Build.md index be7620322..93823a649 100644 --- a/docs/modules/Conch::Route::Build.md +++ b/docs/modules/Conch::Route::Build.md @@ -22,13 +22,13 @@ Supports the following optional query parameters: - `completed=<0|1>` only return incomplete, or complete, builds respectively - Controller/Action: ["get\_all" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#get_all) -- Response: [response.json#/definitions/Builds](../json-schema/response.json#/definitions/Builds) +- Response: [response.json#/$defs/Builds](../json-schema/response.json#/$defs/Builds) ### `POST /build` - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#create) -- Request: [request.json#/definitions/BuildCreate](../json-schema/request.json#/definitions/BuildCreate) +- Request: [request.json#/$defs/BuildCreate](../json-schema/request.json#/$defs/BuildCreate) - Response: Redirect to the build ### `GET /build/:build_id_or_name` @@ -41,33 +41,33 @@ Supports the following optional query parameters: - Controller/Action: ["get" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#get) - Requires system admin authorization or the read-only role on the build -- Response: [response.json#/definitions/Build](../json-schema/response.json#/definitions/Build) +- Response: [response.json#/$defs/Build](../json-schema/response.json#/$defs/Build) ### `POST /build/:build_id_or_name` - Requires system admin authorization or the admin role on the build - Controller/Action: ["update" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#update) -- Request: [request.json#/definitions/BuildUpdate](../json-schema/request.json#/definitions/BuildUpdate) +- Request: [request.json#/$defs/BuildUpdate](../json-schema/request.json#/$defs/BuildUpdate) - Response: Redirect to the build #### `POST /build/:build_id_or_name/links` - Requires system admin authorization or the admin role on the build - Controller/Action: ["add\_links" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#add_links) -- Request: [request.json#/definitions/BuildLinks](../json-schema/request.json#/definitions/BuildLinks) +- Request: [request.json#/$defs/BuildLinks](../json-schema/request.json#/$defs/BuildLinks) - Response: Redirect to the updated build #### `DELETE /build/:build_id_or_name/links` - Requires system admin authorization or the admin role on the build -- Request: [request.json#/definitions/BuildLinksOrNull](../json-schema/request.json#/definitions/BuildLinksOrNull) +- Request: [request.json#/$defs/BuildLinksOrNull](../json-schema/request.json#/$defs/BuildLinksOrNull) - Response: 204 NO CONTENT ### `GET /build/:build_id_or_name/user` - Requires system admin authorization or the admin role on the build - Controller/Action: ["get\_users" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#get_users) -- Response: [response.json#/definitions/BuildUsers](../json-schema/response.json#/definitions/BuildUsers) +- Response: [response.json#/$defs/BuildUsers](../json-schema/response.json#/$defs/BuildUsers) ### `POST /build/:build_id_or_name/user?send_mail=<1|0`> @@ -76,7 +76,7 @@ an email to the user. - Requires system admin authorization or the admin role on the build - Controller/Action: ["add\_user" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#add_user) -- Request: [request.json#/definitions/BuildAddUser](../json-schema/request.json#/definitions/BuildAddUser) +- Request: [request.json#/$defs/BuildAddUser](../json-schema/request.json#/$defs/BuildAddUser) - Response: `204 No Content` ### `DELETE /build/:build_id_or_name/user/#target_user_id_or_email?send_mail=<1|0`> @@ -92,7 +92,7 @@ an email to the user. - User requires the admin role - Controller/Action: ["get\_organizations" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#get_organizations) -- Response: [response.json#/definitions/BuildOrganizations](../json-schema/response.json#/definitions/BuildOrganizations) +- Response: [response.json#/$defs/BuildOrganizations](../json-schema/response.json#/$defs/BuildOrganizations) ### `POST /build/:build_id_or_name/organization?send_mail=<1|0>` @@ -101,7 +101,7 @@ an email to the organization members and build admins. - User requires the admin role - Controller/Action: ["add\_organization" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#add_organization) -- Request: [request.json#/definitions/BuildAddOrganization](../json-schema/request.json#/definitions/BuildAddOrganization) +- Request: [request.json#/$defs/BuildAddOrganization](../json-schema/request.json#/$defs/BuildAddOrganization) - Response: `204 No Content` ### `DELETE /build/:build_id_or_name/organization/:organization_id_or_name?send_mail=<1|0>` @@ -126,13 +126,13 @@ Accepts the following optional query parameters: - Requires system admin authorization or the read-only role on the build - Controller/Action: ["get\_devices" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#get_devices) -- Response: one of [response.json#/definitions/Devices](../json-schema/response.json#/definitions/Devices), [response.json#/definitions/DeviceIds](../json-schema/response.json#/definitions/DeviceIds) or [response.json#/definitions/DeviceSerials](../json-schema/response.json#/definitions/DeviceSerials) +- Response: one of [response.json#/$defs/Devices](../json-schema/response.json#/$defs/Devices), [response.json#/$defs/DeviceIds](../json-schema/response.json#/$defs/DeviceIds) or [response.json#/$defs/DeviceSerials](../json-schema/response.json#/$defs/DeviceSerials) ### `GET /build/:build_id_or_name/device/pxe` - Requires system admin authorization or the read-only role on the build - Controller/Action: ["get\_pxe\_devices" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#get_pxe_devices) -- Response: [response.json#/definitions/DevicePXEs](../json-schema/response.json#/definitions/DevicePXEs) +- Response: [response.json#/$defs/DevicePXEs](../json-schema/response.json#/$defs/DevicePXEs) ### `POST /build/:build_id_or_name/device` @@ -140,7 +140,7 @@ Accepts the following optional query parameters: read-only role on the device (via a build or a relay registration, see ["routes" in Conch::Route::Device](../modules/Conch%3A%3ARoute%3A%3ADevice#routes)) - Controller/Action: ["create\_and\_add\_devices" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#create_and_add_devices) -- Request: [request.json#/definitions/BuildCreateDevices](../json-schema/request.json#/definitions/BuildCreateDevices) +- Request: [request.json#/$defs/BuildCreateDevices](../json-schema/request.json#/$defs/BuildCreateDevices) - Response: `204 No Content` ### `POST /build/:build_id_or_name/device/:device_id_or_serial_number` @@ -167,7 +167,7 @@ Accepts the following optional query parameters: - Requires system admin authorization, or the read/write role on the build and the read-only role on a build that contains the rack - Controller/Action: ["get\_racks" in Conch::Controller::Build](../modules/Conch%3A%3AController%3A%3ABuild#get_racks) -- Response: one of [response.json#/definitions/Racks](../json-schema/response.json#/definitions/Racks) or [response.json#/definitions/RackIds](../json-schema/response.json#/definitions/RackIds) +- Response: one of [response.json#/$defs/Racks](../json-schema/response.json#/$defs/Racks) or [response.json#/$defs/RackIds](../json-schema/response.json#/$defs/RackIds) ### `POST /build/:build_id_or_name/rack/:rack_id_or_name` diff --git a/docs/modules/Conch::Route::Datacenter.md b/docs/modules/Conch::Route::Datacenter.md index 8f3fe6182..fbae87c75 100644 --- a/docs/modules/Conch::Route::Datacenter.md +++ b/docs/modules/Conch::Route::Datacenter.md @@ -18,26 +18,26 @@ All routes require authentication. - Requires system admin authorization - Controller/Action: ["get\_all" in Conch::Controller::Datacenter](../modules/Conch%3A%3AController%3A%3ADatacenter#get_all) -- Response: [response.json#/definitions/Datacenters](../json-schema/response.json#/definitions/Datacenters) +- Response: [response.json#/$defs/Datacenters](../json-schema/response.json#/$defs/Datacenters) ### `POST /dc` - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::Datacenter](../modules/Conch%3A%3AController%3A%3ADatacenter#create) -- Request: [request.json#/definitions/DatacenterCreate](../json-schema/request.json#/definitions/DatacenterCreate) +- Request: [request.json#/$defs/DatacenterCreate](../json-schema/request.json#/$defs/DatacenterCreate) - Response: `201 Created` or `204 No Content`, plus Location header ### `GET /dc/:datacenter_id` - Requires system admin authorization - Controller/Action: ["get\_one" in Conch::Controller::Datacenter](../modules/Conch%3A%3AController%3A%3ADatacenter#get_one) -- Response: [response.json#/definitions/Datacenter](../json-schema/response.json#/definitions/Datacenter) +- Response: [response.json#/$defs/Datacenter](../json-schema/response.json#/$defs/Datacenter) ### `POST /dc/:datacenter_id` - Requires system admin authorization - Controller/Action: ["update" in Conch::Controller::Datacenter](../modules/Conch%3A%3AController%3A%3ADatacenter#update) -- Request: [request.json#/definitions/DatacenterUpdate](../json-schema/request.json#/definitions/DatacenterUpdate) +- Request: [request.json#/$defs/DatacenterUpdate](../json-schema/request.json#/$defs/DatacenterUpdate) - Response: Redirect to the updated datacenter ### `DELETE /dc/:datacenter_id` @@ -50,7 +50,7 @@ All routes require authentication. - Requires system admin authorization - Controller/Action: ["get\_rooms" in Conch::Controller::Datacenter](../modules/Conch%3A%3AController%3A%3ADatacenter#get_rooms) -- Response: [response.json#/definitions/DatacenterRoomsDetailed](../json-schema/response.json#/definitions/DatacenterRoomsDetailed) +- Response: [response.json#/$defs/DatacenterRoomsDetailed](../json-schema/response.json#/$defs/DatacenterRoomsDetailed) ## LICENSING diff --git a/docs/modules/Conch::Route::DatacenterRoom.md b/docs/modules/Conch::Route::DatacenterRoom.md index 22b57bb68..43f672441 100644 --- a/docs/modules/Conch::Route::DatacenterRoom.md +++ b/docs/modules/Conch::Route::DatacenterRoom.md @@ -18,13 +18,13 @@ All routes require authentication. - Requires system admin authorization - Controller/Action: ["get\_all" in Conch::Controller::DatacenterRoom](../modules/Conch%3A%3AController%3A%3ADatacenterRoom#get_all) -- Response: [response.json#/definitions/DatacenterRoomsDetailed](../json-schema/response.json#/definitions/DatacenterRoomsDetailed) +- Response: [response.json#/$defs/DatacenterRoomsDetailed](../json-schema/response.json#/$defs/DatacenterRoomsDetailed) ### `POST /room` - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::DatacenterRoom](../modules/Conch%3A%3AController%3A%3ADatacenterRoom#create) -- Request: [request.json#/definitions/DatacenterRoomCreate](../json-schema/request.json#/definitions/DatacenterRoomCreate) +- Request: [request.json#/$defs/DatacenterRoomCreate](../json-schema/request.json#/$defs/DatacenterRoomCreate) - Response: Redirect to the created room ### `GET /room/:datacenter_room_id_or_alias` @@ -32,13 +32,13 @@ All routes require authentication. - User requires system admin authorization, or the read-only role on a rack located in the room - Controller/Action: ["get\_one" in Conch::Controller::DatacenterRoom](../modules/Conch%3A%3AController%3A%3ADatacenterRoom#get_one) -- Response: [response.json#/definitions/DatacenterRoomDetailed](../json-schema/response.json#/definitions/DatacenterRoomDetailed) +- Response: [response.json#/$defs/DatacenterRoomDetailed](../json-schema/response.json#/$defs/DatacenterRoomDetailed) ### `POST /room/:datacenter_room_id_or_alias` - Requires system admin authorization - Controller/Action: ["update" in Conch::Controller::DatacenterRoom](../modules/Conch%3A%3AController%3A%3ADatacenterRoom#update) -- Request: [request.json#/definitions/DatacenterRoomUpdate](../json-schema/request.json#/definitions/DatacenterRoomUpdate) +- Request: [request.json#/$defs/DatacenterRoomUpdate](../json-schema/request.json#/$defs/DatacenterRoomUpdate) - Response: Redirect to the updated room ### `DELETE /room/:datacenter_room_id_or_alias` @@ -52,7 +52,7 @@ the room - User requires system admin authorization, or the read-only role on a rack located in the room (in which case data returned is restricted to those racks) - Controller/Action: ["racks" in Conch::Controller::DatacenterRoom](../modules/Conch%3A%3AController%3A%3ADatacenterRoom#racks) -- Response: [response.json#/definitions/Racks](../json-schema/response.json#/definitions/Racks) +- Response: [response.json#/$defs/Racks](../json-schema/response.json#/$defs/Racks) ### `GET /room/:datacenter_room_id_or_alias/rack/:rack_id_or_name` diff --git a/docs/modules/Conch::Route::Device.md b/docs/modules/Conch::Route::Device.md index ec4b8e61a..a83fcd46c 100644 --- a/docs/modules/Conch::Route::Device.md +++ b/docs/modules/Conch::Route::Device.md @@ -36,72 +36,72 @@ value. For information on how to create a setting key or set its value see below. - Controller/Action: ["lookup\_by\_other\_attribute" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#lookup_by_other_attribute) -- Response: [response.json#/definitions/Devices](../json-schema/response.json#/definitions/Devices) +- Response: [response.json#/$defs/Devices](../json-schema/response.json#/$defs/Devices) ### `GET /device/:device_id_or_serial_number` - User requires the read-only role - Controller/Action: ["get" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#get) -- Response: [response.json#/definitions/DetailedDevice](../json-schema/response.json#/definitions/DetailedDevice) +- Response: [response.json#/$defs/DetailedDevice](../json-schema/response.json#/$defs/DetailedDevice) ### `GET /device/:device_id_or_serial_number/pxe` - User requires the read-only role - Controller/Action: ["get\_pxe" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#get_pxe) -- Response: [response.json#/definitions/DevicePXE](../json-schema/response.json#/definitions/DevicePXE) +- Response: [response.json#/$defs/DevicePXE](../json-schema/response.json#/$defs/DevicePXE) ### `GET /device/:device_id_or_serial_number/phase` - User requires the read-only role - Controller/Action: ["get\_phase" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#get_phase) -- Response: [response.json#/definitions/DevicePhase](../json-schema/response.json#/definitions/DevicePhase) +- Response: [response.json#/$defs/DevicePhase](../json-schema/response.json#/$defs/DevicePhase) ### `GET /device/:device_id_or_serial_number/sku` - User requires the read-only role - Controller/Action: ["get\_sku" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#get_sku) -- Response: [response.json#/definitions/DeviceSku](../json-schema/response.json#/definitions/DeviceSku) +- Response: [response.json#/$defs/DeviceSku](../json-schema/response.json#/$defs/DeviceSku) ### `POST /device/:device_id_or_serial_number/asset_tag` - User requires the read/write role - Controller/Action: ["set\_asset\_tag" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#set_asset_tag) -- Request: [request.json#/definitions/DeviceAssetTag](../json-schema/request.json#/definitions/DeviceAssetTag) +- Request: [request.json#/$defs/DeviceAssetTag](../json-schema/request.json#/$defs/DeviceAssetTag) - Response: Redirect to the updated device ### `POST /device/:device_id_or_serial_number/validated` - User requires the read/write role - Controller/Action: ["set\_validated" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#set_validated) -- Request: [request.json#/definitions/Null](../json-schema/request.json#/definitions/Null) +- Request: [request.json#/$defs/Null](../json-schema/request.json#/$defs/Null) - Response: Redirect to the updated device ### `POST /device/:device_id_or_serial_number/phase` - User requires the read/write role - Controller/Action: ["set\_phase" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#set_phase) -- Request: [request.json#/definitions/DevicePhase](../json-schema/request.json#/definitions/DevicePhase) +- Request: [request.json#/$defs/DevicePhase](../json-schema/request.json#/$defs/DevicePhase) - Response: Redirect to the updated device ### `POST /device/:device_id_or_serial_number/links` - User requires the read/write role - Controller/Action: ["add\_links" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#add_links) -- Request: [request.json#/definitions/DeviceLinks](../json-schema/request.json#/definitions/DeviceLinks) +- Request: [request.json#/$defs/DeviceLinks](../json-schema/request.json#/$defs/DeviceLinks) - Response: Redirect to the updated device ### `DELETE /device/:device_id_or_serial_number/links` - User requires the read/write role - Controller/Action: ["remove\_links" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#remove_links) -- Request: [request.json#/definitions/DeviceLinksOrNull](../json-schema/request.json#/definitions/DeviceLinksOrNull) +- Request: [request.json#/$defs/DeviceLinksOrNull](../json-schema/request.json#/$defs/DeviceLinksOrNull) - Response: 204 No Content ### `POST /device/:device_id_or_serial_number/build` - User requires the read/write role for the device, as well as the old and new builds - Controller/Action: ["set\_build" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#set_build) -- Request: [request.json#/definitions/DeviceBuild](../json-schema/request.json#/definitions/DeviceBuild) +- Request: [request.json#/$defs/DeviceBuild](../json-schema/request.json#/$defs/DeviceBuild) - Response: Redirect to the updated device ### `POST /device/:device_id_or_serial_number/hardware_product` @@ -110,20 +110,20 @@ below. - User requires the admin role for the device - Controller/Action: ["set\_hardware\_product" in Conch::Controller::Device](../modules/Conch%3A%3AController%3A%3ADevice#set_hardware_product) -- Request: [request.json#/definitions/DeviceHardware](../json-schema/request.json#/definitions/DeviceHardware) +- Request: [request.json#/$defs/DeviceHardware](../json-schema/request.json#/$defs/DeviceHardware) - Response: Redirect to the updated device ### `GET /device/:device_id_or_serial_number/location` - User requires the read-only role - Controller/Action: ["get" in Conch::Controller::DeviceLocation](../modules/Conch%3A%3AController%3A%3ADeviceLocation#get) -- Response: [response.json#/definitions/DeviceLocation](../json-schema/response.json#/definitions/DeviceLocation) +- Response: [response.json#/$defs/DeviceLocation](../json-schema/response.json#/$defs/DeviceLocation) ### `POST /device/:device_id_or_serial_number/location` - User requires the read/write role - Controller/Action: ["set" in Conch::Controller::DeviceLocation](../modules/Conch%3A%3AController%3A%3ADeviceLocation#set) -- Request: [request.json#/definitions/DeviceLocationUpdate](../json-schema/request.json#/definitions/DeviceLocationUpdate) +- Request: [request.json#/$defs/DeviceLocationUpdate](../json-schema/request.json#/$defs/DeviceLocationUpdate) - Response: Redirect to the updated device ### `DELETE /device/:device_id_or_serial_number/location` @@ -136,28 +136,28 @@ below. - User requires the read-only role - Controller/Action: ["get\_all" in Conch::Controller::DeviceSettings](../modules/Conch%3A%3AController%3A%3ADeviceSettings#get_all) -- Response: [response.json#/definitions/DeviceSettings](../json-schema/response.json#/definitions/DeviceSettings) +- Response: [response.json#/$defs/DeviceSettings](../json-schema/response.json#/$defs/DeviceSettings) ### `POST /device/:device_id_or_serial_number/settings` - User requires the read/write role, or admin when overwriting existing settings that do not start with `tag.`. - Controller/Action: ["set\_all" in Conch::Controller::DeviceSettings](../modules/Conch%3A%3AController%3A%3ADeviceSettings#set_all) -- Request: [request.json#/definitions/DeviceSettings](../json-schema/request.json#/definitions/DeviceSettings) +- Request: [request.json#/$defs/DeviceSettings](../json-schema/request.json#/$defs/DeviceSettings) - Response: `204 No Content` ### `GET /device/:device_id_or_serial_number/settings/:key` - User requires the read-only role - Controller/Action: ["get\_single" in Conch::Controller::DeviceSettings](../modules/Conch%3A%3AController%3A%3ADeviceSettings#get_single) -- Response: [response.json#/definitions/DeviceSetting](../json-schema/response.json#/definitions/DeviceSetting) +- Response: [response.json#/$defs/DeviceSetting](../json-schema/response.json#/$defs/DeviceSetting) ### `POST /device/:device_id_or_serial_number/settings/:key` - User requires the read/write role, or admin when overwriting existing settings that do not start with `tag.`. - Controller/Action: ["set\_single" in Conch::Controller::DeviceSettings](../modules/Conch%3A%3AController%3A%3ADeviceSettings#set_single) -- Request: [request.json#/definitions/DeviceSettings](../json-schema/request.json#/definitions/DeviceSettings) +- Request: [request.json#/$defs/DeviceSettings](../json-schema/request.json#/$defs/DeviceSettings) - Response: `204 No Content` ### `DELETE /device/:device_id_or_serial_number/settings/:key` @@ -175,8 +175,8 @@ This endpoint is **deprecated** and will be removed in Conch API v4.0. - User requires the read-only role - Controller/Action: ["validate" in Conch::Controller::DeviceValidation](../modules/Conch%3A%3AController%3A%3ADeviceValidation#validate) -- Request: [request.json#/definitions/DeviceReport](../json-schema/request.json#/definitions/DeviceReport) -- Response: [response.json#/definitions/LegacyValidationResults](../json-schema/response.json#/definitions/LegacyValidationResults) +- Request: [request.json#/$defs/DeviceReport](../json-schema/request.json#/$defs/DeviceReport) +- Response: [response.json#/$defs/LegacyValidationResults](../json-schema/response.json#/$defs/LegacyValidationResults) ### `POST /device/:device_id_or_serial_number/validation_plan/:validation_plan_id` @@ -186,8 +186,8 @@ This endpoint is **deprecated** and will be removed in Conch API v4.0. - User requires the read-only role - Controller/Action: ["run\_validation\_plan" in Conch::Controller::DeviceValidation](../modules/Conch%3A%3AController%3A%3ADeviceValidation#run_validation_plan) -- Request: [request.json#/definitions/DeviceReport](../json-schema/request.json#/definitions/DeviceReport) -- Response: [response.json#/definitions/LegacyValidationResults](../json-schema/response.json#/definitions/LegacyValidationResults) +- Request: [request.json#/$defs/DeviceReport](../json-schema/request.json#/$defs/DeviceReport) +- Response: [response.json#/$defs/LegacyValidationResults](../json-schema/response.json#/$defs/LegacyValidationResults) ### `GET /device/:device_id_or_serial_number/validation_state?status=&status=...` @@ -196,25 +196,25 @@ to search for (one of `pass`, `fail`, `error`). Can be used more than once. - User requires the read-only role - Controller/Action: ["get\_validation\_state" in Conch::Controller::DeviceValidation](../modules/Conch%3A%3AController%3A%3ADeviceValidation#get_validation_state) -- Response: [response.json#/definitions/ValidationStateWithResults](../json-schema/response.json#/definitions/ValidationStateWithResults) +- Response: [response.json#/$defs/ValidationStateWithResults](../json-schema/response.json#/$defs/ValidationStateWithResults) ### `GET /device/:device_id_or_serial_number/interface` - User requires the read-only role - Controller/Action: ["get\_all" in Conch::Controller::DeviceInterface](../modules/Conch%3A%3AController%3A%3ADeviceInterface#get_all) -- Response: [response.json#/definitions/DeviceNics](../json-schema/response.json#/definitions/DeviceNics) +- Response: [response.json#/$defs/DeviceNics](../json-schema/response.json#/$defs/DeviceNics) ### `GET /device/:device_id_or_serial_number/interface/:interface_name` - User requires the read-only role - Controller/Action: ["get\_one" in Conch::Controller::DeviceInterface](../modules/Conch%3A%3AController%3A%3ADeviceInterface#get_one) -- Response: [response.json#/definitions/DeviceNic](../json-schema/response.json#/definitions/DeviceNic) +- Response: [response.json#/$defs/DeviceNic](../json-schema/response.json#/$defs/DeviceNic) ### `GET /device/:device_id_or_serial_number/interface/:interface_name/:field` - User requires the read-only role - Controller/Action: ["get\_one\_field" in Conch::Controller::DeviceInterface](../modules/Conch%3A%3AController%3A%3ADeviceInterface#get_one_field) -- Response: [response.json#/definitions/DeviceNicField](../json-schema/response.json#/definitions/DeviceNicField) +- Response: [response.json#/$defs/DeviceNicField](../json-schema/response.json#/$defs/DeviceNicField) ## LICENSING diff --git a/docs/modules/Conch::Route::DeviceReport.md b/docs/modules/Conch::Route::DeviceReport.md index fa9be6a08..7676cec95 100644 --- a/docs/modules/Conch::Route::DeviceReport.md +++ b/docs/modules/Conch::Route::DeviceReport.md @@ -22,7 +22,7 @@ Device data will be updated in the database. - The authenticated user must have previously registered the relay being used for the report submission (as indicated via `#/relay/serial` in the report). - Controller/Action: ["process" in Conch::Controller::DeviceReport](../modules/Conch%3A%3AController%3A%3ADeviceReport#process) -- Request: [request.json#/definitions/DeviceReport](../json-schema/request.json#/definitions/DeviceReport) +- Request: [request.json#/$defs/DeviceReport](../json-schema/request.json#/$defs/DeviceReport) - Response: `201 Created`, plus Location header ### `POST /device_report?no_update_db=1` @@ -31,14 +31,14 @@ Submits a device report for processing. Device data will **not** be updated in t only validations will be run. - Controller/Action: ["validate\_report" in Conch::Controller::DeviceReport](../modules/Conch%3A%3AController%3A%3ADeviceReport#validate_report) -- Request: [request.json#/definitions/DeviceReport](../json-schema/request.json#/definitions/DeviceReport) -- Response: [response.json#/definitions/ReportValidationResults](../json-schema/response.json#/definitions/ReportValidationResults) +- Request: [request.json#/$defs/DeviceReport](../json-schema/request.json#/$defs/DeviceReport) +- Response: [response.json#/$defs/ReportValidationResults](../json-schema/response.json#/$defs/ReportValidationResults) ### `GET /device_report/:device_report_id` - User requires the read-only role, as described in ["routes" in Conch::Route::Device](../modules/Conch%3A%3ARoute%3A%3ADevice#routes). - Controller/Action: ["get" in Conch::Controller::DeviceReport](../modules/Conch%3A%3AController%3A%3ADeviceReport#get) -- Response: [response.json#/definitions/DeviceReportRow](../json-schema/response.json#/definitions/DeviceReportRow) +- Response: [response.json#/$defs/DeviceReportRow](../json-schema/response.json#/$defs/DeviceReportRow) ## LICENSING diff --git a/docs/modules/Conch::Route::HardwareProduct.md b/docs/modules/Conch::Route::HardwareProduct.md index d38950342..6d6926a9c 100644 --- a/docs/modules/Conch::Route::HardwareProduct.md +++ b/docs/modules/Conch::Route::HardwareProduct.md @@ -17,13 +17,13 @@ All routes require authentication. ### `GET /hardware_product` - Controller/Action: ["get\_all" in Conch::Controller::HardwareProduct](../modules/Conch%3A%3AController%3A%3AHardwareProduct#get_all) -- Response: [response.json#/definitions/HardwareProducts](../json-schema/response.json#/definitions/HardwareProducts) +- Response: [response.json#/$defs/HardwareProducts](../json-schema/response.json#/$defs/HardwareProducts) ### `POST /hardware_product` - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::HardwareProduct](../modules/Conch%3A%3AController%3A%3AHardwareProduct#create) -- Request: [request.json#/definitions/HardwareProductCreate](../json-schema/request.json#/definitions/HardwareProductCreate) +- Request: [request.json#/$defs/HardwareProductCreate](../json-schema/request.json#/$defs/HardwareProductCreate) - Response: Redirect to the created hardware product ### `GET /hardware_product/:hardware_product_id_or_other` @@ -31,7 +31,7 @@ All routes require authentication. Identifiers accepted: `id`, `sku`, `name` and `alias`. - Controller/Action: ["get" in Conch::Controller::HardwareProduct](../modules/Conch%3A%3AController%3A%3AHardwareProduct#get) -- Response: [response.json#/definitions/HardwareProduct](../json-schema/response.json#/definitions/HardwareProduct) +- Response: [response.json#/$defs/HardwareProduct](../json-schema/response.json#/$defs/HardwareProduct) ### `POST /hardware_product/:hardware_product_id_or_other` @@ -41,7 +41,7 @@ Identifiers accepted: `id`, `sku`, `name` and `alias`. - Requires system admin authorization - Controller/Action: ["update" in Conch::Controller::HardwareProduct](../modules/Conch%3A%3AController%3A%3AHardwareProduct#update) -- Request: [request.json#/definitions/HardwareProductUpdate](../json-schema/request.json#/definitions/HardwareProductUpdate) +- Request: [request.json#/$defs/HardwareProductUpdate](../json-schema/request.json#/$defs/HardwareProductUpdate) - Response: Redirect to the updated hardware product ### `DELETE /hardware_product/:hardware_product_id_or_other` @@ -83,7 +83,7 @@ Results in this data in `specification`, changing the data type at node `/foo/ba - Requires system admin authorization - Controller/Action: ["set\_specification" in Conch::Controller::HardwareProduct](../modules/Conch%3A%3AController%3A%3AHardwareProduct#set_specification) - Request: after the update operation, the `specification` property must validate against -[common.json#/definitions/HardwareProductSpecification](../json-schema/common.json#/definitions/HardwareProductSpecification). +[common.json#/$defs/HardwareProductSpecification](../json-schema/common.json#/$defs/HardwareProductSpecification). - Response: `204 No Content` ### `DELETE /hardware_product/:hardware_product_id_or_other/specification?path=:path_to_data` @@ -93,7 +93,7 @@ parameter `path` as the JSON pointer to the data to be removed. All other proper blob are left untouched. After the delete operation, the `specification` property must validate against -[common.json#/definitions/HardwareProductSpecification](../json-schema/common.json#/definitions/HardwareProductSpecification). +[common.json#/$defs/HardwareProductSpecification](../json-schema/common.json#/$defs/HardwareProductSpecification). - Requires system admin authorization - Controller/Action: ["delete\_specification" in Conch::Controller::HardwareProduct](../modules/Conch%3A%3AController%3A%3AHardwareProduct#delete_specification) diff --git a/docs/modules/Conch::Route::HardwareVendor.md b/docs/modules/Conch::Route::HardwareVendor.md index 514108aeb..9b9323672 100644 --- a/docs/modules/Conch::Route::HardwareVendor.md +++ b/docs/modules/Conch::Route::HardwareVendor.md @@ -17,12 +17,12 @@ All routes require authentication. ### `GET /hardware_vendor` - Controller/Action: ["get\_all" in Conch::Controller::HardwareVendor](../modules/Conch%3A%3AController%3A%3AHardwareVendor#get_all) -- Response: [response.json#/definitions/HardwareVendors](../json-schema/response.json#/definitions/HardwareVendors) +- Response: [response.json#/$defs/HardwareVendors](../json-schema/response.json#/$defs/HardwareVendors) ### `GET /hardware_vendor/:hardware_vendor_id_or_name` - Controller/Action: ["get\_one" in Conch::Controller::HardwareVendor](../modules/Conch%3A%3AController%3A%3AHardwareVendor#get_one) -- Response: [response.json#/definitions/HardwareVendor](../json-schema/response.json#/definitions/HardwareVendor) +- Response: [response.json#/$defs/HardwareVendor](../json-schema/response.json#/$defs/HardwareVendor) ### `DELETE /hardware_vendor/:hardware_vendor_id_or_name` @@ -34,7 +34,7 @@ All routes require authentication. - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::HardwareVendor](../modules/Conch%3A%3AController%3A%3AHardwareVendor#create) -- Request: [request.json#/definitions/Null](../json-schema/request.json#/definitions/Null) +- Request: [request.json#/$defs/Null](../json-schema/request.json#/$defs/Null) - Response: Redirect to the created hardware vendor ## LICENSING diff --git a/docs/modules/Conch::Route::Organization.md b/docs/modules/Conch::Route::Organization.md index cab0092a8..7b6466157 100644 --- a/docs/modules/Conch::Route::Organization.md +++ b/docs/modules/Conch::Route::Organization.md @@ -17,26 +17,26 @@ All routes require authentication. ### `GET /organization` - Controller/Action: ["get\_all" in Conch::Controller::Organization](../modules/Conch%3A%3AController%3A%3AOrganization#get_all) -- Response: [response.json#/definitions/Organizations](../json-schema/response.json#/definitions/Organizations) +- Response: [response.json#/$defs/Organizations](../json-schema/response.json#/$defs/Organizations) ### `POST /organization` - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::Organization](../modules/Conch%3A%3AController%3A%3AOrganization#create) -- Request: [request.json#/definitions/OrganizationCreate](../json-schema/request.json#/definitions/OrganizationCreate) +- Request: [request.json#/$defs/OrganizationCreate](../json-schema/request.json#/$defs/OrganizationCreate) - Response: Redirect to the organization ### `GET /organization/:organization_id_or_name` - Requires system admin authorization or the admin role on the organization - Controller/Action: ["get" in Conch::Controller::Organization](../modules/Conch%3A%3AController%3A%3AOrganization#get) -- Response: [response.json#/definitions/Organization](../json-schema/response.json#/definitions/Organization) +- Response: [response.json#/$defs/Organization](../json-schema/response.json#/$defs/Organization) ### `POST /organization/:organization_id_or_name` - Requires system admin authorization or the admin role on the organization - Controller/Action: ["update" in Conch::Controller::Organization](../modules/Conch%3A%3AController%3A%3AOrganization#update) -- Request: [request.json#/definitions/OrganizationUpdate](../json-schema/request.json#/definitions/OrganizationUpdate) +- Request: [request.json#/$defs/OrganizationUpdate](../json-schema/request.json#/$defs/OrganizationUpdate) - Response: Redirect to the organization ### `DELETE /organization/:organization_id_or_name` @@ -52,7 +52,7 @@ an email to the user. - Requires system admin authorization or the admin role on the organization - Controller/Action: ["add\_user" in Conch::Controller::Organization](../modules/Conch%3A%3AController%3A%3AOrganization#add_user) -- Request: [request.json#/definitions/OrganizationAddUser](../json-schema/request.json#/definitions/OrganizationAddUser) +- Request: [request.json#/$defs/OrganizationAddUser](../json-schema/request.json#/$defs/OrganizationAddUser) - Response: `204 No Content` ### `DELETE /organization/:organization_id_or_name/user/#target_user_id_or_email?send_mail=<1|0`> diff --git a/docs/modules/Conch::Route::Rack.md b/docs/modules/Conch::Route::Rack.md index e93473abb..d1f7a6c47 100644 --- a/docs/modules/Conch::Route::Rack.md +++ b/docs/modules/Conch::Route::Rack.md @@ -26,20 +26,20 @@ available under `/rack/:rack_id_or_long_name` as well as - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#create) -- Request: [request.json#/definitions/RackCreate](../json-schema/request.json#/definitions/RackCreate) +- Request: [request.json#/$defs/RackCreate](../json-schema/request.json#/$defs/RackCreate) - Response: Redirect to the created rack ### `GET /rack/:rack_id_or_name` - User requires the read-only role on the rack - Controller/Action: ["get" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#get) -- Response: [response.json#/definitions/Rack](../json-schema/response.json#/definitions/Rack) +- Response: [response.json#/$defs/Rack](../json-schema/response.json#/$defs/Rack) ### `POST /rack/:rack_id_or_name` - User requires the read/write role on the rack - Controller/Action: ["update" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#update) -- Request: [request.json#/definitions/RackUpdate](../json-schema/request.json#/definitions/RackUpdate) +- Request: [request.json#/$defs/RackUpdate](../json-schema/request.json#/$defs/RackUpdate) - Response: Redirect to the updated rack ### `DELETE /rack/:rack_id_or_name` @@ -52,26 +52,26 @@ available under `/rack/:rack_id_or_long_name` as well as - User requires the read-only role on the rack - Controller/Action: ["get\_layouts" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#get_layouts) -- Response: [response.json#/definitions/RackLayouts](../json-schema/response.json#/definitions/RackLayouts) +- Response: [response.json#/$defs/RackLayouts](../json-schema/response.json#/$defs/RackLayouts) ### `POST /rack/:rack_id_or_name/layout` - User requires the read/write role on the rack - Controller/Action: ["overwrite\_layouts" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#overwrite_layouts) -- Request: [request.json#/definitions/RackLayouts](../json-schema/request.json#/definitions/RackLayouts) +- Request: [request.json#/$defs/RackLayouts](../json-schema/request.json#/$defs/RackLayouts) - Response: Redirect to the rack's layouts ### `GET /rack/:rack_id_or_name/assignment` - User requires the read-only role on the rack - Controller/Action: ["get\_assignment" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#get_assignment) -- Response: [response.json#/definitions/RackAssignments](../json-schema/response.json#/definitions/RackAssignments) +- Response: [response.json#/$defs/RackAssignments](../json-schema/response.json#/$defs/RackAssignments) ### `POST /rack/:rack_id_or_name/assignment` - User requires the read/write role on the rack - Controller/Action: ["set\_assignment" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#set_assignment) -- Request: [request.json#/definitions/RackAssignmentUpdates](../json-schema/request.json#/definitions/RackAssignmentUpdates) +- Request: [request.json#/$defs/RackAssignmentUpdates](../json-schema/request.json#/$defs/RackAssignmentUpdates) - Response: Redirect to the updated rack assignment ### `DELETE /rack/:rack_id_or_name/assignment` @@ -80,7 +80,7 @@ This method requires a request body. - User requires the read/write role on the rack - Controller/Action: ["delete\_assignment" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#delete_assignment) -- Request: [request.json#/definitions/RackAssignmentDeletes](../json-schema/request.json#/definitions/RackAssignmentDeletes) +- Request: [request.json#/$defs/RackAssignmentDeletes](../json-schema/request.json#/$defs/RackAssignmentDeletes) - Response: `204 No Content` ### `POST /rack/:rack_id_or_name/phase?rack_only=<0|1>` @@ -90,20 +90,20 @@ only the rack's phase, or all the rack's devices' phases as well. - User requires the read/write role on the rack - Controller/Action: ["set\_phase" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#set_phase) -- Request: [request.json#/definitions/RackPhase](../json-schema/request.json#/definitions/RackPhase) +- Request: [request.json#/$defs/RackPhase](../json-schema/request.json#/$defs/RackPhase) - Response: Redirect to the updated rack #### `POST /rack/:rack_id_or_name/links` - User requires the read/write role on the rack - Controller/Action: ["add\_links" in Conch::Controller::Rack](../modules/Conch%3A%3AController%3A%3ARack#add_links) -- Request: [request.json#/definitions/RackLinks](../json-schema/request.json#/definitions/RackLinks) +- Request: [request.json#/$defs/RackLinks](../json-schema/request.json#/$defs/RackLinks) - Response: Redirect to the updated rack #### `DELETE /rack/:rack_id_or_name/links` - User requires the read/write role on the rack -- Request: [request.json#/definitions/RackLinksOrNull](../json-schema/request.json#/definitions/RackLinksOrNull) +- Request: [request.json#/$defs/RackLinksOrNull](../json-schema/request.json#/$defs/RackLinksOrNull) - Response: 204 NO CONTENT ### `GET /rack/:rack_id_or_name/layout/:layout_id_or_rack_unit_start` diff --git a/docs/modules/Conch::Route::RackLayout.md b/docs/modules/Conch::Route::RackLayout.md index c02e672cc..56eff56f2 100644 --- a/docs/modules/Conch::Route::RackLayout.md +++ b/docs/modules/Conch::Route::RackLayout.md @@ -27,26 +27,26 @@ well as - Requires system admin authorization - Controller/Action: ["get\_all" in Conch::Controller::RackLayout](../modules/Conch%3A%3AController%3A%3ARackLayout#get_all) -- Response: [response.json#/definitions/RackLayouts](../json-schema/response.json#/definitions/RackLayouts) +- Response: [response.json#/$defs/RackLayouts](../json-schema/response.json#/$defs/RackLayouts) ### `POST /layout` - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::RackLayout](../modules/Conch%3A%3AController%3A%3ARackLayout#create) -- Request: [request.json#/definitions/RackLayoutCreate](../json-schema/request.json#/definitions/RackLayoutCreate) +- Request: [request.json#/$defs/RackLayoutCreate](../json-schema/request.json#/$defs/RackLayoutCreate) - Response: Redirect to the created rack layout ### `GET /layout/:layout_id` - Requires system admin authorization - Controller/Action: ["get" in Conch::Controller::RackLayout](../modules/Conch%3A%3AController%3A%3ARackLayout#get) -- Response: [response.json#/definitions/RackLayout](../json-schema/response.json#/definitions/RackLayout) +- Response: [response.json#/$defs/RackLayout](../json-schema/response.json#/$defs/RackLayout) ### `POST /layout/:layout_id` - Requires system admin authorization - Controller/Action: ["update" in Conch::Controller::RackLayout](../modules/Conch%3A%3AController%3A%3ARackLayout#update) -- Request: [request.json#/definitions/RackLayoutUpdate](../json-schema/request.json#/definitions/RackLayoutUpdate) +- Request: [request.json#/$defs/RackLayoutUpdate](../json-schema/request.json#/$defs/RackLayoutUpdate) - Response: Redirect to the update rack layout ### `DELETE /layout/:layout_id` diff --git a/docs/modules/Conch::Route::RackRole.md b/docs/modules/Conch::Route::RackRole.md index de416938b..c5c9bb967 100644 --- a/docs/modules/Conch::Route::RackRole.md +++ b/docs/modules/Conch::Route::RackRole.md @@ -17,25 +17,25 @@ All routes require authentication. ### `GET /rack_role` - Controller/Action: ["get\_all" in Conch::Controller::RackRole](../modules/Conch%3A%3AController%3A%3ARackRole#get_all) -- Response: [response.json#/definitions/RackRoles](../json-schema/response.json#/definitions/RackRoles) +- Response: [response.json#/$defs/RackRoles](../json-schema/response.json#/$defs/RackRoles) ### `POST /rack_role` - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::RackRole](../modules/Conch%3A%3AController%3A%3ARackRole#create) -- Request: [request.json#/definitions/RackRoleCreate](../json-schema/request.json#/definitions/RackRoleCreate) +- Request: [request.json#/$defs/RackRoleCreate](../json-schema/request.json#/$defs/RackRoleCreate) - Response: Redirect to the created rack role ### `GET /rack_role/:rack_role_id_or_name` - Controller/Action: ["get" in Conch::Controller::RackRole](../modules/Conch%3A%3AController%3A%3ARackRole#get) -- Response: [response.json#/definitions/RackRole](../json-schema/response.json#/definitions/RackRole) +- Response: [response.json#/$defs/RackRole](../json-schema/response.json#/$defs/RackRole) ### `POST /rack_role/:rack_role_id_or_name` - Requires system admin authorization - Controller/Action: ["update" in Conch::Controller::RackRole](../modules/Conch%3A%3AController%3A%3ARackRole#update) -- Request: [request.json#/definitions/RackRoleUpdate](../json-schema/request.json#/definitions/RackRoleUpdate) +- Request: [request.json#/$defs/RackRoleUpdate](../json-schema/request.json#/$defs/RackRoleUpdate) - Response: Redirect to the updated rack role ### `DELETE /rack_role/:rack_role_id_or_name` diff --git a/docs/modules/Conch::Route::Relay.md b/docs/modules/Conch::Route::Relay.md index 0e7006f1c..adf425878 100644 --- a/docs/modules/Conch::Route::Relay.md +++ b/docs/modules/Conch::Route::Relay.md @@ -17,20 +17,20 @@ All routes require authentication. ### `POST /relay/:relay_serial_number/register` - Controller/Action: ["register" in Conch::Controller::Relay](../modules/Conch%3A%3AController%3A%3ARelay#register) -- Request: [request.json#/definitions/RegisterRelay](../json-schema/request.json#/definitions/RegisterRelay) +- Request: [request.json#/$defs/RegisterRelay](../json-schema/request.json#/$defs/RegisterRelay) - Response: `201 Created` or `204 No Content`, plus Location header ### `GET /relay` - Requires system admin authorization - Controller/Action: ["get\_all" in Conch::Controller::Relay](../modules/Conch%3A%3AController%3A%3ARelay#get_all) -- Response: [response.json#/definitions/Relays](../json-schema/response.json#/definitions/Relays) +- Response: [response.json#/$defs/Relays](../json-schema/response.json#/$defs/Relays) ### `GET /relay/:relay_id_or_serial_number` - Requires system admin authorization, or the user to have previously registered the relay. - Controller/Action: ["get" in Conch::Controller::Relay](../modules/Conch%3A%3AController%3A%3ARelay#get) -- Response: [response.json#/definitions/Relay](../json-schema/response.json#/definitions/Relay) +- Response: [response.json#/$defs/Relay](../json-schema/response.json#/$defs/Relay) ### `DELETE /relay/:relay_id_or_serial_number` diff --git a/docs/modules/Conch::Route::User.md b/docs/modules/Conch::Route::User.md index 489e62d53..0e86f6190 100644 --- a/docs/modules/Conch::Route::User.md +++ b/docs/modules/Conch::Route::User.md @@ -17,7 +17,7 @@ All routes require authentication. ### `GET /user/me` - Controller/Action: ["get" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get) -- Response: [response.json#/definitions/UserDetailed](../json-schema/response.json#/definitions/UserDetailed) +- Response: [response.json#/$defs/UserDetailed](../json-schema/response.json#/$defs/UserDetailed) ### `POST /user/:target_user_id_or_email?send_mail=<1|0>` @@ -25,9 +25,9 @@ Optionally take the query parameter `send_mail` (defaults to `1`) to send an email telling the user their account was updated - Controller/Action: ["update" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#update) -- Request: [request.json#/definitions/UpdateUser](../json-schema/request.json#/definitions/UpdateUser) +- Request: [request.json#/$defs/UpdateUser](../json-schema/request.json#/$defs/UpdateUser) - Success Response: Redirect to the user that was updated -- Error response on duplicate user: [response.json#/definitions/UserError](../json-schema/response.json#/definitions/UserError) (only if the +- Error response on duplicate user: [response.json#/$defs/UserError](../json-schema/response.json#/$defs/UserError) (only if the calling user is a system admin) ### `POST /user/me/revoke?send_mail=<1|0>&login_only=<0|1>&api_only=<0|1>` @@ -42,7 +42,7 @@ By default it will revoke both login/session and API tokens. `api_only` and `login_only` cannot both be `1`. - Controller/Action: ["revoke\_user\_tokens" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#revoke_user_tokens) -- Request: [request.json#/definitions/UserSettings](../json-schema/request.json#/definitions/UserSettings) +- Request: [request.json#/$defs/UserSettings](../json-schema/request.json#/$defs/UserSettings) - Response: `204 No Content` ### `POST /user/me/password?clear_tokens=` @@ -58,29 +58,29 @@ If the `clear_tokens` parameter is set to `none` then the user session will rema otherwise, the user is logged out. - Controller/Action: ["change\_own\_password" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#change_own_password) -- Request: [request.json#/definitions/UserSettings](../json-schema/request.json#/definitions/UserSettings) +- Request: [request.json#/$defs/UserSettings](../json-schema/request.json#/$defs/UserSettings) - Response: `204 No Content` ### `GET /user/me/settings` - Controller/Action: ["get\_settings" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get_settings) -- Response: [response.json#/definitions/UserSettings](../json-schema/response.json#/definitions/UserSettings) +- Response: [response.json#/$defs/UserSettings](../json-schema/response.json#/$defs/UserSettings) ### `POST /user/me/settings` - Controller/Action: ["set\_settings" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#set_settings) -- Request: [request.json#/definitions/UserSettings](../json-schema/request.json#/definitions/UserSettings) +- Request: [request.json#/$defs/UserSettings](../json-schema/request.json#/$defs/UserSettings) - Response: `204 No Content` ### `GET /user/me/settings/:key` - Controller/Action: ["get\_setting" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get_setting) -- Response: [response.json#/definitions/UserSetting](../json-schema/response.json#/definitions/UserSetting) +- Response: [response.json#/$defs/UserSetting](../json-schema/response.json#/$defs/UserSetting) ### `POST /user/me/settings/:key` - Controller/Action: ["set\_setting" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#set_setting) -- Request: [request.json#/definitions/UserSetting](../json-schema/request.json#/definitions/UserSetting) +- Request: [request.json#/$defs/UserSetting](../json-schema/request.json#/$defs/UserSetting) - Response: `204 No Content` ### `DELETE /user/me/settings/:key` @@ -91,18 +91,18 @@ otherwise, the user is logged out. ### `GET /user/me/token` - Controller/Action: ["get\_api\_tokens" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get_api_tokens) -- Response: [response.json#/definitions/UserTokens](../json-schema/response.json#/definitions/UserTokens) +- Response: [response.json#/$defs/UserTokens](../json-schema/response.json#/$defs/UserTokens) ### `POST /user/me/token` - Controller/Action: ["create\_api\_token" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#create_api_token) -- Request: [request.json#/definitions/NewUserToken](../json-schema/request.json#/definitions/NewUserToken) -- Response: [response.json#/definitions/NewUserToken](../json-schema/response.json#/definitions/NewUserToken) +- Request: [request.json#/$defs/NewUserToken](../json-schema/request.json#/$defs/NewUserToken) +- Response: [response.json#/$defs/NewUserToken](../json-schema/response.json#/$defs/NewUserToken) ### `GET /user/me/token/:token_name` - Controller/Action: ["get\_api\_token" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get_api_token) -- Response: [response.json#/definitions/UserToken](../json-schema/response.json#/definitions/UserToken) +- Response: [response.json#/$defs/UserToken](../json-schema/response.json#/$defs/UserToken) ### `DELETE /user/me/token/:token_name` @@ -113,7 +113,7 @@ otherwise, the user is logged out. - Requires system admin authorization (when updating a different account than one's own) - Controller/Action: ["get" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get) -- Response: [response.json#/definitions/UserDetailed](../json-schema/response.json#/definitions/UserDetailed) +- Response: [response.json#/$defs/UserDetailed](../json-schema/response.json#/$defs/UserDetailed) ### `POST /user/:target_user_id_or_email?send_mail=<1|0>` @@ -122,9 +122,9 @@ an email telling the user their account was updated - Requires system admin authorization - Controller/Action: ["update" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#update) -- Request: [request.json#/definitions/UpdateUser](../json-schema/request.json#/definitions/UpdateUser) +- Request: [request.json#/$defs/UpdateUser](../json-schema/request.json#/$defs/UpdateUser) - Success Response: Redirect to the user that was updated -- Error response on duplicate user: [response.json#/definitions/UserError](../json-schema/response.json#/definitions/UserError) (only if the +- Error response on duplicate user: [response.json#/$defs/UserError](../json-schema/response.json#/$defs/UserError) (only if the calling user is a system admin) ### `DELETE /user/:target_user_id_or_email?clear_tokens=<1|0>` @@ -171,7 +171,7 @@ Optionally accepts the following query parameters: - Requires system admin authorization - Controller/Action: ["get\_all" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get_all) -- Response: [response.json#/definitions/Users](../json-schema/response.json#/definitions/Users) +- Response: [response.json#/$defs/Users](../json-schema/response.json#/$defs/Users) ### `POST /user?send_mail=<1|0>` @@ -180,28 +180,28 @@ email to the user with the new password. - Requires system admin authorization - Controller/Action: ["create" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#create) -- Request: [request.json#/definitions/NewUser](../json-schema/request.json#/definitions/NewUser) -- Success Response: [response.json#/definitions/NewUser](../json-schema/response.json#/definitions/NewUser) -- Error response on duplicate user: [response.json#/definitions/UserError](../json-schema/response.json#/definitions/UserError) +- Request: [request.json#/$defs/NewUser](../json-schema/request.json#/$defs/NewUser) +- Success Response: [response.json#/$defs/NewUser](../json-schema/response.json#/$defs/NewUser) +- Error response on duplicate user: [response.json#/$defs/UserError](../json-schema/response.json#/$defs/UserError) ### `GET /user/:target_user_id_or_email/token` - Requires system admin authorization - Controller/Action: ["get\_api\_tokens" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get_api_tokens) -- Response: [response.json#/definitions/UserTokens](../json-schema/response.json#/definitions/UserTokens) +- Response: [response.json#/$defs/UserTokens](../json-schema/response.json#/$defs/UserTokens) ### `GET /user/:target_user_id_or_email/token/:token_name` - Requires system admin authorization - Controller/Action: ["get\_api\_token" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#get_api_token) -- Response: [response.json#/definitions/UserTokens](../json-schema/response.json#/definitions/UserTokens) +- Response: [response.json#/$defs/UserTokens](../json-schema/response.json#/$defs/UserTokens) ### `DELETE /user/:target_user_id_or_email/token/:token_name` - Requires system admin authorization - Controller/Action: ["expire\_api\_token" in Conch::Controller::User](../modules/Conch%3A%3AController%3A%3AUser#expire_api_token) - Success Response: `204 No Content` -- Error response when user already deactivated: [response.json#/definitions/UserError](../json-schema/response.json#/definitions/UserError) +- Error response when user already deactivated: [response.json#/$defs/UserError](../json-schema/response.json#/$defs/UserError) ## LICENSING diff --git a/docs/modules/Conch::Route::ValidationPlan.md b/docs/modules/Conch::Route::ValidationPlan.md index 0291694ff..e9c4e3b51 100644 --- a/docs/modules/Conch::Route::ValidationPlan.md +++ b/docs/modules/Conch::Route::ValidationPlan.md @@ -19,17 +19,17 @@ All routes require authentication. ### `GET /validation_plan` - Controller/Action: ["get\_all" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#get_all) -- Response: [response.json#/definitions/LegacyValidationPlans](../json-schema/response.json#/definitions/LegacyValidationPlans) +- Response: [response.json#/$defs/LegacyValidationPlans](../json-schema/response.json#/$defs/LegacyValidationPlans) ### `GET /validation_plan/:legacy_validation_plan_id_or_name` - Controller/Action: ["get" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#get) -- Response: [response.json#/definitions/LegacyValidationPlan](../json-schema/response.json#/definitions/LegacyValidationPlan) +- Response: [response.json#/$defs/LegacyValidationPlan](../json-schema/response.json#/$defs/LegacyValidationPlan) ### `GET /validation_plan/:legacy_validation_plan_id_or_name/validation` - Controller/Action: ["validations" in Conch::Controller::ValidationPlan](../modules/Conch%3A%3AController%3A%3AValidationPlan#validations) -- Response: [response.json#/definitions/LegacyValidations](../json-schema/response.json#/definitions/LegacyValidations) +- Response: [response.json#/$defs/LegacyValidations](../json-schema/response.json#/$defs/LegacyValidations) ## LICENSING diff --git a/docs/modules/Conch::Route::ValidationState.md b/docs/modules/Conch::Route::ValidationState.md index 3d1e1785e..f42ed32ce 100644 --- a/docs/modules/Conch::Route::ValidationState.md +++ b/docs/modules/Conch::Route::ValidationState.md @@ -17,7 +17,7 @@ All routes require authentication. ### `GET /validation_state/:validation_state_id` - Controller/Action: ["get" in Conch::Controller::ValidationState](../modules/Conch%3A%3AController%3A%3AValidationState#get) -- Response: [response.json#/definitions/ValidationStateWithResults](../json-schema/response.json#/definitions/ValidationStateWithResults) +- Response: [response.json#/$defs/ValidationStateWithResults](../json-schema/response.json#/$defs/ValidationStateWithResults) ## LICENSING diff --git a/docs/modules/Test::Conch.md b/docs/modules/Test::Conch.md index 402001cc9..01f467704 100644 --- a/docs/modules/Test::Conch.md +++ b/docs/modules/Test::Conch.md @@ -85,7 +85,7 @@ As ["location\_is"](#location_is), but takes a regular expression. ### json\_schema\_is Validates the JSON response of the most recent request. If given a string that looks like a URL, -fetches that URL; otherwise if a string, looks up the schema in `#/definitions` in the JSON Schema +fetches that URL; otherwise if a string, looks up the schema in `#/$defs` in the JSON Schema response specification document to validate. If given a hash, uses the hash as the schema to validate. diff --git a/json-schema/common.yaml b/json-schema/common.yaml index 7f1d28b64..569bc8517 100644 --- a/json-schema/common.yaml +++ b/json-schema/common.yaml @@ -1,12 +1,12 @@ --- $schema: 'http://json-schema.org/draft-07/schema#' -definitions: +$defs: uuid: type: string pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' non_zero_uuid: allOf: - - $ref: '#/definitions/uuid' + - $ref: '#/$defs/uuid' - not: const: 00000000-0000-0000-0000-000000000000 ipaddr: @@ -25,7 +25,7 @@ definitions: allOf: - type: string pattern: ^\S+$ - - $ref: '#/definitions/mojo_standard_placeholder' + - $ref: '#/$defs/mojo_standard_placeholder' device_asset_tag: type: string pattern: ^\S+$ @@ -50,9 +50,9 @@ definitions: allOf: - type: string pattern: ^\S+$ - - $ref: '#/definitions/mojo_relaxed_placeholder' + - $ref: '#/$defs/mojo_relaxed_placeholder' device_setting_key: - $ref: '#/definitions/mojo_relaxed_placeholder' + $ref: '#/$defs/mojo_relaxed_placeholder' disk_serial_number: type: string pattern: ^\S+$ @@ -60,7 +60,7 @@ definitions: type: string pattern: ^[\w-]+$ user_setting_key: - $ref: '#/definitions/mojo_relaxed_placeholder' + $ref: '#/$defs/mojo_relaxed_placeholder' role: description: corresponds to role_enum in the database type: string @@ -96,7 +96,7 @@ definitions: allOf: - type: string format: email - - $ref: '#/definitions/mojo_relaxed_placeholder' + - $ref: '#/$defs/mojo_relaxed_placeholder' links: type: array uniqueItems: true diff --git a/json-schema/device_report.yaml b/json-schema/device_report.yaml index 8110f456f..d889dfc82 100644 --- a/json-schema/device_report.yaml +++ b/json-schema/device_report.yaml @@ -1,6 +1,6 @@ --- $schema: 'http://json-schema.org/draft-07/schema#' -definitions: +$defs: int_or_stringy_int: description: an integer that may be presented as a json string oneOf: @@ -35,21 +35,21 @@ definitions: type: string memory-serial-number: oneOf: - - $ref: common.yaml#/definitions/non_empty_string + - $ref: common.yaml#/$defs/non_empty_string - type: 'null' memory-size: oneOf: - - $ref: '#/definitions/int_or_stringy_int' + - $ref: '#/$defs/int_or_stringy_int' - type: 'null' disks: type: object propertyNames: - $ref: common.yaml#/definitions/disk_serial_number + $ref: common.yaml#/$defs/disk_serial_number additionalProperties: type: object properties: slot: - $ref: '#/definitions/int_or_stringy_int' + $ref: '#/$defs/int_or_stringy_int' size: type: integer vendor: @@ -65,11 +65,11 @@ definitions: drive_type: type: string temp: - $ref: '#/definitions/int_or_stringy_int' + $ref: '#/$defs/int_or_stringy_int' enclosure: - $ref: '#/definitions/int_or_stringy_int' + $ref: '#/$defs/int_or_stringy_int' hba: - $ref: '#/definitions/int_or_stringy_int' + $ref: '#/$defs/int_or_stringy_int' block_sz: type: integer # any additional fields are not currently used. @@ -82,7 +82,7 @@ definitions: # TODO: this is required for servers type: object propertyNames: - $ref: common.yaml#/definitions/device_interface_name + $ref: common.yaml#/$defs/device_interface_name additionalProperties: type: object required: @@ -91,7 +91,7 @@ definitions: - vendor properties: mac: - $ref: common.yaml#/definitions/macaddr + $ref: common.yaml#/$defs/macaddr product: type: string vendor: @@ -102,15 +102,15 @@ definitions: - type: 'null' ipaddr: oneOf: - - $ref: common.yaml#/definitions/ipaddr + - $ref: common.yaml#/$defs/ipaddr - type: 'null' mtu: oneOf: - - $ref: '#/definitions/int_or_stringy_int' + - $ref: '#/$defs/int_or_stringy_int' - type: 'null' peer_mac: oneOf: - - $ref: common.yaml#/definitions/macaddr + - $ref: common.yaml#/$defs/macaddr - type: 'null' # peer_text, peer_switch, peer_port, all optional with no constraints # peer_vendor: # TODO! see Conch::Validation::SwitchPeers. @@ -134,11 +134,11 @@ definitions: - serial properties: serial: - $ref: common.yaml#/definitions/relay_serial_number + $ref: common.yaml#/$defs/relay_serial_number serial_number: - $ref: common.yaml#/definitions/device_serial_number + $ref: common.yaml#/$defs/device_serial_number system_uuid: - $ref: common.yaml#/definitions/non_zero_uuid + $ref: common.yaml#/$defs/non_zero_uuid temp: type: object required: @@ -146,18 +146,18 @@ definitions: - cpu1 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' uptime_since: type: string links: allOf: - - $ref: common.yaml#/definitions/links + - $ref: common.yaml#/$defs/links - minItems: 1 # vim: set sts=2 sw=2 et : diff --git a/json-schema/other.yaml b/json-schema/other.yaml index 731e13a50..33cd376f1 100644 --- a/json-schema/other.yaml +++ b/json-schema/other.yaml @@ -1,6 +1,6 @@ # bits that we don't use in Conch are commented out, for faster evaluation. --- -definitions: +$defs: RollbarPayload: type: object additionalProperties: false @@ -158,9 +158,9 @@ definitions: # type: array # minItems: 1 # items: -# $ref: '#/definitions/RollbarPayload/properties/data/properties/body/oneOf/0/properties/trace' +# $ref: '#/$defs/RollbarPayload/properties/data/properties/body/oneOf/0/properties/trace' # telemetry: -# $ref: '#/definitions/RollbarPayload/properties/data/properties/body/oneOf/0/properties/telemetry' +# $ref: '#/$defs/RollbarPayload/properties/data/properties/body/oneOf/0/properties/telemetry' - type: object additionalProperties: false required: @@ -174,7 +174,7 @@ definitions: body: type: string # telemetry: -# $ref: '#/definitions/RollbarPayload/properties/data/properties/body/oneOf/0/properties/telemetry' +# $ref: '#/$defs/RollbarPayload/properties/data/properties/body/oneOf/0/properties/telemetry' # - type: object # additionalProperties: false # required: @@ -189,7 +189,7 @@ definitions: # raw: # type: string # telemetry: -# $ref: '#/definitions/RollbarPayload/properties/data/properties/body/oneOf/0/properties/telemetry' +# $ref: '#/$defs/RollbarPayload/properties/data/properties/body/oneOf/0/properties/telemetry' level: type: string enum: @@ -289,7 +289,7 @@ definitions: # type: string # maxLength: 255 uuid: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid notifier: type: object additionalProperties: false diff --git a/json-schema/query_params.yaml b/json-schema/query_params.yaml index a1880023b..8c2c1ea77 100644 --- a/json-schema/query_params.yaml +++ b/json-schema/query_params.yaml @@ -1,7 +1,7 @@ --- $comment: 'Note that all parameters are parsed internally from the request URI as strings, so all type checks here use strings. When a query parameter is used more than once, its values are parsed as an arrayref. See ../modules/Conch::Plugin::JSONValidator#validate_query_params.' $schema: 'http://json-schema.org/draft-07/schema#' -definitions: +$defs: boolean_string: type: string enum: [ '0', '1' ] @@ -9,9 +9,9 @@ definitions: description: '"?foo" and "?foo=1" are true; "?foo=0" is false' oneOf: - const: '' - - $ref: '#/definitions/boolean_string' + - $ref: '#/$defs/boolean_string' non_negative_integer_string: - description: see common.yaml#/definitions/non_negative_integer + description: see common.yaml#/$defs/non_negative_integer type: string pattern: '^[0-9]+$' @@ -20,11 +20,11 @@ definitions: additionalProperties: false properties: login_only: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' api_only: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' send_mail: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' default: login_only: '0' api_only: '0' @@ -52,7 +52,7 @@ definitions: default: clear_tokens: login_only DeactivateUser: - $ref: '#/definitions/ChangePassword' + $ref: '#/$defs/ChangePassword' ResetUserPassword: type: object additionalProperties: false @@ -64,7 +64,7 @@ definitions: - login_only - all send_mail: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' default: clear_tokens: login_only send_mail: '1' @@ -74,7 +74,7 @@ definitions: additionalProperties: false properties: send_mail: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' default: send_mail: '1' GetDeviceByAttribute: @@ -85,14 +85,14 @@ definitions: hostname: type: string mac: - $ref: common.yaml#/definitions/macaddr + $ref: common.yaml#/$defs/macaddr ipaddr: - $ref: common.yaml#/definitions/ipaddr + $ref: common.yaml#/$defs/ipaddr link: type: string format: uri propertyNames: - $ref: common.yaml#/definitions/device_setting_key + $ref: common.yaml#/$defs/device_setting_key additionalProperties: type: string GetValidationState: @@ -101,27 +101,27 @@ definitions: properties: status: oneOf: - - $ref: common.yaml#/definitions/validation_status + - $ref: common.yaml#/$defs/validation_status - type: array uniqueItems: true minItems: 2 items: - $ref: common.yaml#/definitions/validation_status + $ref: common.yaml#/$defs/validation_status SetPhase: type: object additionalProperties: false properties: rack_only: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' default: rack_only: '0' GetBuilds: type: object properties: started: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' completed: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' not: required: - started @@ -136,11 +136,11 @@ definitions: additionalProperties: true # overlays with other schemas properties: with_device_health: - $ref: '#/definitions/boolean_string_or_flag' + $ref: '#/$defs/boolean_string_or_flag' with_device_phases: - $ref: '#/definitions/boolean_string_or_flag' + $ref: '#/$defs/boolean_string_or_flag' with_rack_phases: - $ref: '#/definitions/boolean_string_or_flag' + $ref: '#/$defs/boolean_string_or_flag' FindDevice: type: object additionalProperties: true # may be used at the same time as other schemas @@ -148,33 +148,33 @@ definitions: phase_earlier_than: oneOf: - const: '' - - $ref: common.yaml#/definitions/device_phase + - $ref: common.yaml#/$defs/device_phase BuildDevices: type: object additionalProperties: true # may be used at the same time as other schemas properties: health: oneOf: - - $ref: common.yaml#/definitions/device_health + - $ref: common.yaml#/$defs/device_health - type: array uniqueItems: true minItems: 2 items: - $ref: common.yaml#/definitions/device_health + $ref: common.yaml#/$defs/device_health phase: oneOf: - - $ref: common.yaml#/definitions/device_phase + - $ref: common.yaml#/$defs/device_phase - type: array uniqueItems: true minItems: 2 items: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase active_minutes: - $ref: '#/definitions/non_negative_integer_string' + $ref: '#/$defs/non_negative_integer_string' ids_only: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' serials_only: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' allOf: - not: type: object @@ -196,14 +196,14 @@ definitions: properties: phase: oneOf: - - $ref: common.yaml#/definitions/device_phase + - $ref: common.yaml#/$defs/device_phase - type: array uniqueItems: true minItems: 2 items: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase ids_only: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' default: ids_only: '0' ProcessDeviceReport: @@ -211,7 +211,7 @@ definitions: additionalProperties: false properties: no_save_db: - $ref: '#/definitions/boolean_string' + $ref: '#/$defs/boolean_string' default: no_save_db: '0' HardwareProductSpecification: diff --git a/json-schema/request.yaml b/json-schema/request.yaml index d188f591e..cc144408a 100644 --- a/json-schema/request.yaml +++ b/json-schema/request.yaml @@ -1,6 +1,6 @@ --- $schema: 'http://json-schema.org/draft-07/schema#' -definitions: +$defs: Null: type: 'null' DatacenterCreate: @@ -12,26 +12,26 @@ definitions: - location properties: vendor: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string region: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string vendor_name: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string location: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string DatacenterUpdate: type: object additionalProperties: false minProperties: 1 properties: vendor: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string region: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string vendor_name: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string location: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string DatacenterRoomCreate: type: object additionalProperties: false @@ -42,28 +42,28 @@ definitions: - vendor_name properties: datacenter_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid az: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string alias: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder vendor_name: - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder DatacenterRoomUpdate: type: object additionalProperties: false minProperties: 1 properties: datacenter_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid az: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string alias: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder vendor_name: - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder DeviceReport: - $ref: device_report.yaml#/definitions/DeviceReport_v3_0_0 + $ref: device_report.yaml#/$defs/DeviceReport_v3_0_0 RackCreate: type: object additionalProperties: false @@ -74,46 +74,46 @@ definitions: - build_id properties: name: - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder datacenter_room_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_role_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid serial_number: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string asset_tag: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase build_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links RackUpdate: type: object additionalProperties: false minProperties: 1 properties: name: - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder datacenter_room_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_role_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid serial_number: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/non_empty_string + - $ref: common.yaml#/$defs/non_empty_string asset_tag: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/non_empty_string + - $ref: common.yaml#/$defs/non_empty_string phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase build_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links RackLinks: type: object additionalProperties: false @@ -122,18 +122,18 @@ definitions: properties: links: allOf: - - $ref: common.yaml#/definitions/links + - $ref: common.yaml#/$defs/links - minItems: 1 RackLinksOrNull: oneOf: - type: 'null' - - $ref: '#/definitions/BuildLinks' + - $ref: '#/$defs/BuildLinks' RackAssignmentUpdates: type: array uniqueItems: true minItems: 1 items: - $ref: '#/definitions/RackAssignmentUpdate' + $ref: '#/$defs/RackAssignmentUpdate' RackAssignmentUpdate: type: object additionalProperties: false @@ -146,21 +146,21 @@ definitions: - device_serial_number properties: device_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid device_serial_number: - $ref: common.yaml#/definitions/device_serial_number + $ref: common.yaml#/$defs/device_serial_number rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer device_asset_tag: oneOf: - - $ref: common.yaml#/definitions/device_asset_tag + - $ref: common.yaml#/$defs/device_asset_tag - type: 'null' RackAssignmentDeletes: type: array uniqueItems: true minItems: 1 items: - $ref: '#/definitions/RackAssignmentDelete' + $ref: '#/$defs/RackAssignmentDelete' RackAssignmentDelete: type: object additionalProperties: false @@ -169,9 +169,9 @@ definitions: - rack_unit_start properties: device_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer RackPhase: type: object additionalProperties: false @@ -179,7 +179,7 @@ definitions: - phase properties: phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase RackRoleCreate: type: object additionalProperties: false @@ -188,18 +188,18 @@ definitions: - rack_size properties: name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder rack_size: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer RackRoleUpdate: type: object additionalProperties: false minProperties: 1 properties: name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder rack_size: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer RackLayoutCreate: type: object additionalProperties: false @@ -209,11 +209,11 @@ definitions: - rack_unit_start properties: rack_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer RackLayouts: type: array uniqueItems: true @@ -225,18 +225,18 @@ definitions: - rack_unit_start properties: hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer RackLayoutUpdate: type: object additionalProperties: false minProperties: 1 properties: hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer DeviceLocationUpdate: type: object additionalProperties: false @@ -245,12 +245,12 @@ definitions: - rack_unit_start properties: rack_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer HardwareProductCreate: allOf: - - $ref: '#/definitions/HardwareProductUpdate' + - $ref: '#/$defs/HardwareProductUpdate' - required: - name - alias @@ -263,41 +263,41 @@ definitions: - cpu_type HardwareProductSpecification: # this is just a hack for the /hardware_product/*/specification endpoints - $ref: common.yaml#/definitions/HardwareProductSpecification + $ref: common.yaml#/$defs/HardwareProductSpecification HardwareProductUpdate: type: object additionalProperties: false minProperties: 1 properties: name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder alias: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder prefix: oneOf: - - $ref: common.yaml#/definitions/non_empty_string + - $ref: common.yaml#/$defs/non_empty_string - type: 'null' hardware_vendor_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid specification: oneOf: - - $ref: common.yaml#/definitions/HardwareProductSpecification + - $ref: common.yaml#/$defs/HardwareProductSpecification - type: 'null' sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder generation_name: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string legacy_product_name: oneOf: - - $ref: common.yaml#/definitions/non_empty_string + - $ref: common.yaml#/$defs/non_empty_string - type: 'null' rack_unit_size: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer validation_plan_id: $comment: this property will become nullable in v3.3 and removed in v4.0 deprecated: true allOf: - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid purpose: type: string bios_firmware: @@ -384,11 +384,11 @@ definitions: - email properties: user_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address password: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string set_session: type: boolean default: @@ -403,9 +403,9 @@ definitions: - email properties: user_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address UserPassword: type: object additionalProperties: false @@ -413,7 +413,7 @@ definitions: - password properties: password: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string NewUser: type: object additionalProperties: false @@ -422,11 +422,11 @@ definitions: - email properties: name: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address password: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string is_admin: type: boolean UpdateUser: @@ -435,23 +435,23 @@ definitions: minProperties: 1 properties: name: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address is_admin: type: boolean UserSetting: allOf: - - $ref: '#/definitions/UserSettings' + - $ref: '#/$defs/UserSettings' - type: object maxProperties: 1 UserSettings: type: object additionalProperties: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string minProperties: 1 propertyNames: - $ref: common.yaml#/definitions/user_setting_key + $ref: common.yaml#/$defs/user_setting_key NewUserToken: type: object additionalProperties: false @@ -459,7 +459,7 @@ definitions: - name properties: name: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string DeviceAssetTag: type: object additionalProperties: false @@ -468,7 +468,7 @@ definitions: properties: asset_tag: oneOf: - - $ref: common.yaml#/definitions/device_asset_tag + - $ref: common.yaml#/$defs/device_asset_tag - type: 'null' DevicePhase: type: object @@ -477,7 +477,7 @@ definitions: - phase properties: phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase DeviceLinks: type: object additionalProperties: false @@ -486,12 +486,12 @@ definitions: properties: links: allOf: - - $ref: common.yaml#/definitions/links + - $ref: common.yaml#/$defs/links - minItems: 1 DeviceLinksOrNull: oneOf: - type: 'null' - - $ref: '#/definitions/DeviceLinks' + - $ref: '#/$defs/DeviceLinks' DeviceBuild: type: object additionalProperties: false @@ -499,7 +499,7 @@ definitions: - build_id properties: build_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid DeviceHardware: type: object additionalProperties: false @@ -507,24 +507,24 @@ definitions: maxProperties: 1 properties: hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder DeviceSetting: allOf: - - $ref: '#/definitions/DeviceSettings' + - $ref: '#/$defs/DeviceSettings' - type: object maxProperties: 1 DeviceSettings: type: object additionalProperties: anyOf: - - $ref: common.yaml#/definitions/non_empty_string + - $ref: common.yaml#/$defs/non_empty_string - type: number - type: boolean minProperties: 1 propertyNames: - $ref: common.yaml#/definitions/device_setting_key + $ref: common.yaml#/$defs/device_setting_key RegisterRelay: type: object additionalProperties: false @@ -532,9 +532,9 @@ definitions: - serial properties: serial: - $ref: common.yaml#/definitions/relay_serial_number + $ref: common.yaml#/$defs/relay_serial_number name: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string version: description: usually a git commit SHA type: string @@ -542,7 +542,7 @@ definitions: description: 'postgres "inet": ipv4 or ipv6, with optional netmask' type: string ssh_port: - $ref: common.yaml#/definitions/non_negative_integer + $ref: common.yaml#/$defs/non_negative_integer OrganizationCreate: type: object additionalProperties: false @@ -551,9 +551,9 @@ definitions: - admins properties: name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string admins: type: array uniqueItems: true @@ -568,20 +568,20 @@ definitions: - email properties: user_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address OrganizationUpdate: type: object additionalProperties: false minProperties: 1 properties: name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/non_empty_string + - $ref: common.yaml#/$defs/non_empty_string OrganizationAddUser: type: object additionalProperties: false @@ -594,11 +594,11 @@ definitions: - email properties: user_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role BuildCreate: type: object additionalProperties: false @@ -611,9 +611,9 @@ definitions: - build_id properties: name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: - $ref: common.yaml#/definitions/non_empty_string + $ref: common.yaml#/$defs/non_empty_string started: type: string format: date-time @@ -631,24 +631,24 @@ definitions: - email properties: user_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address build_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links BuildUpdate: type: object additionalProperties: false minProperties: 1 properties: name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/non_empty_string + - $ref: common.yaml#/$defs/non_empty_string started: oneOf: - type: 'null' @@ -660,7 +660,7 @@ definitions: - type: string format: date-time links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links BuildLinks: type: object additionalProperties: false @@ -669,12 +669,12 @@ definitions: properties: links: allOf: - - $ref: common.yaml#/definitions/links + - $ref: common.yaml#/$defs/links - minItems: 1 BuildLinksOrNull: oneOf: - type: 'null' - - $ref: '#/definitions/BuildLinks' + - $ref: '#/$defs/BuildLinks' BuildAddUser: type: object additionalProperties: false @@ -687,11 +687,11 @@ definitions: - email properties: user_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role BuildAddOrganization: type: object additionalProperties: false @@ -700,9 +700,9 @@ definitions: - role properties: organization_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role BuildCreateDevices: type: array uniqueItems: true @@ -719,16 +719,16 @@ definitions: - serial_number properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid serial_number: - $ref: common.yaml#/definitions/device_serial_number + $ref: common.yaml#/$defs/device_serial_number asset_tag: oneOf: - - $ref: common.yaml#/definitions/device_asset_tag + - $ref: common.yaml#/$defs/device_asset_tag - type: 'null' sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links # vim: set sts=2 sw=2 et : diff --git a/json-schema/response.yaml b/json-schema/response.yaml index 2dd681b50..0bd6c3f41 100644 --- a/json-schema/response.yaml +++ b/json-schema/response.yaml @@ -1,6 +1,6 @@ --- $schema: 'http://json-schema.org/draft-07/schema#' -definitions: +$defs: Error: description: this is the superset of all error schemas type: object @@ -27,7 +27,7 @@ definitions: uniqueItems: true minItems: 1 items: - $ref: '#/definitions/JSONValidatorError' + $ref: '#/$defs/JSONValidatorError' schema: type: string format: uri-reference @@ -36,7 +36,7 @@ definitions: description: any supplementary details will be included here QueryParamsValidationError: allOf: - - $ref: '#/definitions/ValidationError' + - $ref: '#/$defs/ValidationError' - type: object required: - data @@ -59,7 +59,7 @@ definitions: type: string RequestValidationError: allOf: - - $ref: '#/definitions/ValidationError' + - $ref: '#/$defs/ValidationError' - type: object required: - error @@ -123,22 +123,22 @@ definitions: - latest_report properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid serial_number: - $ref: common.yaml#/definitions/device_serial_number + $ref: common.yaml#/$defs/device_serial_number asset_tag: oneOf: - - $ref: common.yaml#/definitions/device_asset_tag + - $ref: common.yaml#/$defs/device_asset_tag - type: 'null' created: type: string format: date-time hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder health: - $ref: common.yaml#/definitions/device_health + $ref: common.yaml#/$defs/device_health hostname: oneOf: - type: string @@ -151,7 +151,7 @@ definitions: system_uuid: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid updated: type: string format: date-time @@ -166,21 +166,21 @@ definitions: format: date-time - type: 'null' phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links build_id: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid build_name: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/mojo_standard_placeholder + - $ref: common.yaml#/$defs/mojo_standard_placeholder location: $comment: location is included only when device 'phase' is earlier than 'production' oneOf: - - $ref: '#/definitions/DeviceLocation' + - $ref: '#/$defs/DeviceLocation' - type: 'null' nics: # NOTE: see also DeviceNic $comment: nics is included only when device 'phase' is earlier than 'production' @@ -198,9 +198,9 @@ definitions: - peer_switch properties: mac: - $ref: common.yaml#/definitions/macaddr + $ref: common.yaml#/$defs/macaddr iface_name: - $ref: common.yaml#/definitions/device_interface_name + $ref: common.yaml#/$defs/device_interface_name iface_vendor: type: string iface_type: @@ -240,16 +240,16 @@ definitions: - updated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid serial_number: - $ref: common.yaml#/definitions/disk_serial_number + $ref: common.yaml#/$defs/disk_serial_number slot: oneOf: - - $ref: common.yaml#/definitions/non_negative_integer + - $ref: common.yaml#/$defs/non_negative_integer - type: 'null' size: oneOf: - - $ref: common.yaml#/definitions/non_negative_integer + - $ref: common.yaml#/$defs/non_negative_integer - type: 'null' vendor: oneOf: @@ -293,7 +293,7 @@ definitions: description: the contents of the device report. Given its age we cannot provide a schema. anyOf: - type: 'null' - - $ref: device_report.yaml#/definitions/DeviceReport_v3_0_0 + - $ref: device_report.yaml#/$defs/DeviceReport_v3_0_0 - type: object if: properties: @@ -320,17 +320,17 @@ definitions: type: array uniqueItems: true items: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid DeviceSerials: type: array uniqueItems: true items: - $ref: common.yaml#/definitions/device_serial_number + $ref: common.yaml#/$defs/device_serial_number Devices: type: array uniqueItems: true items: - $ref: '#/definitions/Device' + $ref: '#/$defs/Device' Device: type: object additionalProperties: false @@ -354,22 +354,22 @@ definitions: - build_name properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid serial_number: - $ref: common.yaml#/definitions/device_serial_number + $ref: common.yaml#/$defs/device_serial_number asset_tag: oneOf: - - $ref: common.yaml#/definitions/device_asset_tag + - $ref: common.yaml#/$defs/device_asset_tag - type: 'null' created: type: string format: date-time hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder health: - $ref: common.yaml#/definitions/device_health + $ref: common.yaml#/$defs/device_health hostname: oneOf: - type: string @@ -382,7 +382,7 @@ definitions: system_uuid: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid updated: type: string format: date-time @@ -397,29 +397,29 @@ definitions: format: date-time - type: 'null' phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links build_id: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid build_name: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/mojo_standard_placeholder + - $ref: common.yaml#/$defs/mojo_standard_placeholder rack_id: oneOf: - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid - type: 'null' rack_name: description: rack.full_rack_name (datacenter_room.vendor_name + ':' + rack.name) oneOf: - - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + - $ref: common.yaml#/$defs/mojo_relaxed_placeholder - type: 'null' rack_unit_start: oneOf: - - $ref: common.yaml#/definitions/positive_integer + - $ref: common.yaml#/$defs/positive_integer - type: 'null' if: properties: @@ -446,10 +446,10 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/DeviceNic' + $ref: '#/$defs/DeviceNic' DeviceNic: allOf: - - $ref: '#/definitions/DeviceNicFields' + - $ref: '#/$defs/DeviceNicFields' - type: object required: - device_id @@ -464,11 +464,11 @@ definitions: additionalProperties: false properties: device_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid mac: - $ref: common.yaml#/definitions/macaddr + $ref: common.yaml#/$defs/macaddr iface_name: - $ref: common.yaml#/definitions/device_interface_name + $ref: common.yaml#/$defs/device_interface_name iface_vendor: type: string iface_type: @@ -479,7 +479,7 @@ definitions: - type: 'null' ipaddr: oneOf: - - $ref: common.yaml#/definitions/ipaddr + - $ref: common.yaml#/$defs/ipaddr - type: 'null' mtu: oneOf: @@ -487,7 +487,7 @@ definitions: - type: 'null' DeviceNicField: allOf: - - $ref: '#/definitions/DeviceNicFields' + - $ref: '#/$defs/DeviceNicFields' - type: object minProperties: 1 maxProperties: 1 @@ -505,13 +505,13 @@ definitions: - pxe properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase location: oneOf: - type: 'null' - - $ref: '#/definitions/DeviceLocation' + - $ref: '#/$defs/DeviceLocation' ipmi: oneOf: - type: 'null' @@ -522,11 +522,11 @@ definitions: - ip properties: mac: - $ref: common.yaml#/definitions/macaddr + $ref: common.yaml#/$defs/macaddr ip: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/ipaddr + - $ref: common.yaml#/$defs/ipaddr pxe: oneOf: - type: 'null' @@ -536,7 +536,7 @@ definitions: - mac properties: mac: - $ref: common.yaml#/definitions/macaddr + $ref: common.yaml#/$defs/macaddr if: properties: phase: @@ -555,7 +555,7 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/DevicePXE' + $ref: '#/$defs/DevicePXE' DevicePhase: type: object additionalProperties: false @@ -564,9 +564,9 @@ definitions: - phase properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase DeviceSku: type: object additionalProperties: false @@ -576,11 +576,11 @@ definitions: - sku properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder DeviceLocation: type: object additionalProperties: false @@ -595,12 +595,12 @@ definitions: type: string datacenter_room: # description: datacenter_room.alias - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder rack: # description: rack.full_rack_name (datacenter_room.vendor_name + ':' + rack.name) - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer target_hardware_product: description: Details of the hardware product the device is expected to be based on its current position and the rack layout. type: object @@ -615,7 +615,7 @@ definitions: id: allOf: - description: hardware product ID - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid name: description: Hardware product name type: string @@ -623,18 +623,18 @@ definitions: description: Hardware product alias type: string sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder hardware_vendor_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid DeviceSetting: allOf: - - $ref: '#/definitions/DeviceSettings' + - $ref: '#/$defs/DeviceSettings' - type: object maxProperties: 1 DeviceSettings: type: object propertyNames: - $ref: common.yaml#/definitions/device_setting_key + $ref: common.yaml#/$defs/device_setting_key additionalProperties: type: string HardwareProducts: @@ -653,17 +653,17 @@ definitions: - updated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder alias: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder generation_name: oneOf: - type: string - type: 'null' sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder created: type: string format: date-time @@ -715,17 +715,17 @@ definitions: - usb_num properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder alias: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder prefix: oneOf: - type: string - type: 'null' hardware_vendor_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid generation_name: oneOf: - type: string @@ -735,13 +735,13 @@ definitions: - type: string - type: 'null' sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder specification: oneOf: - - $ref: common.yaml#/definitions/HardwareProductSpecification + - $ref: common.yaml#/$defs/HardwareProductSpecification - type: 'null' rack_unit_size: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer created: type: string format: date-time @@ -752,7 +752,7 @@ definitions: $comment: this property will become nullable in v3.3 and removed in v4.0 deprecated: true allOf: - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid bios_firmware: type: string cpu_num: @@ -833,7 +833,7 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/LegacyValidation' + $ref: '#/$defs/LegacyValidation' LegacyValidation: $comment: this definition will be removed in v4.0 deprecated: true @@ -849,11 +849,11 @@ definitions: - deactivated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder version: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer description: type: string created: @@ -873,7 +873,7 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/LegacyValidationPlan' + $ref: '#/$defs/LegacyValidationPlan' LegacyValidationPlan: $comment: this definition will be removed in v4.0 deprecated: true @@ -886,9 +886,9 @@ definitions: - created properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: type: string created: @@ -912,7 +912,7 @@ definitions: id: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid category: type: string component: @@ -926,20 +926,20 @@ definitions: message: type: string status: - $ref: common.yaml#/definitions/validation_status + $ref: common.yaml#/$defs/validation_status validation_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder version: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer description: type: string LegacyValidationResults: type: array uniqueItems: true items: - $ref: '#/definitions/LegacyValidationResult' + $ref: '#/$defs/LegacyValidationResult' ValidationStateWithResults: type: object additionalProperties: false @@ -953,23 +953,23 @@ definitions: - device_report_id properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid created: type: string format: date-time device_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid results: type: array uniqueItems: true items: - $ref: '#/definitions/LegacyValidationResult' + $ref: '#/$defs/LegacyValidationResult' status: - $ref: common.yaml#/definitions/validation_status + $ref: common.yaml#/$defs/validation_status hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid device_report_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid ReportValidationResults: type: object additionalProperties: false @@ -981,20 +981,20 @@ definitions: - results properties: device_serial_number: - $ref: common.yaml#/definitions/device_serial_number + $ref: common.yaml#/$defs/device_serial_number hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder status: - $ref: common.yaml#/definitions/validation_status + $ref: common.yaml#/$defs/validation_status results: - $ref: '#/definitions/LegacyValidationResults' + $ref: '#/$defs/LegacyValidationResults' Datacenters: type: array uniqueItems: true items: - $ref: '#/definitions/Datacenter' + $ref: '#/$defs/Datacenter' Datacenter: type: object additionalProperties: false @@ -1008,7 +1008,7 @@ definitions: - updated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid vendor: type: string vendor_name: @@ -1030,7 +1030,7 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/DatacenterRoomDetailed' + $ref: '#/$defs/DatacenterRoomDetailed' DatacenterRoomDetailed: type: object additionalProperties: false @@ -1044,16 +1044,16 @@ definitions: - updated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid az: type: string alias: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder vendor_name: # description: the vendor's name for the room - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder datacenter_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid created: type: string format: date-time @@ -1064,7 +1064,7 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/Relay' + $ref: '#/$defs/Relay' Relay: type: object additionalProperties: false @@ -1081,9 +1081,9 @@ definitions: - user_id properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid serial_number: - $ref: common.yaml#/definitions/relay_serial_number + $ref: common.yaml#/$defs/relay_serial_number name: oneOf: - type: string @@ -1093,11 +1093,11 @@ definitions: format: date-time ipaddr: oneOf: - - $ref: common.yaml#/definitions/ipaddr + - $ref: common.yaml#/$defs/ipaddr - type: 'null' ssh_port: oneOf: - - $ref: common.yaml#/definitions/non_negative_integer + - $ref: common.yaml#/$defs/non_negative_integer - type: 'null' updated: type: string @@ -1110,7 +1110,7 @@ definitions: - type: string - type: 'null' user_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid Version: type: object additionalProperties: false @@ -1123,7 +1123,7 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/Rack' + $ref: '#/$defs/Rack' Rack: type: object additionalProperties: false @@ -1145,30 +1145,30 @@ definitions: - links properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder full_rack_name: # description: rack.full_rack_name (datacenter_room.vendor_name + ':' + rack.name) - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder datacenter_room_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid datacenter_room_alias: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder rack_role_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_role_name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder serial_number: oneOf: - type: string - type: 'null' asset_tag: oneOf: - - $ref: common.yaml#/definitions/device_asset_tag + - $ref: common.yaml#/$defs/device_asset_tag - type: 'null' phase: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase created: type: string format: date-time @@ -1178,18 +1178,18 @@ definitions: build_id: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid build_name: oneOf: - type: 'null' - - $ref: common.yaml#/definitions/mojo_standard_placeholder + - $ref: common.yaml#/$defs/mojo_standard_placeholder links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links RackIds: type: array uniqueItems: true items: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid RackRole: type: object additionalProperties: false @@ -1201,11 +1201,11 @@ definitions: - updated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder rack_size: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer created: type: string format: date-time @@ -1216,12 +1216,12 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/RackRole' + $ref: '#/$defs/RackRole' RackLayouts: type: array uniqueItems: true items: - $ref: '#/definitions/RackLayout' + $ref: '#/$defs/RackLayout' RackLayout: type: object additionalProperties: false @@ -1237,20 +1237,20 @@ definitions: - updated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid rack_name: # description: rack.full_rack_name (datacenter_room.vendor_name + ':' + rack.name) - $ref: common.yaml#/definitions/mojo_relaxed_placeholder + $ref: common.yaml#/$defs/mojo_relaxed_placeholder hardware_product_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer rack_unit_size: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer created: type: string format: date-time @@ -1261,7 +1261,7 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/RackAssignment' + $ref: '#/$defs/RackAssignment' RackAssignment: type: object additionalProperties: false @@ -1276,24 +1276,24 @@ definitions: properties: device_id: oneOf: - - $ref: common.yaml#/definitions/uuid + - $ref: common.yaml#/$defs/uuid - type: 'null' device_serial_number: oneOf: - - $ref: common.yaml#/definitions/device_serial_number + - $ref: common.yaml#/$defs/device_serial_number - type: 'null' device_asset_tag: oneOf: - - $ref: common.yaml#/definitions/device_asset_tag + - $ref: common.yaml#/$defs/device_asset_tag - type: 'null' hardware_product_name: type: string sku: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder rack_unit_start: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer rack_unit_size: - $ref: common.yaml#/definitions/positive_integer + $ref: common.yaml#/$defs/positive_integer NewUser: type: object additionalProperties: false @@ -1303,9 +1303,9 @@ definitions: - name properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address name: type: string UserError: @@ -1328,9 +1328,9 @@ definitions: - deactivated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address name: type: string created: @@ -1358,11 +1358,11 @@ definitions: - builds properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: type: string email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address created: type: string format: date-time @@ -1395,15 +1395,15 @@ definitions: - role properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: 'null' - type: string role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role builds: type: array uniqueItems: true @@ -1417,17 +1417,17 @@ definitions: - role properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: string - type: 'null' role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role role_via_organization_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid Users: type: array uniqueItems: true @@ -1446,11 +1446,11 @@ definitions: - is_admin properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: type: string email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address created: type: string format: date-time @@ -1469,19 +1469,19 @@ definitions: UserSettings: type: object propertyNames: - $ref: common.yaml#/definitions/user_setting_key + $ref: common.yaml#/$defs/user_setting_key additionalProperties: type: string UserSetting: allOf: - - $ref: '#/definitions/UserSettings' + - $ref: '#/$defs/UserSettings' - type: object maxProperties: 1 UserTokens: type: array uniqueItems: true items: - $ref: '#/definitions/UserToken' + $ref: '#/$defs/UserToken' UserToken: type: object additionalProperties: false @@ -1507,7 +1507,7 @@ definitions: format: date-time last_ipaddr: oneOf: - - $ref: common.yaml#/definitions/ipaddr + - $ref: common.yaml#/$defs/ipaddr - type: 'null' NewUserToken: type: object @@ -1545,9 +1545,9 @@ definitions: - updated properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder created: type: string format: date-time @@ -1558,7 +1558,7 @@ definitions: type: array uniqueItems: true items: - $ref: '#/definitions/HardwareVendor' + $ref: '#/$defs/HardwareVendor' DeviceReportRow: type: object additionalProperties: false @@ -1569,9 +1569,9 @@ definitions: - created properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid device_id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid report: description: the contents of the device report. Given its age we cannot provide a schema. oneOf: @@ -1589,11 +1589,11 @@ definitions: - email properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: type: string email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address Organization: type: object additionalProperties: false @@ -1606,9 +1606,9 @@ definitions: - builds properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: 'null' @@ -1630,13 +1630,13 @@ definitions: - role properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: type: string email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role contains: type: object properties: @@ -1655,15 +1655,15 @@ definitions: - role properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: string - type: 'null' role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role Organizations: type: array uniqueItems: true @@ -1679,9 +1679,9 @@ definitions: - builds properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: 'null' @@ -1694,7 +1694,7 @@ definitions: uniqueItems: true minItems: 1 items: - $ref: '#/definitions/UserTerse' + $ref: '#/$defs/UserTerse' builds: type: array uniqueItems: true @@ -1708,15 +1708,15 @@ definitions: - role properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: string - type: 'null' role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role Build: type: object additionalProperties: false @@ -1733,9 +1733,9 @@ definitions: - links properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: 'null' @@ -1753,33 +1753,33 @@ definitions: uniqueItems: true minItems: 1 items: - $ref: '#/definitions/UserTerse' + $ref: '#/$defs/UserTerse' links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links device_health: type: object minProperties: 4 maxProperties: 4 propertyNames: - $ref: common.yaml#/definitions/device_health + $ref: common.yaml#/$defs/device_health additionalProperties: - $ref: common.yaml#/definitions/non_negative_integer + $ref: common.yaml#/$defs/non_negative_integer device_phases: type: object minProperties: 5 maxProperties: 5 propertyNames: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase additionalProperties: - $ref: common.yaml#/definitions/non_negative_integer + $ref: common.yaml#/$defs/non_negative_integer rack_phases: type: object minProperties: 5 maxProperties: 5 propertyNames: - $ref: common.yaml#/definitions/device_phase + $ref: common.yaml#/$defs/device_phase additionalProperties: - $ref: common.yaml#/definitions/non_negative_integer + $ref: common.yaml#/$defs/non_negative_integer completed: true completed_user: true completed_status: true @@ -1799,7 +1799,7 @@ definitions: type: string format: date-time completed_user: - $ref: '#/definitions/UserTerse' + $ref: '#/$defs/UserTerse' completed_status: enum: [ 'failure', 'success' ] Builds: @@ -1819,9 +1819,9 @@ definitions: - links properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: - $ref: common.yaml#/definitions/mojo_standard_placeholder + $ref: common.yaml#/$defs/mojo_standard_placeholder description: oneOf: - type: 'null' @@ -1835,7 +1835,7 @@ definitions: - type: string format: date-time links: - $ref: common.yaml#/definitions/links + $ref: common.yaml#/$defs/links completed: true completed_status: true if: @@ -1867,13 +1867,13 @@ definitions: - role properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: type: string email: - $ref: common.yaml#/definitions/email_address + $ref: common.yaml#/$defs/email_address role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role contains: type: object properties: @@ -1893,7 +1893,7 @@ definitions: - admins properties: id: - $ref: common.yaml#/definitions/uuid + $ref: common.yaml#/$defs/uuid name: type: string description: @@ -1901,12 +1901,12 @@ definitions: - type: 'null' - type: string role: - $ref: common.yaml#/definitions/role + $ref: common.yaml#/$defs/role admins: type: array uniqueItems: true minItems: 1 items: - $ref: '#/definitions/UserTerse' + $ref: '#/$defs/UserTerse' # vim: set sts=2 sw=2 et : diff --git a/lib/Conch/Controller/HardwareProduct.pm b/lib/Conch/Controller/HardwareProduct.pm index 8f921b974..791f1fa7a 100644 --- a/lib/Conch/Controller/HardwareProduct.pm +++ b/lib/Conch/Controller/HardwareProduct.pm @@ -188,7 +188,7 @@ C property to operate on. New data is written, and existing data without regard to type (so long as it conforms to the schema). After the update operation, the C property must validate against -F. +F. =cut @@ -233,7 +233,7 @@ Uses the URI query parameter C as a json pointer to determine the path wit C property to operate on. All of the data at the indicated path is deleted. After the delete operation, the C property must validate against -F. +F. =cut diff --git a/lib/Conch/Controller/JSONSchema.pm b/lib/Conch/Controller/JSONSchema.pm index adaee8cd3..44b687fad 100644 --- a/lib/Conch/Controller/JSONSchema.pm +++ b/lib/Conch/Controller/JSONSchema.pm @@ -55,14 +55,14 @@ sub get ($c) { =head2 _extract_schema_definition Given a L object containing a schema definition, extract the requested portion -out of the "definitions" section, including any named references, and add some standard +out of the C<$defs> section, including any named references, and add some standard headers. TODO: this (plus addition of the header fields) could mostly be replaced with just: my $new_defs = $jv->bundle({ - schema => $jv->get('/definitions/'.$name), - ref_key => 'definitions', + schema => $jv->get('/$defs/'.$name), + ref_key => '$defs', }); ..except circular refs are not handled there, and the definition renaming leaks local path info. @@ -70,7 +70,7 @@ TODO: this (plus addition of the header fields) could mostly be replaced with ju =cut sub _extract_schema_definition ($validator, $schema_name) { - my $top_schema = $validator->schema->get('/definitions/'.$schema_name); + my $top_schema = $validator->schema->get('/$defs/'.$schema_name); return if not $top_schema; my %refs; @@ -81,12 +81,12 @@ sub _extract_schema_definition ($validator, $schema_name) { if (ref $from eq 'HASH' and my $tied = tied %$from) { # this is a hashref which quacks like { '$ref' => $target } my ($location, $path) = split /#/, $tied->fqn, 2; - (my $name = $path) =~ s!^/definitions/!!; + (my $name = $path) =~ s!^/\$defs/!!; if (not $refs{$tied->fqn}++) { # TODO: use a heuristic to find a new name for the conflicting definition if ($name ne $schema_name and exists $source{$name}) { - die 'namespace collision: '.$tied->fqn.' but already have a /definitions/'.$name + die 'namespace collision: '.$tied->fqn.' but already have a /$defs/'.$name .' from '.$source{$name}->fqn; } @@ -95,7 +95,7 @@ sub _extract_schema_definition ($validator, $schema_name) { } ++$refs{'/traversed_definitions/'.$name}; - tie my %ref, 'JSON::Validator::Ref', $tied->schema, '#/definitions/'.$name; + tie my %ref, 'JSON::Validator::Ref', $tied->schema, '#/$defs/'.$name; return \%ref; } @@ -118,7 +118,7 @@ sub _extract_schema_definition ($validator, $schema_name) { # cannot return a $ref at the top level (sibling keys disallowed) - inline the $ref. while (my $tied = tied %$target) { - (my $name = $tied->fqn) =~ s!^#/definitions/!!; + (my $name = $tied->fqn) =~ s!^#/\$defs/!!; $target = $definitions->{$name}; delete $definitions->{$name} if $refs{'/traversed_definitions/'.$name} == 1; } @@ -126,7 +126,7 @@ sub _extract_schema_definition ($validator, $schema_name) { return { '$schema' => $validator->get('/$schema') || 'http://json-schema.org/draft-07/schema#', # no $id - we have no idea of this document's canonical location - keys $definitions->%* ? ( definitions => $definitions ) : (), + keys $definitions->%* ? ( '$defs' => $definitions ) : (), $target->%*, }; } diff --git a/lib/Conch/DB/ResultSet/Device.pm b/lib/Conch/DB/ResultSet/Device.pm index 262e5f88e..9d4a6c981 100644 --- a/lib/Conch/DB/ResultSet/Device.pm +++ b/lib/Conch/DB/ResultSet/Device.pm @@ -210,7 +210,7 @@ sub with_build_name ($self) { =head2 location_data -Returns a resultset that provides location data (F), +Returns a resultset that provides location data (F), optionally returned under a hash using the provided key name. =cut diff --git a/lib/Conch/Plugin/JSONValidator.pm b/lib/Conch/Plugin/JSONValidator.pm index c5cd57fb8..49e115f9d 100644 --- a/lib/Conch/Plugin/JSONValidator.pm +++ b/lib/Conch/Plugin/JSONValidator.pm @@ -54,7 +54,7 @@ appearing once are scalars, parameters appearing more than once have their value arrayref). On success, returns the validated data; on failure, an HTTP 400 response is prepared, using the -F json response schema. +F json response schema. Population of missing data from specified defaults is performed. @@ -62,7 +62,7 @@ Population of missing data from specified defaults is performed. $app->helper(validate_query_params => sub ($c, $schema_name, $data = $c->req->query_params->to_hash) { my $validator = $c->get_query_params_validator; - my $schema = $validator->get('/definitions/'.$schema_name); + my $schema = $validator->get('/$defs/'.$schema_name); if (not $schema) { Mojo::Exception->throw("unable to locate query_params schema $schema_name"); @@ -93,13 +93,13 @@ Given the name of a json schema in the request namespace, validate the provided it (defaulting to the request's json payload). On success, returns the validated payload data; on failure, an HTTP 400 response is prepared, -using the F json response schema. +using the F json response schema. =cut $app->helper(validate_request => sub ($c, $schema_name, $data = $c->req->json) { my $validator = $c->get_request_validator; - my $schema = $validator->get('/definitions/'.$schema_name); + my $schema = $validator->get('/$defs/'.$schema_name); if (not $schema) { Mojo::Exception->throw("unable to locate request schema $schema_name"); diff --git a/lib/Conch/Plugin/Rollbar.pm b/lib/Conch/Plugin/Rollbar.pm index 00a7f8cea..ba1696025 100644 --- a/lib/Conch/Plugin/Rollbar.pm +++ b/lib/Conch/Plugin/Rollbar.pm @@ -270,7 +270,7 @@ sub _create_notifier ($app, $config) { my $validator = JSON::Validator->new->load_and_validate_schema( 'json-schema/other.yaml', { schema => 'http://json-schema.org/draft-07/schema#' }); - my $schema = $validator->get('/definitions/RollbarPayload'); + my $schema = $validator->get('/$defs/RollbarPayload'); if (my @errors = $validator->validate($tx->req->json, $schema)) { require Data::Dumper; Carp::croak('validation error: ' diff --git a/lib/Conch/Route.pm b/lib/Conch/Route.pm index 184427013..ad2b1df0c 100644 --- a/lib/Conch/Route.pm +++ b/lib/Conch/Route.pm @@ -199,11 +199,11 @@ Error responses will use: =over -=item * failure to validate query parameters: HTTP 400, F +=item * failure to validate query parameters: HTTP 400, F -=item * failure to validate request body payload: HTTP 400, F +=item * failure to validate request body payload: HTTP 400, F -=item * all other errors, unless specified: HTTP 4xx, F +=item * all other errors, unless specified: HTTP 4xx, F =back @@ -213,7 +213,7 @@ Error responses will use: =item * Does not require authentication. -=item * Response: F +=item * Response: F =back @@ -223,7 +223,7 @@ Error responses will use: =item * Does not require authentication. -=item * Response: F +=item * Response: F =back @@ -233,9 +233,9 @@ Error responses will use: =item * Controller/Action: L -=item * Request: F +=item * Request: F -=item * Response: F +=item * Response: F =back @@ -245,7 +245,7 @@ Error responses will use: =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -257,9 +257,9 @@ Error responses will use: =item * Controller/Action: L -=item * Request: F +=item * Request: F -=item * Response: F +=item * Response: F =back diff --git a/lib/Conch/Route/Build.pm b/lib/Conch/Route/Build.pm index 43972931a..3dece1df5 100644 --- a/lib/Conch/Route/Build.pm +++ b/lib/Conch/Route/Build.pm @@ -134,7 +134,7 @@ Supports the following optional query parameters: =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -146,7 +146,7 @@ Supports the following optional query parameters: =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the build @@ -172,7 +172,7 @@ Supports the following optional query parameters: =item * Requires system admin authorization or the read-only role on the build -=item * Response: F +=item * Response: F =back @@ -184,7 +184,7 @@ Supports the following optional query parameters: =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the build @@ -198,7 +198,7 @@ Supports the following optional query parameters: =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated build @@ -210,7 +210,7 @@ Supports the following optional query parameters: =item * Requires system admin authorization or the admin role on the build -=item * Request: F +=item * Request: F =item * Response: 204 NO CONTENT @@ -224,7 +224,7 @@ Supports the following optional query parameters: =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -239,7 +239,7 @@ an email to the user. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -268,7 +268,7 @@ an email to the user. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -283,7 +283,7 @@ an email to the organization members and build admins. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -328,7 +328,7 @@ Accepts the following optional query parameters: =item * Controller/Action: L -=item * Response: one of F, F or F +=item * Response: one of F, F or F =back @@ -340,7 +340,7 @@ Accepts the following optional query parameters: =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -354,7 +354,7 @@ L) =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -405,7 +405,7 @@ read-only role on a build that contains the rack =item * Controller/Action: L -=item * Response: one of F or F +=item * Response: one of F or F =back diff --git a/lib/Conch/Route/Datacenter.pm b/lib/Conch/Route/Datacenter.pm index 72cdb215f..c52a501d3 100644 --- a/lib/Conch/Route/Datacenter.pm +++ b/lib/Conch/Route/Datacenter.pm @@ -56,7 +56,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -68,7 +68,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<201 Created> or C<204 No Content>, plus Location header @@ -82,7 +82,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -94,7 +94,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated datacenter @@ -120,7 +120,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back diff --git a/lib/Conch/Route/DatacenterRoom.pm b/lib/Conch/Route/DatacenterRoom.pm index 6bbf5261b..b5149d730 100644 --- a/lib/Conch/Route/DatacenterRoom.pm +++ b/lib/Conch/Route/DatacenterRoom.pm @@ -85,7 +85,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -97,7 +97,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the created room @@ -112,7 +112,7 @@ the room =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -124,7 +124,7 @@ the room =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated room @@ -151,7 +151,7 @@ the room (in which case data returned is restricted to those racks) =item * Controller/Action: L -=item * Response: F +=item * Response: F =back diff --git a/lib/Conch/Route/Device.pm b/lib/Conch/Route/Device.pm index db2419e5b..bf6059018 100644 --- a/lib/Conch/Route/Device.pm +++ b/lib/Conch/Route/Device.pm @@ -163,7 +163,7 @@ below. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -175,7 +175,7 @@ below. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -187,7 +187,7 @@ below. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -199,7 +199,7 @@ below. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -211,7 +211,7 @@ below. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -223,7 +223,7 @@ below. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated device @@ -237,7 +237,7 @@ below. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated device @@ -251,7 +251,7 @@ below. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated device @@ -265,7 +265,7 @@ below. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated device @@ -279,7 +279,7 @@ below. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: 204 No Content @@ -293,7 +293,7 @@ below. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated device @@ -309,7 +309,7 @@ below. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated device @@ -323,7 +323,7 @@ below. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -335,7 +335,7 @@ below. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated device @@ -361,7 +361,7 @@ below. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -374,7 +374,7 @@ settings that do not start with C. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -388,7 +388,7 @@ settings that do not start with C. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -401,7 +401,7 @@ settings that do not start with C. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -432,9 +432,9 @@ This endpoint is B and will be removed in Conch API v4.0. =item * Controller/Action: L -=item * Request: F +=item * Request: F -=item * Response: F +=item * Response: F =back @@ -450,9 +450,9 @@ This endpoint is B and will be removed in Conch API v4.0. =item * Controller/Action: L -=item * Request: F +=item * Request: F -=item * Response: F +=item * Response: F =back @@ -467,7 +467,7 @@ to search for (one of C, C, C). Can be used more than once. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -479,7 +479,7 @@ to search for (one of C, C, C). Can be used more than once. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -491,7 +491,7 @@ to search for (one of C, C, C). Can be used more than once. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -503,7 +503,7 @@ to search for (one of C, C, C). Can be used more than once. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back diff --git a/lib/Conch/Route/DeviceReport.pm b/lib/Conch/Route/DeviceReport.pm index 1eb4def9a..ea07fd5cb 100644 --- a/lib/Conch/Route/DeviceReport.pm +++ b/lib/Conch/Route/DeviceReport.pm @@ -59,7 +59,7 @@ report submission (as indicated via C<#/relay/serial> in the report). =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<201 Created>, plus Location header @@ -74,9 +74,9 @@ only validations will be run. =item * Controller/Action: L -=item * Request: F +=item * Request: F -=item * Response: F +=item * Response: F =back @@ -88,7 +88,7 @@ only validations will be run. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back diff --git a/lib/Conch/Route/HardwareProduct.pm b/lib/Conch/Route/HardwareProduct.pm index 914541680..5a96d2908 100644 --- a/lib/Conch/Route/HardwareProduct.pm +++ b/lib/Conch/Route/HardwareProduct.pm @@ -74,7 +74,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -86,7 +86,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the created hardware product @@ -100,7 +100,7 @@ Identifiers accepted: C, C, C and C. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -116,7 +116,7 @@ Identifiers accepted: C, C, C and C. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated hardware product @@ -167,7 +167,7 @@ Results in this data in C, changing the data type at node C =item * Request: after the update operation, the C property must validate against -F. +F. =item * Response: C<204 No Content> @@ -180,7 +180,7 @@ parameter C as the JSON pointer to the data to be removed. All other prope blob are left untouched. After the delete operation, the C property must validate against -F. +F. =over 4 diff --git a/lib/Conch/Route/HardwareVendor.pm b/lib/Conch/Route/HardwareVendor.pm index fcf0e45b8..8d02fcef2 100644 --- a/lib/Conch/Route/HardwareVendor.pm +++ b/lib/Conch/Route/HardwareVendor.pm @@ -55,7 +55,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -65,7 +65,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -89,7 +89,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the created hardware vendor diff --git a/lib/Conch/Route/Organization.pm b/lib/Conch/Route/Organization.pm index f1419cd5b..d65e9576c 100644 --- a/lib/Conch/Route/Organization.pm +++ b/lib/Conch/Route/Organization.pm @@ -67,7 +67,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -79,7 +79,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the organization @@ -93,7 +93,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -105,7 +105,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the organization @@ -134,7 +134,7 @@ an email to the user. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> diff --git a/lib/Conch/Route/Rack.pm b/lib/Conch/Route/Rack.pm index 87d6371bd..486b947cf 100644 --- a/lib/Conch/Route/Rack.pm +++ b/lib/Conch/Route/Rack.pm @@ -114,7 +114,7 @@ C. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the created rack @@ -128,7 +128,7 @@ C. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -140,7 +140,7 @@ C. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated rack @@ -166,7 +166,7 @@ C. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -178,7 +178,7 @@ C. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the rack's layouts @@ -192,7 +192,7 @@ C. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -204,7 +204,7 @@ C. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated rack assignment @@ -220,7 +220,7 @@ This method requires a request body. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -237,7 +237,7 @@ only the rack's phase, or all the rack's devices' phases as well. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated rack @@ -251,7 +251,7 @@ only the rack's phase, or all the rack's devices' phases as well. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated rack @@ -263,7 +263,7 @@ only the rack's phase, or all the rack's devices' phases as well. =item * User requires the read/write role on the rack -=item * Request: F +=item * Request: F =item * Response: 204 NO CONTENT diff --git a/lib/Conch/Route/RackLayout.pm b/lib/Conch/Route/RackLayout.pm index 859528e9d..0643b7072 100644 --- a/lib/Conch/Route/RackLayout.pm +++ b/lib/Conch/Route/RackLayout.pm @@ -72,7 +72,7 @@ C -=item * Response: F +=item * Response: F =back @@ -84,7 +84,7 @@ C -=item * Request: F +=item * Request: F =item * Response: Redirect to the created rack layout @@ -98,7 +98,7 @@ C -=item * Response: F +=item * Response: F =back @@ -110,7 +110,7 @@ C -=item * Request: F +=item * Request: F =item * Response: Redirect to the update rack layout diff --git a/lib/Conch/Route/RackRole.pm b/lib/Conch/Route/RackRole.pm index 15e2d4464..268f5302d 100644 --- a/lib/Conch/Route/RackRole.pm +++ b/lib/Conch/Route/RackRole.pm @@ -52,7 +52,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -64,7 +64,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the created rack role @@ -76,7 +76,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -88,7 +88,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: Redirect to the updated rack role diff --git a/lib/Conch/Route/Relay.pm b/lib/Conch/Route/Relay.pm index c497dd805..13634af6c 100644 --- a/lib/Conch/Route/Relay.pm +++ b/lib/Conch/Route/Relay.pm @@ -52,7 +52,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<201 Created> or C<204 No Content>, plus Location header @@ -66,7 +66,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -78,7 +78,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back diff --git a/lib/Conch/Route/User.pm b/lib/Conch/Route/User.pm index d454d6261..94867078c 100644 --- a/lib/Conch/Route/User.pm +++ b/lib/Conch/Route/User.pm @@ -138,7 +138,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -151,11 +151,11 @@ an email telling the user their account was updated =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Success Response: Redirect to the user that was updated -=item * Error response on duplicate user: F (only if the +=item * Error response on duplicate user: F (only if the calling user is a system admin) =back @@ -181,7 +181,7 @@ C and C cannot both be C<1>. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -209,7 +209,7 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -222,7 +222,7 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -232,7 +232,7 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -244,7 +244,7 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -254,7 +254,7 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Response: C<204 No Content> @@ -276,7 +276,7 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -286,9 +286,9 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Request: F +=item * Request: F -=item * Response: F +=item * Response: F =back @@ -298,7 +298,7 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -320,7 +320,7 @@ otherwise, the user is logged out. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -335,11 +335,11 @@ an email telling the user their account was updated =item * Controller/Action: L -=item * Request: F +=item * Request: F =item * Success Response: Redirect to the user that was updated -=item * Error response on duplicate user: F (only if the +=item * Error response on duplicate user: F (only if the calling user is a system admin) =back @@ -427,7 +427,7 @@ Optionally accepts the following query parameters: =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -442,11 +442,11 @@ email to the user with the new password. =item * Controller/Action: L -=item * Request: F +=item * Request: F -=item * Success Response: F +=item * Success Response: F -=item * Error response on duplicate user: F +=item * Error response on duplicate user: F =back @@ -458,7 +458,7 @@ email to the user with the new password. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -470,7 +470,7 @@ email to the user with the new password. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -484,7 +484,7 @@ email to the user with the new password. =item * Success Response: C<204 No Content> -=item * Error response when user already deactivated: F +=item * Error response when user already deactivated: F =back diff --git a/lib/Conch/Route/ValidationPlan.pm b/lib/Conch/Route/ValidationPlan.pm index fd0b80c16..91f4353b3 100644 --- a/lib/Conch/Route/ValidationPlan.pm +++ b/lib/Conch/Route/ValidationPlan.pm @@ -53,7 +53,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -63,7 +63,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back @@ -73,7 +73,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back diff --git a/lib/Conch/Route/ValidationState.pm b/lib/Conch/Route/ValidationState.pm index 8ed381fa9..97c486f02 100644 --- a/lib/Conch/Route/ValidationState.pm +++ b/lib/Conch/Route/ValidationState.pm @@ -41,7 +41,7 @@ All routes require authentication. =item * Controller/Action: L -=item * Response: F +=item * Response: F =back diff --git a/lib/Test/Conch.pm b/lib/Test/Conch.pm index 75f983852..10822528d 100644 --- a/lib/Test/Conch.pm +++ b/lib/Test/Conch.pm @@ -327,7 +327,7 @@ sub location_like ($self, $pattern, $desc = 'location header') { =head2 json_schema_is Validates the JSON response of the most recent request. If given a string that looks like a URL, -fetches that URL; otherwise if a string, looks up the schema in C<#/definitions> in the JSON Schema +fetches that URL; otherwise if a string, looks up the schema in C<#/$defs> in the JSON Schema response specification document to validate. If given a hash, uses the hash as the schema to validate. @@ -353,7 +353,7 @@ sub json_schema_is ($self, $schema, $message = undef) { else { $schema_name = $schema; $validator = $self->validator; - $schema = $validator->get('/definitions/'.$schema_name) + $schema = $validator->get('/$defs/'.$schema_name) or die "schema '$schema_name' not found"; } diff --git a/misc/extract-schema b/misc/extract-schema index dc2f29d2d..10023aa2c 100755 --- a/misc/extract-schema +++ b/misc/extract-schema @@ -40,7 +40,7 @@ my $validator = JSON::Validator->new; # TODO: do not pass 'schema' arg - just depend on JV $validator->load_and_validate_schema($schema_file, { schema => 'http://json-schema.org/draft-07/schema#' }); -for my $schema_name (sort keys $validator->schema->data->{definitions}->%*) { +for my $schema_name (sort keys $validator->schema->data->{'$defs'}->%*) { my $schema = Conch::Controller::JSONSchema::_extract_schema_definition($validator, $schema_name); output_json_schema($schema_name, $schema); } diff --git a/t/data/test-schema.yaml b/t/data/test-schema.yaml index f27c614da..3bdc1c1b7 100644 --- a/t/data/test-schema.yaml +++ b/t/data/test-schema.yaml @@ -1,10 +1,10 @@ --- $schema: http://json-schema.org/draft-07/schema# -definitions: +$defs: ref1: type: array items: - $ref: "#/definitions/ref2" + $ref: "#/$defs/ref2" ref2: type: string minLength: 1 @@ -16,9 +16,9 @@ definitions: type: object properties: my_key1: - $ref: "#/definitions/ref1" + $ref: "#/$defs/ref1" my_key2: - $ref: "#/definitions/ref1" + $ref: "#/$defs/ref1" # actually a person, as in https://json-schema.org/understanding-json-schema/structuring.html i_have_a_recursive_ref: type: object @@ -28,39 +28,39 @@ definitions: children: type: array items: - $ref: "#/definitions/i_have_a_recursive_ref" + $ref: "#/$defs/i_have_a_recursive_ref" default: [] i_have_a_ref_to_another_file: type: object properties: name: - $ref: test-schema2.yaml#/definitions/my_name + $ref: test-schema2.yaml#/$defs/my_name address: - $ref: test-schema2.yaml#/definitions/my_address + $ref: test-schema2.yaml#/$defs/my_address secrets: - $ref: "#/definitions/ref1" + $ref: "#/$defs/ref1" i_am_a_ref: - $ref: "#/definitions/ref1" + $ref: "#/$defs/ref1" i_am_a_ref_level_1: - $ref: "#/definitions/i_am_a_ref_level_2" + $ref: "#/$defs/i_am_a_ref_level_2" i_am_a_ref_level_2: - $ref: "#/definitions/ref3" + $ref: "#/$defs/ref3" i_am_a_ref_to_another_file: - $ref: test-schema2.yaml#/definitions/i_have_a_ref_to_the_first_filename + $ref: test-schema2.yaml#/$defs/i_have_a_ref_to_the_first_filename i_am_a_ref_with_the_same_name: - $ref: test-schema2.yaml#/definitions/i_am_a_ref_with_the_same_name + $ref: test-schema2.yaml#/$defs/i_am_a_ref_with_the_same_name i_have_refs_with_the_same_name: type: object properties: me: - $ref: "#/definitions/i_am_a_ref_with_the_same_name" + $ref: "#/$defs/i_am_a_ref_with_the_same_name" i_contain_refs_to_same_named_definitions: type: object properties: foo: - $ref: "#/definitions/dupe_name" + $ref: "#/$defs/dupe_name" bar: - $ref: test-schema2.yaml#/definitions/dupe_name + $ref: test-schema2.yaml#/$defs/dupe_name i_have_a_ref_with_the_same_name: type: object properties: @@ -69,7 +69,7 @@ definitions: children: type: array items: - $ref: test-schema2.yaml#/definitions/i_have_a_ref_with_the_same_name + $ref: test-schema2.yaml#/$defs/i_have_a_ref_with_the_same_name default: [] # vim: set sts=2 sw=2 et : diff --git a/t/data/test-schema2.yaml b/t/data/test-schema2.yaml index e66e6137a..244a2a501 100644 --- a/t/data/test-schema2.yaml +++ b/t/data/test-schema2.yaml @@ -1,6 +1,6 @@ --- $schema: http://json-schema.org/draft-07/schema# -definitions: +$defs: my_name: type: string minLength: 2 @@ -11,7 +11,7 @@ definitions: type: string city: # this is a local ref in a secondary file - resolution is extra tricky - $ref: "#/definitions/my_name" + $ref: "#/$defs/my_name" dupe_name: type: string i_am_a_ref_with_the_same_name: @@ -20,7 +20,7 @@ definitions: type: object properties: gotcha: - $ref: test-schema.yaml#/definitions/ref3 + $ref: test-schema.yaml#/$defs/ref3 i_have_a_ref_with_the_same_name: type: string diff --git a/t/integration/crud/devices.t b/t/integration/crud/devices.t index 22752dd0d..eed327d05 100644 --- a/t/integration/crud/devices.t +++ b/t/integration/crud/devices.t @@ -203,7 +203,7 @@ subtest 'unlocated device with a registered relay' => sub { do { my %_data = $test_device_data->%*; delete $_data{location}; %_data }, phase => 'integration', }, - $t->validator->get('/definitions/DetailedDevice')) ], + $t->validator->get('/$defs/DetailedDevice')) ], [ methods( path => '/location', @@ -216,7 +216,7 @@ subtest 'unlocated device with a registered relay' => sub { cmp_deeply( [ $t->validator->validate( { $test_device_data->%*, phase => 'production' }, - $t->validator->get('/definitions/DetailedDevice')) ], + $t->validator->get('/$defs/DetailedDevice')) ], [ methods( path => '/', diff --git a/t/integration/json_schema-unauthed.t b/t/integration/json_schema-unauthed.t index 99365e56a..7d804e1c7 100644 --- a/t/integration/json_schema-unauthed.t +++ b/t/integration/json_schema-unauthed.t @@ -22,11 +22,11 @@ subtest 'extraction with $refs' => sub { title => 'i_have_nested_refs', '$schema' => 'http://json-schema.org/draft-07/schema#', # begin all referenced definitions - definitions => { + '$defs' => { ref1 => { type => 'array', items => { - '$ref' => '#/definitions/ref2', + '$ref' => '#/$defs/ref2', }, }, ref2 => { @@ -38,10 +38,10 @@ subtest 'extraction with $refs' => sub { type => 'object', properties => { my_key1 => { - '$ref' => '#/definitions/ref1', + '$ref' => '#/$defs/ref1', }, my_key2 => { - '$ref' => '#/definitions/ref1', + '$ref' => '#/$defs/ref1', }, }, }, @@ -53,14 +53,14 @@ subtest 'extraction with $refs' => sub { title => 'i_have_a_recursive_ref', '$schema' => 'http://json-schema.org/draft-07/schema#', # begin all referenced definitions - definitions => { + '$defs' => { i_have_a_recursive_ref => { type => 'object', properties => { name => { type => 'string' }, children => { type => 'array', - items => { '$ref' => '#/definitions/i_have_a_recursive_ref' }, + items => { '$ref' => '#/$defs/i_have_a_recursive_ref' }, default => [], }, }, @@ -74,7 +74,7 @@ subtest 'extraction with $refs' => sub { name => { type => 'string' }, children => { type => 'array', - items => { '$ref' => '#/definitions/i_have_a_recursive_ref' }, + items => { '$ref' => '#/$defs/i_have_a_recursive_ref' }, default => [], }, }, @@ -87,7 +87,7 @@ subtest 'extraction with $refs' => sub { title => 'i_have_a_ref_to_another_file', '$schema' => 'http://json-schema.org/draft-07/schema#', # begin all referenced definitions - definitions => { + '$defs' => { my_name => { type => 'string', minLength => 2, @@ -99,14 +99,14 @@ subtest 'extraction with $refs' => sub { type => 'string', }, city => { - '$ref' => '#/definitions/my_name', + '$ref' => '#/$defs/my_name', }, }, }, ref1 => { type => 'array', items => { - '$ref' => '#/definitions/ref2', + '$ref' => '#/$defs/ref2', }, }, ref2 => { @@ -118,9 +118,9 @@ subtest 'extraction with $refs' => sub { type => 'object', properties => { # these ref targets are rewritten - name => { '$ref' => '#/definitions/my_name' }, - address => { '$ref' => '#/definitions/my_address' }, - secrets => { '$ref' => '#/definitions/ref1' }, + name => { '$ref' => '#/$defs/my_name' }, + address => { '$ref' => '#/$defs/my_address' }, + secrets => { '$ref' => '#/$defs/ref1' }, }, }, 'find and resolve references to other local files', @@ -131,7 +131,7 @@ subtest 'extraction with $refs' => sub { title => 'i_am_a_ref', '$schema' => 'http://json-schema.org/draft-07/schema#', # begin all referenced definitions - definitions => { + '$defs' => { ref2 => { type => 'string', minLength => 1, @@ -140,7 +140,7 @@ subtest 'extraction with $refs' => sub { # begin i_am_a_ref definition - which is actually ref1 type => 'array', items => { - '$ref' => '#/definitions/ref2', + '$ref' => '#/$defs/ref2', }, }, 'find and resolve references where the definition itself is a ref', @@ -161,7 +161,7 @@ subtest 'extraction with $refs' => sub { title => 'i_have_refs_with_the_same_name', '$schema' => 'http://json-schema.org/draft-07/schema#', # begin all referenced definitions - definitions => { + '$defs' => { i_am_a_ref_with_the_same_name => { type => 'string', }, @@ -170,7 +170,7 @@ subtest 'extraction with $refs' => sub { type => 'object', properties => { me => { - '$ref' => '#/definitions/i_am_a_ref_with_the_same_name', + '$ref' => '#/$defs/i_am_a_ref_with_the_same_name', }, }, }, @@ -190,7 +190,7 @@ subtest 'extraction with $refs' => sub { [ { title => 'i_contain_refs_to_same_named_definitions', - exception => qr!namespace collision: .*t/data/test-schema2?\.yaml#/definitions/dupe_name but already have a /definitions/dupe_name from .*t/data/test-schema2?\.yaml#/definitions/dupe_name!, + exception => qr!namespace collision: .*t/data/test-schema2?\.yaml#/\$defs/dupe_name but already have a /\$defs/dupe_name from .*t/data/test-schema2?\.yaml#/\$defs/dupe_name!, }, 'cannot handle pulling in references that have the same root name', ], @@ -200,7 +200,7 @@ subtest 'extraction with $refs' => sub { title => 'i_have_a_ref_with_the_same_name', '$schema' => 'http://json-schema.org/draft-07/schema#', # begin all referenced definitions - definitions => { + '$defs' => { i_have_a_ref_with_the_same_name => { type => 'string' }, }, # begin i_have_a_ref_with_the_same_name definition @@ -209,7 +209,7 @@ subtest 'extraction with $refs' => sub { name => { type => 'string' }, children => { type => 'array', - items => { '$ref' => '#/definitions/i_have_a_ref_with_the_same_name' }, + items => { '$ref' => '#/$defs/i_have_a_ref_with_the_same_name' }, default => [], }, }, @@ -222,13 +222,13 @@ subtest 'extraction with $refs' => sub { title => 'i_am_a_ref_to_another_file', '$schema' => 'http://json-schema.org/draft-07/schema#', # begin all referenced definitions - definitions => { + '$defs' => { ref3 => { type => 'integer' }, }, # begin i_am_a_ref_to_another_file definition - which is actually i_have_a_ref_to_the_first_filename type => 'object', properties => { - gotcha => { '$ref' => '#/definitions/ref3' }, + gotcha => { '$ref' => '#/$defs/ref3' }, }, }, 'find and resolve a reference that immediately leaps to another file', @@ -355,12 +355,12 @@ $t->get_ok('/json_schema/request/Login') required => [ 'password' ], oneOf => [ { required => [ 'user_id' ] }, { required => [ 'email' ] } ], properties => { - user_id => { '$ref' => '#/definitions/uuid' }, - email => { '$ref' => '#/definitions/email_address' }, - password => { '$ref' => '#/definitions/non_empty_string' }, + user_id => { '$ref' => '#/$defs/uuid' }, + email => { '$ref' => '#/$defs/email_address' }, + password => { '$ref' => '#/$defs/non_empty_string' }, set_session => { type => 'boolean' }, }, - definitions => { + '$defs' => { non_empty_string => { type => 'string', minLength => 1 }, uuid => superhashof({}), email_address => superhashof({}), @@ -376,14 +376,14 @@ $t->get_ok('/json_schema/query_params/ResetUserPassword') ->json_cmp_deeply({ '$schema' => SPEC_URL, '$id' => $base_uri.'json_schema/query_params/ResetUserPassword', - definitions => { + '$defs' => { boolean_string => { type => 'string', enum => [ '0', '1' ] }, }, type => 'object', additionalProperties => bool(0), properties => { clear_tokens => { type => 'string', enum => [ qw(none login_only all) ] }, - send_mail => { '$ref' => '#/definitions/boolean_string' }, + send_mail => { '$ref' => '#/$defs/boolean_string' }, }, default => { clear_tokens => 'login_only', @@ -397,7 +397,7 @@ $t->get_ok('/json_schema/request/HardwareProductCreate') ->json_schema_is(SPEC_URL) ->json_cmp_deeply('', superhashof({ '$id' => $base_uri.'json_schema/request/HardwareProductCreate', - definitions => { + '$defs' => { map +($_ => superhashof({})), qw( uuid positive_integer @@ -423,10 +423,10 @@ $t->get_ok('/json_schema/common/non_zero_uuid') '$id' => $base_uri.'json_schema/common/non_zero_uuid', '$schema' => SPEC_URL, allOf => [ - { '$ref' => '#/definitions/uuid' }, + { '$ref' => '#/$defs/uuid' }, { not => { const => '00000000-0000-0000-0000-000000000000' } }, ], - definitions => { + '$defs' => { uuid => { type => 'string', pattern => ignore, }, @@ -444,7 +444,7 @@ $t->get_ok('/json_schema/device_report/DeviceReport_v3_0_0') type => 'object', required => ignore, properties => superhashof({}), - definitions => { + '$defs' => { map +($_ => superhashof({})), qw(non_empty_string int_or_stringy_int disk_serial_number device_interface_name macaddr ipaddr relay_serial_number device_serial_number non_zero_uuid links uuid mojo_standard_placeholder mojo_relaxed_placeholder), }, diff --git a/t/json-validation.t b/t/json-validation.t index 98560969c..fa3ea2c1d 100644 --- a/t/json-validation.t +++ b/t/json-validation.t @@ -35,7 +35,7 @@ subtest 'failed query params validation' => sub { subtest 'insert defaults for missing query parameter values' => sub { my $validator = $t->app->get_query_params_validator; - my $schema = $validator->get('/definitions/RevokeUserTokens'); + my $schema = $validator->get('/$defs/RevokeUserTokens'); my $data = {}; my @errors = $validator->validate($data, $schema); @@ -68,7 +68,7 @@ subtest 'failed request validation' => sub { subtest '/device/:id/interface/:iface_name/:field validation' => sub { my $validator = $t->app->get_response_validator; - my $schema = $validator->get('/definitions/DeviceNicField'); + my $schema = $validator->get('/$defs/DeviceNicField'); cmp_deeply( [ $validator->validate({ device_id => create_uuid_str() }, $schema) ], @@ -96,7 +96,7 @@ subtest 'device report validation' => sub { cmp_deeply( [ $validator->validate('00000000-0000-0000-0000-000000000000', - $validator->get('/definitions/DeviceReport_v3_0_0/properties/system_uuid')) ], + $validator->get('/$defs/DeviceReport_v3_0_0/properties/system_uuid')) ], [ methods( path => '/', message => re(qr/should not match/i), @@ -106,7 +106,7 @@ subtest 'device report validation' => sub { cmp_deeply( [ $validator->validate({ '' => {} }, - $validator->get('/definitions/DeviceReport_v3_0_0/properties/disks')) ], + $validator->get('/$defs/DeviceReport_v3_0_0/properties/disks')) ], [ methods( path => '/', message => re(qr{/propertyName/ String does not match '?\^\\S\+\$'?}i), @@ -117,7 +117,7 @@ subtest 'device report validation' => sub { subtest '*Error response schemas' => sub { my $validator = $t->validator; - my $definitions = $t->validator->get(['definitions']); + my $defs = $t->validator->get(['$defs']); $validator->schema({ anyOf => [ @@ -156,9 +156,9 @@ subtest '*Error response schemas' => sub { ], }); - foreach my $schema_name (sort grep /Error$/, keys $definitions->%*) { + foreach my $schema_name (sort grep /Error$/, keys $defs->%*) { next if $schema_name eq 'JSONValidatorError'; - my @errors = $validator->validate($definitions->{$schema_name}); + my @errors = $validator->validate($defs->{$schema_name}); cmp_deeply(\@errors, [], 'schema '.$schema_name.' is a superset of the Error schema') or diag 'got errors: ', explain([ map $_->to_string, @errors ]); } diff --git a/t/pod-spelling.t b/t/pod-spelling.t index 60583a672..6f29b451e 100644 --- a/t/pod-spelling.t +++ b/t/pod-spelling.t @@ -10,7 +10,7 @@ use YAML::XS; foreach my $file (glob('json-schema/*.yaml')) { my $data = YAML::XS::LoadFile($file); - add_stopwords(keys $data->{definitions}->%*); + add_stopwords(keys $data->{'$defs'}->%*); } add_stopwords();