Skip to content

merged schema cache is messed up #676

Closed
@climba03003

Description

@climba03003

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions