Skip to content
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

multi level yml check #12

Open
shahzeb79 opened this issue Jun 4, 2020 · 6 comments
Open

multi level yml check #12

shahzeb79 opened this issue Jun 4, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@shahzeb79
Copy link

Required not working correctly on multi level file. For example
I define schema as:

person: 
   name:
      type: string
      required: true
   dob:
      type: string
car:
   name:
      type: string
      required: true

and my yml under test can be:

car:
    name: 'BMW'

So it should not complain person.name is required.
Currently it complain that person.name is missing. It should only complain if upper level object exist eg

car:
    name: 'BMW'
person:
   dob: 24-10
@rockon1985
Copy link
Collaborator

@shahzeb79 If you have mentioned person.name as required in your schema, the target would need to have person field. As the person.name field's existence cannot be verified if person itself is not present.

The parent field cannot be skipped to check nested child's required check. It can only be done by removing required field from the nested field.

What is needed I believe is another property like requiredIfParentExist: true. I would mark it as a feature request that can be added in next release.

@rockon1985 rockon1985 added the enhancement New feature or request label Jun 4, 2020
@shahzeb79
Copy link
Author

Thanks alot. It will be good as i have alot of cases where it should be existing only if parent exist.

@shahzeb79
Copy link
Author

Hi @ketanTechracers ,
Do we have any timeline when you could add this feature?

@rockon1985
Copy link
Collaborator

@shahzeb79 Planning to add it by June end.

@shahzeb79
Copy link
Author

Hi, do you have any progress on it?

@matrunchyk
Copy link

I'm also interested in this feature. Are there any plans to continue support of this great package? Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants