-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Extend interfaces when extending schemas #53
Comments
That would be nicer, I'm not sure if Joi exposes this type of information, but this can be investigated |
I had a look around as well, but the documentation wasn't entirely conclusive... I've posted a question to the Joi repository, let's see what they come back with |
@mrjono1 The team at Joi said the information isn't exposed by default. They had another suggestion to use Not sure if that helps? I just realised that this isn't just a cosmetic issue, it seems part of the validation rules get lost when nested schemas get merged. If I extend this:
with this:
you end up with these two interfaces: IWorkspace
IPortfolio
But that's incorrect. Even if it doesn't end up extending (
|
It looks like they mean Step 2 Figuring out if you can do this, it does sound complicated but possible One concern though is people may be using |
I also found Joi.id() and Joi.extract() they seem interesting |
This would be a VERY helpful feature to have. If it is not able to be discovered via the Joi api, a solution using label or note seem very acceptable, if implemented in such a way that when specified it will add the extends NAME to the created interface. Happy to try to help, not sure where to start in this codebase to create the functionality though. |
In the code where it gets the interface name, i think it will have an array of 'className's so you should be able to tell what to extend, but figuring out which properties are on the base and current will be hard |
I have found in Joi where the data is, and modifying a test to be able to cover an implementation will be easy, because you already test concat. However, I cannot figure out where you write out the actual
it should just be able to write out All the other logic is already in place for having properly created the interface. I'm just trudging through the code and have a rather difficult time interpreting where that work is being done. |
Can you point me to something that might help me better understand how to modify the code base to add the "extends" to the output template? |
yes the code has gotten a bit confusing, I'm not sure where we would need to add this concept, it will take time to figure out |
I've made a start this adds the extends part #235 |
Hi!
I just realised that if you extend a schema, e.g.
You end up with two interfaces:
and
Wouldn't it make more sense to extend IProject with IWorkspace?
The text was updated successfully, but these errors were encountered: