Closed sprak3000 closed 1 year ago
@sprak3000 Thank you for your comment!
The JSON of tbls out
is indented because it is the final output, but the schema.json of tbls doc
is not indented because it is metadata.
It would be helpful to have a configuration option allowing both commands to either indent or not based on its value.
Are there any use cases where this would be helpful?
(I don't particularly care about indentation as I believe the jq
command has become common.)
@k1LoW
The JSON of tbls out is indented because it is the final output, but the schema.json of tbls doc is not indented because it is metadata.
Conceptually, what is the difference between the two for you? I put together a quick PR around this to output both indented. I cannot see any difference between the two outputs; they result in the same JSON structure.
Are there any use cases where this would be helpful?
My use case is checking these files into a repo as documentation and being able to quickly and easily see the differences in a PR. Currently, our pipeline creates the file using tbls doc
resulting in the inline version. Trying to read a diff of a single, lengthy line of JSON isn't pleasant.
believe the jq command has become common
It is, but this tool could do the same meaning one less dependency. Regardless, thank you very much for creating and maintaining this tool!
My use case is checking these files into a repo as documentation and being able to quickly and easily see the differences in a PR. Currently, our pipeline creates the file using tbls doc resulting in the inline version. Trying to read a diff of a single, lengthy line of JSON isn't pleasant.
fmfm. So what about changing the schema.json of tbls doc
to indented output?
I don't think we need a specific option to change it to inline ( because I use jq
).
fmfm. So what about changing the schema.json of
tbls doc
to indented output? I don't think we need a specific option to change it to inline ( because I usejq
).
I'd be fine with that, but I'm also fine leaving it as is and adding jq
into our process. We typically have it on hand, so it isn't a large lift. Feel free to close this out if you like and / or close out my PR.
Thank you again!
Cheers.
@sprak3000 Thank you. I'll think about indentation again.
My use case is checking these files into a repo as documentation and being able to quickly and easily see the differences in a PR. Currently, our pipeline creates the file using
tbls doc
resulting in the inline version. Trying to read a diff of a single, lengthy line of JSON isn't pleasant.
This is my use case too.
Requiring an extra step to use JQ seems silly when there is a flag available in the go library.
Maybe adding an option in .tbls.yml
would make better sense to satisfy us.
Having said that, my workaround was to simply disable the schema.json
file using: disableOutputSchema: true
Currently, the JSON schema can be generated in two ways but with different indentation of the output. Running
tbls doc
results in the output file containing no indentation, just a single string of JSON. Runningtbls out -t json
results in an output file where the JSON is indented making it easier to read. It would be helpful to have a configuration option allowing both commands to either indent or not based on its value.The
OutputSchema
function controls this behavior via aninline
parameter on theJSON
struct. Theout
command passes infalse
. Thedoc
command passes intrue
. Both appear to have access to the configuration.Seems like a straightforward change with the only question in my mind is if there should be two separate configuration items to allow you to configure both commands separately or just one that both commands use.