Skip to content

Commit

Permalink
Removed dep graph img from npm output.
Browse files Browse the repository at this point in the history
Fixed undefined check not allowing optional fields in some cases.
Version incremented for another patch.
  • Loading branch information
mbrich committed Jun 14, 2024
1 parent 70e4b5c commit 8d2a180
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ coverage/
demo
docs/
examples/
dependency-graph.png
gulpfile.ts
jest.config.js
node_modules
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.11.2] - 2024-06-14
* Fixed 'undefined' types not being accepted when explicitly allowed in some cases.

## [0.11.1] - 2024-06-14
* Fixed sub-schema array processing not bubbling up their error state to the final verification result. Schema elements that failed to verify would not be added to the verified output, but would not report the failure.

Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"name": "@toreda/verify",
"version": "0.11.1",
"version": "0.11.3",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"repository": "https://github.com/toreda/verify",
"author": "Toreda, Inc.",
"keywords": ["schema validation", "json-schema"],
"keywords": [
"schema validation",
"json-schema"
],
"license": "MIT",
"description": "Automated validation. Eliminate edge cases with less code.",
"public": true,
Expand Down
7 changes: 6 additions & 1 deletion src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ export class Schema<DataT, InputT extends SchemaData<DataT>, TransformedT = Inpu
const currPath = tracer.child(field.name);

if (value === undefined) {
return fate.setErrorCode(schemaError('missing_field_value', currPath.current()));
if (field.types.includes('undefined')) {
fate.data = undefined;
return fate.setSuccess(true);
} else {
return fate.setErrorCode(schemaError('missing_field_value', currPath.current()));
}
}

let verified: Fate<VerifiedSchemaField<DataT>>;
Expand Down
1 change: 1 addition & 0 deletions src/verified/schema/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ export type VerifiedSchemaField<DataT> =
| DataT[]
| Map<string, VerifiedSchemaField<DataT>>
| Map<string, VerifiedSchemaField<DataT>>[]
| undefined
| null;

0 comments on commit 8d2a180

Please sign in to comment.