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

Commit

Permalink
Merge pull request #1084 from joyent/ether/v3.2-hardware_product_json…
Browse files Browse the repository at this point in the history
…_schemas

hardware_products + json_schemas
  • Loading branch information
karenetheridge authored Jan 14, 2021
2 parents dcf55c4 + 2a782a7 commit 114be7c
Show file tree
Hide file tree
Showing 30 changed files with 1,136 additions and 23 deletions.
10 changes: 10 additions & 0 deletions docs/_resources/full-schema.er
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ created
+created_user_id
deactivated

[hardware_product_json_schema] {bgcolor: "#fbfbdb"}
*+hardware_product_id
*+json_schema_id
added
+added_user_id


# Cardinality Syntax
# 0 or 1 ?
# exactly 1 1
Expand Down Expand Up @@ -403,3 +410,6 @@ validation_state_member +--1 validation_result
validation_state_member *--1 validation_state
legacy_validation_state_member +--1 legacy_validation_result
legacy_validation_state_member *--1 validation_state
hardware_product_json_schema *--1 hardware_product
hardware_product_json_schema *--1 json_schema
hardware_product_json_schema *--1 user_account
10 changes: 10 additions & 0 deletions docs/_resources/validations.er
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ created
+created_user_id
deactivated

[hardware_product_json_schema] {bgcolor: "#fbfbdb"}
*+hardware_product_id
*+json_schema_id
added
+added_user_id


device *--1 hardware_product
device_report *--1 device
hardware_product *--1 legacy_validation_plan
Expand All @@ -151,3 +158,6 @@ validation_state_member +--1 validation_result
validation_state_member *--1 validation_state
legacy_validation_state_member +--1 legacy_validation_result
legacy_validation_state_member *--1 validation_state
hardware_product_json_schema *--1 hardware_product
hardware_product_json_schema *--1 json_schema
hardware_product_json_schema *--1 user_account
Binary file modified docs/images/full-schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/validations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 16 additions & 12 deletions docs/json-schema/query_params.json
Original file line number Diff line number Diff line change
@@ -1,18 +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.",
"$defs" : {
"ActiveOnly" : {
"additionalProperties" : false,
"default" : {
"active_only" : "0"
},
"properties" : {
"active_only" : {
"$ref" : "#/$defs/boolean_string"
}
},
"type" : "object"
},
"Anything" : {
"additionalProperties" : true,
"type" : "object"
Expand Down Expand Up @@ -249,6 +237,22 @@
],
"type" : "object"
},
"JSONSchemaDescriptions" : {
"additionalProperties" : false,
"default" : {
"active_only" : "0",
"with_hardware_products" : "0"
},
"properties" : {
"active_only" : {
"$ref" : "#/$defs/boolean_string"
},
"with_hardware_products" : {
"$ref" : "#/$defs/boolean_string"
}
},
"type" : "object"
},
"NotifyUsers" : {
"$comment" : "used for operations where email can optionally be sent",
"additionalProperties" : false,
Expand Down
106 changes: 106 additions & 0 deletions docs/json-schema/response.json
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,87 @@
],
"type" : "object"
},
"HardwareJSONSchemaDescriptions" : {
"items" : {
"additionalProperties" : false,
"properties" : {
"$id" : {
"format" : "uri-reference",
"pattern" : "^/json_schema/[A-Za-z0-9_-]+/[A-Za-z0-9_-]+/[0-9]+$",
"readOnly" : true,
"title" : "Canonical URI Identifier",
"type" : "string"
},
"added" : {
"format" : "date-time",
"readOnly" : true,
"title" : "Added",
"type" : "string"
},
"added_user" : {
"$ref" : "#/$defs/UserTerse",
"readOnly" : true,
"title" : "Added User"
},
"created" : {
"format" : "date-time",
"readOnly" : true,
"title" : "Created",
"type" : "string"
},
"created_user" : {
"$ref" : "#/$defs/UserTerse",
"readOnly" : true,
"title" : "Created User"
},
"description" : {
"title" : "Description",
"type" : "string"
},
"id" : {
"$ref" : "common.json#/$defs/uuid",
"readOnly" : true,
"title" : "ID"
},
"latest" : {
"description" : "true when it is the latest of its type-name series",
"title" : "Latest in Type-Name Series?",
"type" : "boolean"
},
"name" : {
"$ref" : "common.json#/$defs/json_pointer_token",
"readOnly" : true,
"title" : "Name"
},
"type" : {
"$ref" : "common.json#/$defs/json_pointer_token",
"readOnly" : true,
"title" : "Type"
},
"version" : {
"$ref" : "common.json#/$defs/positive_integer",
"readOnly" : true,
"title" : "Version"
}
},
"required" : [
"id",
"$id",
"description",
"type",
"name",
"version",
"latest",
"created",
"created_user",
"added",
"added_user"
],
"type" : "object"
},
"type" : "array",
"uniqueItems" : true
},
"HardwareProduct" : {
"additionalProperties" : false,
"properties" : {
Expand Down Expand Up @@ -1516,6 +1597,27 @@
],
"type" : "object"
},
"HardwareProductJSONSchemaDeleteError" : {
"additionalProperties" : false,
"properties" : {
"error" : {
"type" : "string"
},
"hardware_product_ids" : {
"items" : {
"$ref" : "common.json#/$defs/uuid"
},
"minItems" : 1,
"type" : "array",
"uniqueItems" : true
}
},
"required" : [
"error",
"hardware_product_ids"
],
"type" : "object"
},
"HardwareProducts" : {
"items" : {
"additionalProperties" : false,
Expand Down Expand Up @@ -1692,6 +1794,10 @@
"title" : "Description",
"type" : "string"
},
"hardware_products" : {
"$ref" : "#/$defs/HardwareProducts",
"title" : "Referenced by Hardware Products"
},
"id" : {
"$ref" : "common.json#/$defs/uuid",
"readOnly" : true,
Expand Down
8 changes: 8 additions & 0 deletions docs/modules/Conch::Controller::HardwareProduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ Uses the URI query parameter `path` as a json pointer to determine the path with
After the delete operation, the `specification` property must validate against
the schema at `/json_schema/hardware_product/specification/latest`.

### add\_json\_schema

### get\_json\_schema\_metadata

### remove\_json\_schema

### remove\_all\_json\_schemas

## LICENSING

Copyright Joyent, Inc.
Expand Down
6 changes: 6 additions & 0 deletions docs/modules/Conch::DB::Result::HardwareProduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ Type: has\_many

Related object: [Conch::DB::Result::Device](../modules/Conch%3A%3ADB%3A%3AResult%3A%3ADevice)

### hardware\_product\_json\_schemas

Type: has\_many

Related object: [Conch::DB::Result::HardwareProductJSONSchema](../modules/Conch%3A%3ADB%3A%3AResult%3A%3AHardwareProductJSONSchema)

### hardware\_vendor

Type: belongs\_to
Expand Down
80 changes: 80 additions & 0 deletions docs/modules/Conch::DB::Result::HardwareProductJSONSchema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Conch::DB::Result::HardwareProductJSONSchema

## SOURCE

[https://github.com/joyent/conch-api/blob/master/lib/Conch/DB/Result/HardwareProductJSONSchema.pm](https://github.com/joyent/conch-api/blob/master/lib/Conch/DB/Result/HardwareProductJSONSchema.pm)

## BASE CLASS: [Conch::DB::Result](../modules/Conch%3A%3ADB%3A%3AResult)

## TABLE: `hardware_product_json_schema`

## ACCESSORS

### hardware\_product\_id

```
data_type: 'uuid'
is_foreign_key: 1
is_nullable: 0
size: 16
```

### json\_schema\_id

```
data_type: 'uuid'
is_foreign_key: 1
is_nullable: 0
size: 16
```

### added

```
data_type: 'timestamp with time zone'
default_value: current_timestamp
is_nullable: 0
original: {default_value => \"now()"}
```

### added\_user\_id

```
data_type: 'uuid'
is_foreign_key: 1
is_nullable: 0
size: 16
```

## PRIMARY KEY

- ["hardware\_product\_id"](#hardware_product_id)
- ["json\_schema\_id"](#json_schema_id)

## RELATIONS

### added\_user

Type: belongs\_to

Related object: [Conch::DB::Result::UserAccount](../modules/Conch%3A%3ADB%3A%3AResult%3A%3AUserAccount)

### hardware\_product

Type: belongs\_to

Related object: [Conch::DB::Result::HardwareProduct](../modules/Conch%3A%3ADB%3A%3AResult%3A%3AHardwareProduct)

### json\_schema

Type: belongs\_to

Related object: [Conch::DB::Result::JSONSchema](../modules/Conch%3A%3ADB%3A%3AResult%3A%3AJSONSchema)

## LICENSING

Copyright Joyent, Inc.

This Source Code Form is subject to the terms of the Mozilla Public License,
v.2.0. If a copy of the MPL was not distributed with this file, You can obtain
one at [https://www.mozilla.org/en-US/MPL/2.0/](https://www.mozilla.org/en-US/MPL/2.0/).
6 changes: 6 additions & 0 deletions docs/modules/Conch::DB::Result::JSONSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ Type: belongs\_to

Related object: [Conch::DB::Result::UserAccount](../modules/Conch%3A%3ADB%3A%3AResult%3A%3AUserAccount)

### hardware\_product\_json\_schemas

Type: has\_many

Related object: [Conch::DB::Result::HardwareProductJSONSchema](../modules/Conch%3A%3ADB%3A%3AResult%3A%3AHardwareProductJSONSchema)

### validation\_results

Type: has\_many
Expand Down
6 changes: 6 additions & 0 deletions docs/modules/Conch::DB::Result::UserAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ Type: has\_many

Related object: [Conch::DB::Result::Build](../modules/Conch%3A%3ADB%3A%3AResult%3A%3ABuild)

### hardware\_product\_json\_schemas

Type: has\_many

Related object: [Conch::DB::Result::HardwareProductJSONSchema](../modules/Conch%3A%3ADB%3A%3AResult%3A%3AHardwareProductJSONSchema)

### json\_schemas

Type: has\_many
Expand Down
4 changes: 3 additions & 1 deletion docs/modules/Conch::DB::ResultSet::JSONSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ that row is the latest of its type-name series (that is, whether it can be refer

The query will be closed off as a subselect (that additional chaining will SELECT FROM),
so it makes a difference whether you add things to the resultset before or after calling this
method.
method. Note that if the initial resultset filters out some rows from the same type-name series,
the result will not be accurate, as the full series must be visible in order for the partition
query to work!

## LICENSING

Expand Down
Loading

0 comments on commit 114be7c

Please sign in to comment.