Skip to content

Commit

Permalink
Fix Encode Proerty Check
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairzx81 committed May 3, 2024
1 parent 93a32b0 commit 1f2d88c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/value/transform/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import type { TUnion } from '../../type/union/index'
// ------------------------------------------------------------------
// ValueGuard
// ------------------------------------------------------------------
import { IsStandardObject, IsArray, IsValueType } from '../guard/index'
import { IsStandardObject, IsArray, IsValueType, IsObject } from '../guard/index'
// ------------------------------------------------------------------
// TypeGuard
// ------------------------------------------------------------------
Expand Down Expand Up @@ -122,10 +122,10 @@ function FromNot(schema: TNot, references: TSchema[], path: string, value: any)
// prettier-ignore
function FromObject(schema: TObject, references: TSchema[], path: string, value: any) {
const defaulted = Default(schema, path, value)
if (!IsStandardObject(value)) return defaulted
if (!IsStandardObject(defaulted)) return defaulted
const knownKeys = KeyOfPropertyKeys(schema) as string[]
const knownProperties = { ...defaulted } as Record<PropertyKey, unknown>
for(const key of knownKeys) if(key in value) {
for(const key of knownKeys) if(key in defaulted) {
knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key])
}
if (!IsSchema(schema.additionalProperties)) {
Expand Down

0 comments on commit 1f2d88c

Please sign in to comment.