json-schema-for-humans icon indicating copy to clipboard operation
json-schema-for-humans copied to clipboard

Mirror input schema dir structure for result files

Open dblanchette opened this issue 3 years ago • 4 comments

from #117

@dblanchette finally, and let me know if you want to consider this a separate feature request, but it is connected - when you glob for schema files, i think it's common that you want the output to match the same directory structure.

E.g. if I find foo/bar.schema and foo/baz/xyz.schema and I provide an output path of docs/, I want the output structure to match; e.g. /docs/bar.html and /docs/xyz.html

At the moment, because I have identically named files but in different directories, json-schema-for-humans is overriding the output html file and I am forced to either rename my files (not possible because of a separate constraint) or run the tool multiple times with different paths (my current reluctant workaround).

Let me know your thoughts. I would think this would just be another option you could provide in config-file, "output_dir_mirror_structure"

Originally posted by @adamcunnington-mlg in https://github.com/coveooss/json-schema-for-humans/issues/117#issuecomment-966399491

dblanchette avatar Nov 11 '21 16:11 dblanchette

Thanks. Critical typo from me in description (although hopefully the ask is still clear): E.g. if I find foo/bar.schema and foo/baz/xyz.schema and I provide an output path of docs/, I want the output structure to match; e.g. /docs/bar.html and /docs/baz/xyz.html

adamcunnington-mlg avatar Nov 11 '21 16:11 adamcunnington-mlg

I did understood it like that indeed.

Dir structure:

foo
  bar.schema
  baz
    xyz.schema

Input glob: foo/*.schema Output dir: docs output dir structure:

docs
  bar.schema.html
  baz
    xyz.schema.html

Correct?

dblanchette avatar Nov 11 '21 16:11 dblanchette

Yep, bang on.

adamcunnington-mlg avatar Nov 11 '21 17:11 adamcunnington-mlg

Hi! I'm facing this limitation too.

Is there any plan on having this in the near future? Would PRs be accepted? Haven't check the code, any easy estimation on how complex this could be?

@adamcunnington-mlg You mention to traverse the directory structure and run the tool from each directory while building the output directories too as workaround. What about links between json schemas in different directories? Is the workaround strategy supporting this scenario?

sgomezvillamor avatar May 27 '22 08:05 sgomezvillamor