Gathering detailed insights and metrics for oada-formats
Gathering detailed insights and metrics for oada-formats
Gathering detailed insights and metrics for oada-formats
Gathering detailed insights and metrics for oada-formats
npm install oada-formats
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
16 Stars
109 Commits
4 Forks
11 Watchers
6 Branches
9 Contributors
Updated on Jan 28, 2023
Latest Version
1.5.2
Package Id
oada-formats@1.5.2
Size
19.86 kB
NPM Version
3.7.3
Node Version
5.8.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
This repo contains models for all formats whose format is known from a given
media type. Each model consists of a module with validate()
, schema()
, and
example()
functions. Some base model types, e.g., JsonModel, are available for
use.
oada-foramts
exposes a Formats
class that acts as a repository of models.
The model()
function is a factory function for various mediatype models. The
use()
function can be used to extend the model types and model repository. See
valleyix-formats for an example. oada-formats
comes with
OADA defined formats pre-loaded by default.
1npm install oada-formats
1var Formats = require('oada-formats'); 2 3var formats = new Formats(); 4formats.use(require('your-favorite-model=package')); 5 6formats 7 .model('application/vnd.oada.bookmarks.1+json') 8 .then(function(model) { 9 return model.validate(model.example()); 10 }) 11 .then(/* success */) 12 .catch(Format.ValidationError, function(error) { 13 console.log(error.errors); 14 });
1var Formats = require('oada-formats'); 2 3var formats = new Formats(); 4 5var model = formats.model('application/vnd.oada.link.1+json'); 6 7model.examples().then(console.log); 8model.example('default').then(console.log); 9model.schema().then(console.log);
The JsonModel
can be used to add new json models easily.
[valleyix-formats][valleyix-formatas] is a good example.
JsonModel
will
load the values of properties examples
and schema
as the format's
examples and schema respectively. An array of function(data)
implementing
custom validation rules can be stored under the addtionalValidators
property. index.js
may expose the plain old object, a promise of a plain
old object, or a plain old object with promises at its first level of
properties. Therefore any type of asynchronous loading can be done, e.g.,
http or database.examples
property then any js
or json
file in an
examples
directory at the root of the mediatype directory structure will be
loaded in as the examples. The example name will be the filename less it's
file extension.schema
property then a schema.js
or schema.json
file
at the root of the mediatype directory structure will be loaded in as the
schema.1{ 2 "id": "oada-formats://application/vnd.oada.bookmarks.1+json", 3 "description": "application/vnd.oada.bookmarks.1+json", 4 "additionalProperties": true, 5 "properties": { 6 "planting": { 7 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 8 }, 9 "harvest": { 10 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 11 }, 12 "machines": { 13 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 14 }, 15 "irrigation": { 16 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 17 }, 18 "sensors": { 19 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 20 }, 21 "fields": { 22 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 23 }, 24 "sales": { 25 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 26 }, 27 "clients": { 28 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 29 } 30 } 31}
1{ 2 "planting": { 3 "_id": "09ijfofj", 4 "_rev": "2-djfh92843hj" 5 }, 6 "harvest": { 7 "_id": "908uf2jh", 8 "_rev": "33-kdfj092jle" 9 }, 10 "machines": { 11 "_id": "0kdfj20j", 12 "_rev": "8-kdjs90fj2oi" 13 }, 14 "irrigation": { 15 "_id": "0jk2iopw", 16 "_rev": "4-d98ohf29efk" 17 }, 18 "sales": { 19 "_id": "0kdfj20j", 20 "_rev": "99-kdjf92lsdf" 21 }, 22 "sensors": { 23 "_id": "kd02ufjk", 24 "_rev": "3-kdsfjoiwefj" 25 }, 26 "fields": { 27 "_id": "0kdfj2jl", 28 "_rev": "7-kk0all2oald" 29 }, 30 "clients": { 31 "_id": "9sdkf2lk", 32 "_rev": "4-lfdu029kjds" 33 } 34}
1{ 2 "id": "oada-formats://application/vnd.oada.clients.1+json", 3 "description": "application/vnd.oada.clients.1+json", 4 "additionalProperties": true, 5 "required": [ 6 "name", 7 "list" 8 ], 9 "properties": { 10 "name": { 11 "type": "string", 12 "pattern": "clients" 13 }, 14 "list": { 15 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/list" 16 } 17 } 18}
1{ 2 "name": "clients", 3 "list": { 4 "0jfl290ijfklwsdf": { 5 "_id": "321cba", 6 "_rev": "90-k2983wfhjdsdf" 7 }, 8 "kl9ojksfh92hkwef": { 9 "_id": "389dfj", 10 "_rev": "2-kdfj29eflwdfsd" 11 } 12 } 13}
1{ 2 "id": "oada-formats://application/vnd.oada.irrigation.1+json", 3 "description": "application/vnd.oada.irrigation.1+json", 4 "additionalProperties": true, 5 "properties": { 6 "machines": { 7 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/versioned" 8 } 9 } 10}
1{ 2 "machines": { 3 "_id": "dummyid123AFG", 4 "_rev": "1-dummy02ijfl" 5 } 6}
1{ 2 "id": "oada-formats://application/vnd.oada.irrigation.machines.1+json", 3 "description": "application/vnd.oada.irrigation.machines.1+json", 4 "required": [ 5 "name", 6 "list" 7 ], 8 "additionalProperties": true, 9 "properties": { 10 "name": { 11 "type": "string", 12 "pattern": "irrigation" 13 }, 14 "list": { 15 "$ref": "oada-formats://application/vnd.oada.link.1+json#/definitions/list" 16 } 17 } 18}
1{ 2 "name": "irrigation", 3 "list": { 4 "dummyrandomthing": { 5 "_id": "dummyid123AFG", 6 "_rev": "1-dummy02ijfl" 7 }, 8 "klsdfj0982ifjoow": { 9 "_id": "df002jfk2ojsl", 10 "_rev": "3-jkfd0ijs8zk" 11 } 12 } 13}
1{ 2 "id": "oada-formats://application/vnd.oada.link.1+json", 3 "description": "OADA Link object", 4 "definitions": { 5 "link": { 6 "anyOf": [ 7 { 8 "$ref": "#/definitions/nonversioned" 9 }, 10 { 11 "$ref": "#/definitions/versioned" 12 } 13 ] 14 }, 15 "nonversioned": { 16 "type": "object", 17 "required": [ 18 "_id" 19 ], 20 "additionalProperties": true, 21 "properties": { 22 "_id": { 23 "type": "string" 24 } 25 } 26 }, 27 "versioned": { 28 "type": "object", 29 "required": [ 30 "_rev", 31 "_id" 32 ], 33 "additionalProperties": true, 34 "properties": { 35 "_id": { 36 "type": "string" 37 }, 38 "_rev": { 39 "type": "string", 40 "pattern": "^[0-9]+-.+" 41 } 42 } 43 }, 44 "list": { 45 "versioned": { 46 "type": "object", 47 "additionalProperties": { 48 "$ref": "#/definitions/versioned" 49 } 50 }, 51 "nonversioned": { 52 "type": "object", 53 "additionalProperties": { 54 "$ref": "#/definitions/nonversioned" 55 } 56 }, 57 "list": { 58 "type": "object", 59 "additionalProperties": { 60 "$ref": "#/definitions/link" 61 } 62 } 63 } 64 } 65}
1{ 2 "_id": "akjf92jxcJds", 3 "_rev": "1-jxusuf3sc" 4}
1{ 2 "id": "oada-formats://application/vnd.oada.well-known.oada-configuration.1+json", 3 "description": "application/vnd.oada.well-known.oada-configuration.1+json", 4 "required": [ 5 "oada_base_uri", 6 "authorization_endpoint", 7 "token_endpoint", 8 "registration_endpoint", 9 "client_assertion_signing_alg_values_supported" 10 ], 11 "additionalProperties": true, 12 "properties": { 13 "oada_base_uri": { 14 "type": "string", 15 "pattern": "^https://.*" 16 }, 17 "authorization_endpoint": { 18 "type": "string", 19 "pattern": "^https://.*" 20 }, 21 "token_endpoint": { 22 "type": "string", 23 "pattern": "^https://.*" 24 }, 25 "registration_endpoint": { 26 "type": "string", 27 "pattern": "^https://.*" 28 }, 29 "client_assertion_signing_alg_values_supported": { 30 "type": "array", 31 "minItems": 1, 32 "uniqueItems": true, 33 "items": { 34 "type": "string" 35 } 36 } 37 } 38}
1{ 2 "well_known_version": "1.0.0", 3 "oada_base_uri": "https://oada.example.com", 4 "authorization_endpoint": "https://oada.example.com/auth", 5 "token_endpoint": "https://oada.example.com/token", 6 "registration_endpoint": "https://oada.example.com/register", 7 "client_assertion_signing_alg_values_supported": [ 8 "RS256" 9 ], 10 "scopes_supported": [ 11 { 12 "name": "oada.all.1", 13 "read+write": true 14 } 15 ] 16}
1{ 2 "id": "oada-formats://application/vnd.oada.oauth-dyn-reg.register-response.1+json", 3 "description": "application/vnd.oada.oauth-dny-reg.register-response.1+json", 4 "required": [ 5 "client_id", 6 "client_id_issued_at", 7 "scopes", 8 "redirect_uris", 9 "token_endpoint_auth_method", 10 "grant_types", 11 "response_types", 12 "tos_uri", 13 "policy_uri", 14 "software_id" 15 ], 16 "additionalProperties": true, 17 "properties": { 18 "client_id": { 19 "type": "string" 20 }, 21 "client_id_issued_at": { 22 "type": "number" 23 }, 24 "scopes": { 25 "type": "string" 26 }, 27 "redirect_uris": { 28 "type": "array", 29 "minItems": 1, 30 "uniqueItems": true, 31 "items": { 32 "type": "string", 33 "pattern": "^https://.*" 34 } 35 }, 36 "token_endpoint_auth_method": { 37 "type": "string" 38 }, 39 "grant_types": { 40 "type": "array", 41 "minItems": 1, 42 "uniqueItems": true, 43 "items": { 44 "type": "string" 45 } 46 }, 47 "response_types": { 48 "type": "array", 49 "minItems": 1, 50 "uniqueItems": true, 51 "items": { 52 "type": "string" 53 } 54 }, 55 "tos_uri": { 56 "type": "string", 57 "format": "uri" 58 }, 59 "policy_uri": { 60 "type": "string", 61 "format": "uri" 62 }, 63 "software_id": { 64 "type": "string" 65 } 66 } 67}
1{ 2 "client_id": "3klaxu838akahf38acucaix73", 3 "client_id_issued_at": 1418423102, 4 "software_version": "1.0-ga", 5 "scopes": "read:planting.prescriptions write:fields", 6 "redirect_uris": [ 7 "https://client.example.com/callback", 8 "https://client.example.com/cb" 9 ], 10 "token_endpoint_auth_method": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", 11 "grant_types": [ 12 "implicit", 13 "authorization_code", 14 "refresh_token" 15 ], 16 "response_types": [ 17 "token", 18 "code" 19 ], 20 "client_name": "Example OADA Client", 21 "client_uri": "http://example.com", 22 "logo_uri": "http://example.com/logo.png", 23 "contacts": [ 24 "Clint Client <cclient@example.com>" 25 ], 26 "tos_uri": "http://example.com/tos.html", 27 "policy_uri": "http://example.com/policy.html", 28 "software_id": "djxkjau3n937xz7jakl3", 29 "registration_provider": "registration.example.com" 30}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/7 approved changesets -- score normalized to 2
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More