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

Allow alternative extensions #43

Closed
autarch opened this issue Apr 9, 2018 · 9 comments
Closed

Allow alternative extensions #43

autarch opened this issue Apr 9, 2018 · 9 comments

Comments

@autarch
Copy link

autarch commented Apr 9, 2018

It would be really nice to allow other extensions besides .schema.json. This is not at all standard, and AFAICT the most common recommendation is to simply use .json. It'd be nice if this was an option on the CLI.

@trieloff
Copy link
Collaborator

I agree. We use *.schema.json, so that we can automatically merge *.example.*.json and *.description.md, which makes authoring a bit easier, but it would be a nice addition to support other extensions.

@anjankaur
Copy link
Contributor

Currently, schema and example files are in same folder. And so we identify these with their respective extensions. If we support just .json then, we won't be able to differentiate between them without actually first parsing the files.
Maybe what we can do is, if a file does not fit into these 2 extensions, and has .json extension then automatically consider it as schema file. Or we can decide to put examples in separate folder(less desirable option, for me).

@trieloff
Copy link
Collaborator

I would add three parameters: --schema-extension and --example-extension and maybe --description-extension to clarify this.

@anjankaur
Copy link
Contributor

Yeah this is a good idea. But this would necessarily mandate that both extensions should be different, using .json for both won't work.

@robvenn
Copy link
Contributor

robvenn commented Apr 19, 2018

I am looking into this tool use it for schema's in a certain folder with plain .json extensions... so it would be nice to be able to configure that. Also wondering why the output always contains the validated json files as well, might be interesting to make that optional.

@trieloff
Copy link
Collaborator

@robinvenneman one reason why we create the JSON Schema file output is to allow inlining of *.description.md files, so that authoring longer descriptions becomes a bit easier.

In the future, we might even support js input format, so that authoring schemas becomes a bit less verbose.

But I agree on making it optional.

robvenn added a commit to robvenn/jsonschema2md that referenced this issue Apr 19, 2018
@robvenn
Copy link
Contributor

robvenn commented Apr 19, 2018

Alright, I've added a CLI option in 3d25c37. @trieloff feedback welcome... please let me know if you can use this and if it requires additional work for a PR.

@trieloff
Copy link
Collaborator

Looks good. What would make it really fast for me to merge:

  • add a test case that fails and commit (CircleCI will mark it)
  • fix the test case

robvenn added a commit to robvenn/jsonschema2md that referenced this issue Apr 22, 2018
@robvenn
Copy link
Contributor

robvenn commented Apr 22, 2018

@trieloff I've added a test which should fail at the moment in feature/43-schema-extensions.
Perhaps a schema with a different file extension can be added to test this flag.

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

No branches or pull requests

4 participants