Skip to content

docs: clean up model docs - #14333

Merged
WikiRik merged 12 commits into
mainfrom
ephys/model-cleanup
Apr 21, 2022
Merged

WikiRik merged 12 commits into
mainfrom
ephys/model-cleanup

Conversation

@ephys

@ephys ephys commented Apr 6, 2022

Copy link
Copy Markdown
Member

Pull Request Checklist

Please make sure to review and check all of these items:

  • Have you added new tests to prevent regressions?
  • Does yarn test or yarn test-DIALECT pass with this change (including linting)?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description Of Change

This is a bit of a miscellaneous PR.
What it does is:

  • Fix many documentation issues in models
  • Update missing typings related to models
  • Synchronize model.d.ts and model.js, in preparation for their future merge
  • Remove the deprecated-in-v6 ModelCtor and ModelType types
  • Deprecate Model.dropSchema (it's completely unrelated to model, and is just an alias for Sequelize.dropSchema and QueryInterface.dropSchema)
  • Some elements of the documentation (such as explaining querying in details) have been removed in favor of a link to the relevant documentation page
  • Fix code examples not being wrapped in markdown code blocks
  • warnOnInvalidOptions has been renamed to _warnOnInvalidOptions because it's a private method (and may be moved to model-internals in the future)

@ephys ephys added the docs For issues and PRs. Things related to documentation, such as changes in the manuals / API reference. label Apr 6, 2022
@ephys ephys self-assigned this Apr 6, 2022
@ephys
ephys requested a review from a team April 8, 2022 20:32

@sdepold sdepold left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First half reviewed

Comment thread src/associations/belongs-to.d.ts Resolved
Comment thread src/model.d.ts Resolved
Comment thread src/model.d.ts Resolved
@ephys ephys mentioned this pull request Apr 10, 2022
8 of 15 tasks
@ephys

ephys commented Apr 11, 2022 •

Copy link
Copy Markdown
Member Author

I'm very close to completing #14280, just need to write a couple of tests. I'd prefer to merge this PR first though

@ephys

ephys commented Apr 12, 2022

Copy link
Copy Markdown
Member Author

Pending question: Model has both methods setAttributes and set. setAttributes is just an alias for set.

It looks like setAttributes was added by #5924

Which one should we deprecate?

In favor of keeping setAttributes:

  • The name is more explicit than set, especially since we have setDataValue too. Could help with readability as other methods expose a set method with completely different behaviors.

Against keeping setAttributes:

  • We need to add getAttributes, getAttribute, setAttribute to be complete
  • Model.getAttributes and Model#getAttributes would have completely different meanings

That last point makes me think we should keep set() instead.

@WikiRik

WikiRik commented Apr 13, 2022

Copy link
Copy Markdown
Member

I'll let @sdepold review the rest

About setAttributes, let's do that in a future PR. It would not really be useful if Model.getAttributes and Model#getAttributes do 2 completely separate things, but better naming is also nice to have.

@ephys

ephys commented Apr 13, 2022

Copy link
Copy Markdown
Member Author

I'll remove that part and open a follow-up PR for it once this PR has been removed so we can have a focused discussion on a solution :)

@ephys ephys mentioned this pull request Apr 13, 2022
5 of 6 tasks
@WikiRik

WikiRik commented Apr 19, 2022

Copy link
Copy Markdown
Member

@sdepold ping

@ephys

ephys commented Apr 20, 2022

Copy link
Copy Markdown
Member Author

Let me know when you're ready to review, I'll resolve the conflicts then

sdepold
sdepold previously approved these changes Apr 21, 2022
@WikiRik

WikiRik commented Apr 21, 2022

Copy link
Copy Markdown
Member

Okay, either I resolved the conflicts wrong or we need to update something to pass the tests when merging main in this. Either way, I'll leave this up to @ephys before I break anything

@ephys

ephys commented Apr 21, 2022

Copy link
Copy Markdown
Member Author

I'll do the merge again, it looks like a few things were merged incorrectly :)
Not surprising to be honest, the scope of the changes were going to lead to complex conflicts

@ephys
ephys force-pushed the ephys/model-cleanup branch from 615b7e8 to 0a12da1 Compare April 21, 2022 10:59
WikiRik
WikiRik previously approved these changes Apr 21, 2022
@ephys

ephys commented Apr 21, 2022

Copy link
Copy Markdown
Member Author

Fixed a failing test

Scrolling through the changes, I think we're good. Let's see what the integration tests have to say

@WikiRik
WikiRik merged commit d84fef9 into main Apr 21, 2022
@WikiRik
WikiRik deleted the ephys/model-cleanup branch April 21, 2022 11:15
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 7.0.0-alpha.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

vanthome pushed a commit to vanthome/sequelize that referenced this pull request Jun 12, 2022
* docs: clean up model docs

* fix: fix writable typing test

* feat: remove deprecated types

* feat: deprecate Model.setAttributes

* test: remove test for removed types

* feat: revert deprecation of Model.setAttributes

* fix: remove duplicate ModelStatic import

* test: fix primary key test

Co-authored-by: Sascha Depold <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs For issues and PRs. Things related to documentation, such as changes in the manuals / API reference. released on @v7

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants