-
Notifications
You must be signed in to change notification settings - Fork 2
Tweak: depracation notices and type hint properties. #23
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
Co-authored-by: Jon Waldstein <[email protected]>
Co-authored-by: Matthew Batchelder <[email protected]>
Yes @JasonTheAdams you are correct. I am building on top of you code and also i am bringing in here the schema updates from here |
This is really neat, @dpanta94! Thanks for this! I'm really tempted to suggest this should be it's own I think simply having another library that depends on both packages could be a good idea. It keeps this lean and less opinionated. An alternative would be to flip this and have it be in Schema, making this package a dependency. |
@JasonTheAdams thanks for your comments. This PR simply enables integration with another stellarwp library, schema. It doesn't add any dependency, you simply can continue using the rest of the library (anything other than SchemaModel) like you used to. If it happens that your project use both models and schema like we do in TEC, you can take advantage of the existing integration between 2 stellarwp libraries which i find very logical and honestly something to be expected. |
To be clear, @dpanta94, I think this is a great bridge feature. My question is whether it should be in this package, in the Schema package, or in its own package entirely. It's not quite true to say "it doesn't add any dependency" — it adds the Schema package to composer, which means that everywhere using this package will now also load that one. Schema also requires initialization, which adds a bit of risk (though I don't think this requires it to be initialized in every case). Personally, I think it makes the most sense for this to live in Schema, because I think there's a higher chance that if someone is using Schema they're also using Models, whereas there's significant use case where someone is using Models without using Schema. |
@JasonTheAdams i could see it going that way, but i think you might be confused because of the diff. Stellarwp/schema is required only as a dev dependency and that is only to test it. When you will require stellarwp/models in your project you will not get the schema package along with it. So i still believe it does not add any dependencies. It's up to the developer using it whether they want to integrate it with schema or not. |
That doesn't make sense, we're using classes from Schema (e.g. |
@JasonTheAdams personally i think it does make sense. If we were creating a WC integration, we would not require the whole WC codebase. We would register based on if it's loaded or not. Similar here, we are adding an integration for schema. If you don't have schema required in your project you can't use the SchemaModel interface, but if you do have it you can. If you try to use it when you don't have it, you will get a fatal very fast, loud and clear in your development phase. |
I think there are good points being made here by both @dpanta94 and @JasonTheAdams. Initially, I was in complete agreement with @dpanta94 - the overhead of a separate repository to provide the interface, the abstract class, and the tests seems like overkill. The developer experience is straightforward - they won't see errors if they don't use the interface or class. However. The developer experience can be pretty bad (and maybe dangerously so) if the developer builds out the code with dev dependencies and then assumes the Schema library is available when it actually isn't. It would definitely result in fatals in production if the developer never ran the code without So - after chewing over it a bunch, I think a |
Here's the new repo: https://github.com/stellarwp/schema-models |
I think this approach is better considering your very well though argument with the scenario that someone may be developing while requiring all dependencies. Tomorrow i will move the SchemaModel work to the new repo. We would still need to merge #22 of this repo though and release v2.0.0. I can create a PR that is also bringing that across the finish line. Thank you both @JasonTheAdams and @borkweb 🖖 ! |
Fixes deprecation notices.
makes declarations be enforced by type hinting.
ignores generated files from repo.
Amends changes in tests.
adds docs and imports.