Socket
Socket
Sign inDemoInstall

@aomex/validator

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aomex/validator - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

10

CHANGELOG.md
# @aomex/validator
## 0.0.6
### Patch Changes
- [`cba047e`](https://github.com/aomex/aomex/commit/cba047ecb496da6269aed3f58f6e316a3444c939) Thanks [@geekact](https://github.com/geekact)! - fix(validator): the length of hash validator is fixed
- [`bdbf43a`](https://github.com/aomex/aomex/commit/bdbf43afcbc198a9ae97137022c6914f1a89a477) Thanks [@geekact](https://github.com/geekact)! - fix(validator): toDocument returning wrong openapi schema
- [`5092841`](https://github.com/aomex/aomex/commit/5092841c6b8a998e8648a1119d7e1ceb8534297d) Thanks [@geekact](https://github.com/geekact)! - feat(valiator): set default value to against openapi validate warning
## 0.0.5

@@ -4,0 +14,0 @@

5

dist/index.d.ts

@@ -13,3 +13,6 @@ import { OpenAPI } from '@aomex/openapi-type';

}
type PartialOpenAPISchema = Pick<OpenAPI.SchemaObject, 'title' | 'description' | 'deprecated' | 'example' | 'externalDocs'>;
/**
* Useless fields: [title, externalDocs]
*/
type PartialOpenAPISchema = Pick<OpenAPI.SchemaObject, 'description' | 'deprecated' | 'example'>;
interface ValidatorOptions<Type> {

@@ -16,0 +19,0 @@ defaultValue?: Type | (() => Type);

22

dist/index.js

@@ -14,3 +14,7 @@ var __defProp = Object.defineProperty;

static toDocument(validator) {
const { required, docs = {}, defaultValue } = validator.config;
const {
required,
docs: { description, deprecated, example, ...docs } = {},
defaultValue
} = validator.config;
const schema = {

@@ -21,6 +25,8 @@ ...docs,

};
return {
const result = {
required,
schema: JSON.parse(JSON.stringify(schema))
...{ description, deprecated, example },
schema
};
return JSON.parse(JSON.stringify(result));
}

@@ -218,5 +224,5 @@ static validate(validator, value, key = this.$rootKey, superKeys = []) {

// FIXME: where to place pattern.flags?
pattern: pattern && pattern.source,
minLength: lengthRange.min,
maxLength: lengthRange.max
pattern: pattern ? pattern.source : "",
minLength: lengthRange.min ?? 0,
maxLength: lengthRange.max ?? Math.pow(2, 32) - 1
};

@@ -486,4 +492,8 @@ }

toDocument() {
const { algorithm } = this.config;
const length = _HashValidator.algorithmLength[algorithm];
return {
...super.toDocument(),
minLength: length,
maxLength: length,
format: this.config.algorithm

@@ -490,0 +500,0 @@ };

{
"name": "@aomex/validator",
"version": "0.0.5",
"version": "0.0.6",
"description": "",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc