1.2.1 • Published 3 years ago

ang-token-validator v1.2.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

ANG Token Validator

v2 usage:

/* import validator **/
import angTokenValidator from 'ang-token-validator';

/* set expressions to validate **/ 
expressionsParameters = {
    name: "yourIdentifier",
    schema: "theSchemaObjectToValidate",
    jsonPathExpression: "the path to expression"
};
/* or **/
expressionsParameters = [{
    name: "yourIdentifier",
    schema: "theSchemaObjectToValidate",
    jsonPathExpression: "the path to expression"
    },
    {
        ...
    }];

the three parameters in expressionsParameters are mandatory.

expressionParameters can be either an object or an array of object with schema's and path's to validate.

then you can call the function

    const response = angTokenValidator.validate(token, expressionsParameters, key);

case 1 one response with no errors:

{
  "IdentifierName": {
    "result": {
      "key1": "val1",
      "key2": "val2"
    },
  }
}

case 1 one response with errors:

{
  "IdentifierName": {
    "error": {
      "message": "the error message",
      "statusCode": 400, 401, 403, 503, ...
    },
  }
}

case 2 multiple response:

[
  { "IdentifierName": { error: [Object] } },
  { "IdentifierName": { error: [Object] } },
  { "IdentifierName": { error: [Object] } }

]

[
  { "IdentifierName": { result: [Object] } },
  { "IdentifierName": { result: [Object] } },
  { "IdentifierName": { result: [Object] } }
]

v1 usage:

import angTokenValidator from 'ang-token-validator';


const result = angTokenValidator.validate(schema, token, jsonPathQuery)
- schema is the schema to validate
- token is as is name the token
- jsonPathQuery is the path to the schema to validate in the token
1.2.0

3 years ago

1.2.1

3 years ago

2.0.0

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.104

3 years ago

1.0.103

3 years ago

1.0.102

3 years ago

1.0.101

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago