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

Use string keys for everything in the json-ld.api namespace #414

Closed
cap10morgan opened this issue Mar 10, 2023 · 2 comments
Closed

Use string keys for everything in the json-ld.api namespace #414

cap10morgan opened this issue Mar 10, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@cap10morgan
Copy link
Contributor

cap10morgan commented Mar 10, 2023

We're running into recurring bugs w/ JSON requests because our internal API fns want keywords but the JSON-LD keys need to remain strings even after deserialization. So we should just change our API fns to accept string keys for everything and then add a thin CLJ SDK wrapper that accepts keywords, string-ifies them, and then passes that to the corresponding API fn.

Open question: Should we do any keyword-ification of return values in the CLJ SDK wrapper? Perhaps keys defined by us (i.e. not in user data; things like t, commit in transaction responses, address, alias in ledger create responses, etc.) and then user data keys based on the supplied context (i.e. if it uses keywords or not)? OR we could just have a bool keyword-response-keys? or similar option that tries to keywordize everything or throw an error if anything wouldn't be a valid keyword (or just leave it as a string).

@cap10morgan cap10morgan added the enhancement New feature or request label Mar 10, 2023
@cap10morgan cap10morgan added this to the 3.0.0-alpha2 milestone Mar 10, 2023
@bplatz
Copy link
Contributor

bplatz commented Mar 10, 2023

Open question: Should we do any keyword-ification of return values in the CLJ SDK wrapper? Perhaps keys defined by us (i.e. not in user data; things like t, commit in transaction responses, address, alias in ledger create responses, etc.)

I think we should for metadata-like keys we might return with an API response, but not touch any "data payloads". Using query as an example, query responses are pure data by default, but we have the :meta? option (or something like that) that can optionally return an outer map with execution time, fuel, etc. I think those are a handful of keys and easy to keywordify, and what a CLJ dev would expect to see.

We still would retain the ability to use keyword-based contexts... so if you wanted your payload keyword-ified as well you can do that... but our default handling is always the actual context, which is string-based.

@cap10morgan
Copy link
Contributor Author

Not doing this after all

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

2 participants