Skip to content

Extend schema does not extend properties, but overrides them  #65

@jmav

Description

@jmav

Following example will override title attribute because prop in NEW_SCHEMA is overriding one from SCHEMA_BASE.

To Reproduce

const SCHEMA_BASE = S.object()
  .prop(
    'reason',
    S.string()
      .title('Reason 1')
  )

const NEW_SCHEMA = S.object()
  .extend(SCHEMA_BASE)
  .prop(
    'reason',
    S.string()
      .minLength(1)
  )
  

Expected behavior

Props should be extended with with only changed attributes.

Environment

  • node version: 10
  • fastify version: >=2.0.0
  • os: Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions