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

Ability to load YAML map into hash table #66

Open
JamesDunne opened this issue Dec 27, 2018 · 4 comments
Open

Ability to load YAML map into hash table #66

JamesDunne opened this issue Dec 27, 2018 · 4 comments

Comments

@JamesDunne
Copy link
Contributor

It seems this library is limited to loading only structured maps into specific C structs with known (static) keys and types. It would be useful to allow a map with unknown (dynamic) keys to be loaded into a runtime hash table data structure. Or at the very least provide an example of how to escape the libcyaml binding mechanism and be able to work at the libyaml level for a specific schema.

@tlsa
Copy link
Owner

tlsa commented Jan 8, 2019

I've been thinking about this. It kind of goes against the core principal of the library, which is that it simply slots data into client-defined data structures.

I was assuming that anything that required loading data who's structure wasn't known up-front would be done better by using libyaml directly.

On the other hand, I've considered a CYAML_CUSTOM value type, which would need a callback function, and the client would get to handle the libyaml events. However, I don't like exposing a libyaml API requirement through libcyaml's API.

Anyway, thanks for the feedback/request. I need to think about it some more!

@JamesDunne
Copy link
Contributor Author

The problem is then that libcyaml becomes useless if I want to use it for the majority of my use cases but I have this one bit of yaml that requires that I parse it into a hash table. I think the CYAML_CUSTOM value would be very useful and offers that escape hatch. Usage of libcyaml requires linking in libyaml anyway so there's no shame in exposing some libyaml APIs or data structures via libcyaml, unless you were planning on uprooting your implementation to use some other low-level yaml parsing library.

@XisonChen
Copy link

@tlsa Is it now supported to load YAML map into hash table ?

@tlsa
Copy link
Owner

tlsa commented Feb 28, 2024

@XisonChen No, it's not currently supported.

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

No branches or pull requests

3 participants