-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Handling schema true and false #232
Comments
After a lengthy discussion on Slack with the json-schema community my perspective of the |
@magicmatatjahu @derberg thoughts? 🤔 |
@jonaslagoni I saw your discussion in slack. If this doesn't represent the data but rather indicates if data can exist, then I guess we should not assign id to it. On the other hand, you would generate a data type for it right, even if it is just false/true? |
Yes, with for example in typescript I would want to generate I think we shouldn't assign uid to those schemas and just ignore them as you said 😄 |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
I also ran into this problem 😅 However ids are not the biggest problem at the moment, but the fact that the Base model is not adapted to use the If you write [
"/components/schemas/lightMeasuredPayload/properties/lol should be object at line 156, column 9"
] You can check it in https://playground.asyncapi.io/ |
but then just Base model needs to be fixed right? the problem that is there is not intentional imho. It is a typical check you do there, to throw an error if an argument is not passed to the function. We just need a better check, if json is undefined, or am I missing something? |
@derberg You're right, it's check not only for Schema but only for other models... so we should override constructor for Schema model like: class Schema extends Base {
constructor (json) {
if (!json && json !== false) throw new ParserError(`Invalid JSON to instantiate the ${this.constructor.name} object.`);
this._json = json;
}
// rest of class
} |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
Describe the bug
You can define a schema as
true
orfalse
to accept or reject all such asNow the problem is that our anonymous uid assignment tries to assign a uid to such schemas when its not possible.
This problem triggered the tests to fail for asyncapi/raml-dt-schema-parser#25.
Expected behavior
There are a couple of ways we can handle this.
true
orfalse
uids.true
orfalse
to its sugarcoated values{}
and{"not": {}}
The text was updated successfully, but these errors were encountered: