-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set $id after clone #193
Comments
@Eomm instead of resetting the ID would it make sense to just omit it? I'm not sure it should even reference the $id at this point... .only & .without are state mutations that invalidate the ref aka should compose new objects not mutate the old? |
It would need to be both. It would need to omit the id by default, and allow you to set it in the correct location of the schema |
I'm happy to open up a PR handling both if @Eomm or other core folks thinks it make sense. |
Yes, I agree:
Note that this would be a breaking change |
Ok cool, I'm gonna take a stab this weekend or if I get some time after hours. 🚀 |
The problem is rooted in the use of fluent-json-schema/src/utils.js Lines 188 to 195 in 490c24d
Once an object has properties, all things are added to its properties rather than the root of the schema. this doesn't seem too hard to fix |
resolved by #195 |
Prerequisites
Issue
Given an origin flunet-json-schema object filtered with
only/without
it is not possible to set the BaseSchema's$id
:Shows:
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "$id": "whizbang", "title": "WhizBang", "properties": { "whiz": { + "$id": "asd", "type": "string", "minLength": 1 } }, "required": [ "whiz" ] }
I can't find a way to set the
"$id": "whizbang"
field.Ref fastify/fastify#4276
The text was updated successfully, but these errors were encountered: