Closed ilia-wolke7 closed 2 years ago
Hi, thanks for using Yamale.
Do you control the format of this yaml? I'd suggest doing this instead:
graph:
links:
link03:
start_node: 0
end_node: 3
link13:
start_node: 1
end_node: 3
Or if it MUST be a list, to do this:
graph:
list:
- name: link03
start_node: 0
end_node: 3
- name: link13
start_node: 1
end_node: 3
If you don't have control over the schema, your validation rules will be a bit limited. Here's something that will work:
graph:
length: int()
list: list(include('graph_item'))
---
graph_item:
map(int(), null(), key=str())
But you're unable to require that start_node
is an integer.
I suggest changing your yaml to one of the above examples instead, with a preference for the first example.
Dear @mildebrandt, Thanks a lot for the quick answer.
I have a bunch of this yaml files. I control them, but it is much work. Anyway, looks like no other solution is currently available.
it is a valid yaml file, right? If so yamale should support this in the future, right? Because schema tool should support a description of any valid schema.
Thanks a lot!
We do accept pull requests from users that would like to support a use case. We ask that they submit the proposed schema before submitting any code to ensure that it fits nicely within Yamale.
Thank you for your help. Currently I don't plan to dive into yamel programming. I am a user only. Just needed a schema tool and after short evaluation, yamel seemed to me most advanced for my needs. So the maximum I can do is a feature request. As for my use case, I will change my files as you have suggested.
Ok, I'll close this issue. Please reach out with any more questions in the future.
Dear devs, thanks for great tool. Are lists with arbitrary names supported? Can't find schema for following file. How do I describe arbitrary word link03 and link13. I have tried many combinations with str() but still find no solution. Thank you!