Conch API

Logo

Datacenter build and management service

View the Project on GitHub joyent/conch-api

Conch::Controller::JSONSchema

SOURCE

https://github.com/joyent/conch-api/blob/master/lib/Conch/Controller/JSONSchema.pm

METHODS

get_from_disk

Get a query parameters, request, response, common or device_report JSON Schema (from query_params.json, request.json, response.json, common.json, or device_report.json, respectively). Bundles all the referenced definitions together in the returned body response.

create

Stores a new JSON Schema in the database.

The type names used in “get_from_disk” (query_params, request, response, common, device_report) cannot be used.

The $id, $anchor, definitions and dependencies keywords are prohibited anywhere in the document. description is required at the top level of the document.

find_json_schema

Chainable action that uses the json_schema_id, json_schema_type, json_schema_name, and json_schema_version values provided in the stash (usually via the request URL) to look up a JSON Schema, and stashes a simplified query (by id) to get to it in json_schema_rs, and the id itself in json_schema_id.

If the resource is referenced as /json_schema/:id or as /json_schema/:type/:name/:version, the exact schema will be retrieved, even if it is deactivated; if it is referenced by /json_schema/:type/:name/latest, the latest active schema of that type-name series will be retrieved.

assert_active

A chainable route that will ensure that the JSON Schema referenced by the json_schema_rs stash variable is not deactivated (otherwise, a 410 Gone response will be issued).

get_single

Gets a single JSON Schema specification document.

delete

Deactivates the database entry for a single JSON Schema, rendering it unusable. This operation is not permitted until all references from other documents have been removed, with the exception of references using .../latest which will now resolve to a different document (and paths within that document will be re-verified).

If this JSON Schema was the latest of its series (/json_schema/foo/bar/latest), then that .../latest link will now resolve to an earlier version in the series.

get_metadata

Gets meta information about all JSON Schemas in a particular type and name series, optionally fetching active schemas only.

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/.