-
Notifications
You must be signed in to change notification settings - Fork 5
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
Consider not using $id
in every property
#72
Comments
The
|
$id
in every property
OK, so it doesn't disable it completely. I don't know why schema generators DO this. It's not needed. |
Thanks for the follow-up. I'm open for all suggestions but not sure that I understand the issue yet. Are you talking about the "STRING": {
"$id": "https://api.example.com/properties/STRING",
"type": "string",
"default": "Default value for STRING"
}, |
I'm guessing here but I see (and empathize) with two approaches:
If you are indeed after number 2... I'm perfectly fine with a PR that adds that as a config option. |
Why do you believe they WANT an $id for each property value?
😅Sure. I have the JSON Schema spec to work on though. I'm suggesting it should be the default. |
Since we're all busy let's agree to keep this ticket open so it does not get lost. I've added the Again, really appreciate your input and was not aware that we were generating invalid schema. Any chance you can provide use with a link to some information about that? Might help motivate. |
Ha. Sure! It's valid for draft-07, which is what (hopefully) most people will be using now. Draft 2019-09 and newer don't allow In terms of information, we haven't got much beyond the spec itself: http://json-schema.org/draft/2019-09/json-schema-core.html Appendix A might help: http://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.A
|
Awesome, much appreciated. Hope this does not sound silly but is there a change that that 2019-09 version will eventually turn into a new separate draft name like If so, I think:
I would be willing to put in the effort to get that new strategy up and running. |
Draft 2019-09 is effectivly draft-08. We decided to change the naming convention because using You could do that. Again, my advice is DO NOT include I go back to my question: Why do you believe they WANT an $id for each property value? |
Yes, 100% true. I made this lib because the alternatives, at the time, were either outdated, missing functionality or did not support Sequelize 6. Since I'm no schema specialist (at all) I took them for inspiration and used it as the basis to study the strategy pattern.
I do not believe anything but can imagine they would appreciate that. I could think up of more reasoning but IMO that's not really relevant. Your point makes sense. I'm just saying I understand the current approach as well. Anyway, I really appreciate your input, it shows you actually care about what's out there in the wild which is great by itself 💯 . I'm about to jump into the weekend now so will not be back until tomorrow. I still have a tiny doubt about whether I truly understand which exact points would require changing but perhaps you can bring up the patience to explain it to me some day, perhaps even via a discord chat or sth. |
Yeah, I am familiar with several libraries which do similar... it's a pain. Yeah, I have a vested interest in this project specifically, potentially. Now maybe not. If you want to drop by our slack server, it's pretty friendly, and covered in most timezones. |
@Relequestual I am preparing a major update and have just added the draft 2019-09 strategy here #88. To my surprise, running the generated schema with the ps: I am still going to make the |
@Relequestual the 2019-09 strategy now generates a schema:
Sample output can be seen here. Does this match what you were after? https://gist.github.com/bravo-kernel/b07ffcf120a5543e26e531de58c389cb |
Added configuration option Exception.. the topmost |
I'm assuming this config option results in the use of
$id
for every property.This is considered not best pratice... it's not required either.
The text was updated successfully, but these errors were encountered: