-
-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
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.10.2
Plugin version
No response
Node.js version
16.14.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
5.10.167-1-MANJARO
Description
I think there is a problem with using ref + raw in the object schema in that the values added by the raw() function are removed or not included
Steps to Reproduce
correct
fluent.ref('foo').raw({test: true}).valueOf()
{ '$ref': 'foo', test: true }incorrect
fluent.object().prop('a', fluent.string()).prop('test', fluent.ref('foo').raw({test: true})).valueOf()
{
'$schema': 'http://json-schema.org/draft-07/schema#',
type: 'object',
properties: { a: { type: 'string' }, test: { '$ref': 'foo' } }
}I suspect it is from the object schemas handling of ref
fluent-json-schema/src/ObjectSchema.js
Lines 321 to 331 in ab242d2
| return ObjectSchema({ | |
| schema: { | |
| ...schema, | |
| [target]: [ | |
| ...schema[target], | |
| $ref ? { name, $ref } : Object.assign({}, { name }, attributes) | |
| ] | |
| }, | |
| ...options | |
| }) | |
| }, |
Expected Behavior
I'd expect the properties defiend by .raw() to be carried unconditionally to the object they are defined
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers