- 
  Notifications
 You must be signed in to change notification settings 
- Fork 1.4k
DOCSP-50472: schema validation #3400
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
Conversation
...aravel-mongodb into DOCSP-50472-jsonSchema-method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some small things then LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: can you only implement schema validation when using these methods for these specific purposes? or is the info after the colons just a reminder of the method's purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the only two methods in Laravel's Schema that accept a callback to alter columns, so you can only implement schema validation on either creating a collection or updating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: i wonder if the connection between these two sentences would be clearer if you switched them. something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: break up paragraphs differently. could also then remove first 'JSON'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this paragraph per PV suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I: no periods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to a list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$jsonSchema doesn't need to be included in the schema argument (see the example). Since the method is Blueprint::jsonSchema, the '$jsonSchema' operation is already implied.
So this documentation may be valid for MongoDB server but not for Laravel usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh also! Since this is PHP, the schema argument is not an object, but an associative array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we actually include this documentation? Seems to me the $jsonSchema operation is covered by the Mongo server docs. The Laravel ORM passes the schema through as is. I think specifying allowed fields here puts us in a situation of having to update this documentation when Mongo server specs change, when the user could just use the Mongo server docs as the single source of truth for jsonSchema usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense - I'll cut out some of this text and apply the suggestions from your prev comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! 🙏
Uh oh!
There was an error while loading. Please reload this page.
https://jira.mongodb.org/browse/DOCSP-50472
Adds documentation for the
jsonSchema()method.Staging: https://deploy-preview-193--docs-laravel.netlify.app/eloquent-models/schema-builder/#implement-schema-validation
Checklist