Prerequisites
Fastify version
4.x.x
Plugin version
4.2.1
Node.js version
18.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Manjaro 5.10.218 x86
Description
Once you call extend on a schema, the function chain is broken because the extend function returns a plain object rather than an instance of the schema being extended. This breaks the normal usage of the builder pattern implemented by this library.
Link to code that reproduces the bug
|
return { valueOf, isFluentSchema, FLUENT_SCHEMA, _getState, extend } |
Expected Behavior
One should be able to continue chaining function calls such as without or only, etc after calling extend.
It should be safe to use the schema factory function found on the schema to build out a new instance of the same type.
Prerequisites
Fastify version
4.x.x
Plugin version
4.2.1
Node.js version
18.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Manjaro 5.10.218 x86
Description
Once you call
extendon a schema, the function chain is broken because the extend function returns a plain object rather than an instance of the schema being extended. This breaks the normal usage of the builder pattern implemented by this library.Link to code that reproduces the bug
fluent-json-schema/src/ObjectSchema.js
Line 350 in 6db9f0b
Expected Behavior
One should be able to continue chaining function calls such as
withoutoronly, etc after calling extend.It should be safe to use the schema factory function found on the schema to build out a new instance of the same type.