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

How to document/specify/provide schemas for nested data structures #7

Open
PietroPasotti opened this issue Jun 3, 2022 · 4 comments

Comments

@PietroPasotti
Copy link
Contributor

Databags are flat string:string mappings.
Sometimes relation databags need or want more structure and therefore the values of that mapping are yaml/json/b64/pickle-encoded complex objects.
In our schemas we'd like to document what the structure of those complex objects are.

How do we document the type of encoding used?

@simskij
Copy link
Member

simskij commented Jun 7, 2022

the values of that mapping are yaml/json/b64/pickle-encoded complex objects

Do we have any examples of where it is something other than JSON? Should we? I'm not convinced. However, if we need this, the description field of a particular key/value pair seems like an excellent place to put this. WDYT?

@PietroPasotti
Copy link
Contributor Author

In traefik it's yaml.
In serialized-data-interface it was all yaml. In traefik-route I used json IIRC (thinking later we'd move Traefik to json as well)
In other projects, I don't know, but I think we can't take that for granted.
Agreed, we should put that in the field description. What's ugly about this is that the 'example' will be harder to read and it will obfuscate the internal structure of the object, since to be truthful we have to write yaml/json/whatever instead of the (json) data structure.

@jnsgruk
Copy link
Member

jnsgruk commented Jun 8, 2022

I think in general my feelings are:

  • Don't nest unless you really need to
  • If you really need to, use JSON

Any objections there?

@simskij
Copy link
Member

simskij commented Jun 8, 2022

Any objections there?

This is my point of view as well. People might use yaml, pickle or whatever, but if they want it to be part of the spec, I would be perfectly fine with making JSON serialized data structures a requirement.

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