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

Support map[interface{}]interface{} as an object value #50

Open
b5 opened this issue Jul 30, 2019 · 3 comments
Open

Support map[interface{}]interface{} as an object value #50

b5 opened this issue Jul 30, 2019 · 3 comments
Assignees
Labels

Comments

@b5
Copy link
Member

b5 commented Jul 30, 2019

If we supported all values this package maps to, we can validate CBOR data without first passing through JSON. Here's an example that works right now:

https://play.golang.org/p/kpCThgKoV_x

This will choke if you try to validate object types, however, because codec deserializes CBOR to map[interface{}]interface{}. many deserializers need to map to interface{} keys. Supporting this would be a step in the right direction for validating on go types.

@b5 b5 added the feat label Jul 30, 2019
@dolmen
Copy link

dolmen commented Jun 8, 2020

Duplicate of #60.

@dolmen
Copy link

dolmen commented Jun 24, 2020

Isn't Schema.Validate what you want?

@Arqu Arqu self-assigned this Sep 7, 2020
@Arqu
Copy link
Contributor

Arqu commented Sep 7, 2020

@dolmen as with the other issue, there's a bit more internals that rely on json specific stuff which prohibits these usecases. While that method takes an interface as a type abstraction, it definitely insists on very clean json serialization.

In the above case, this we would need to adapt many if not all keywords with custom marshaling logic to correctly (de)serialize the keys as well.

Would be neat though.

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

No branches or pull requests

3 participants