Cyclic dependency issue
See original GitHub issueHi, I am having a issue with cyclic dependency within a schema. I have looked at this issue, but what was suggested didn’t work for me.
yup.object().shape(
{
sub_building: yup.string(),
building_name: yup.string().when('building_number', {
is: building_number => !building_number,
then: yup.string().required(),
}),
building_number: yup.string().when('building_name', {
is: building_name => !building_name,
then: yup.string().required(),
}),
street: yup.string().required(),
town: yup.string().required(),
county: yup.string().required(),
},
['sub_building', 'building_name', 'building_number', 'street', 'town', 'county']
);
This is my schema. Basically i would like either building_number
or building_name
to be filled.
Thanks for your help in advance.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:18
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Circular dependency - Wikipedia
In software engineering, a circular dependency is a relation between two or more modules which either directly or indirectly depend on each other...
Read more >What is a circular dependency and how can I solve it?
A circular dependency is where Project A depends on something in Project B and project B depends on something in Project A. This...
Read more >Cyclic Dependency - an overview | ScienceDirect Topics
A cyclic dependency is formed when two or more abstractions have direct or indirect dependencies on each other. Cyclic dependencies between abstractions ...
Read more >Circular Dependencies in Spring - Baeldung
When we have a circular dependency, it's likely we have a design problem and that the responsibilities are not well separated.
Read more >How to fix nasty circular dependency issues once and for all in ...
The module loading order in JavaScript is deterministic. Yet it is not very easy to follow in large projects. The reason for this,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Both ideas from https://github.com/jquense/yup/issues/79#issuecomment-274174656 worked for me
or
I needed either county or state to be filled in
@cenda the second argument to
object.shape()
is not an array of conflicting fields. its an array of field pairs. e.g.[['street', 'zip_code'], ['zip_code', 'city']]
you need to make the list exhaustive