fastify/fast-json-stringify

merged schema cache is messed up

Closed this issue · 2 comments

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.x

Plugin version

5.11.0

Node.js version

20.x

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

11

Description

I suspect it is deal to the merged schema cache is not properly handled, which means two seperate build procedure may try to use the same cache but it never exists.

Steps to Reproduce

import { build } from 'fast-json-stringify'

const schema = {
  type: 'object',
  properties: {
    enums: {
      type: 'string',
      anyOf: [
        { type: 'string', const: 'FOO' },
        { type: 'string', const: 'BAR' },
        { type: 'string', const: 'BAZ' },
      ]
    }
  }
}

build(schema, {
  schema: {}
})

build(schema, {
  schema: {}
})

Expected Behavior

No response

@climba03003 yeap the problem is with attaching a symbol property to the schema. I will fix it soon. The release is reverted.