KaiZen-OpenAPI-Editor icon indicating copy to clipboard operation
KaiZen-OpenAPI-Editor copied to clipboard

Improved support for JSON syntax incl. tab-indented JSON files

Open elicoten opened this issue 7 years ago • 5 comments

Please could I request that the Swagger editor support Swagger files intended with tabs rather than spaces?

We have some existing Swagger files that are indented with tabs and it would be good to be able to open them and use them as-is in the editor.

Thanks!

elicoten avatar Apr 04 '19 18:04 elicoten

@elicoten, this is a restriction of the YAML syntax itself, which specifically says that leading tabs are not recognized as indents. So whatever editor or generator produced your existing Swagger documents was not producing legal YAML.

Fortunately it's easy to fix this using a find and replace with regular expressions:

image

You can choose any number of space characters, as long as the indents are consistent within a sibling group.

tedepstein avatar Apr 04 '19 20:04 tedepstein

Thanks for your detailed and helpful reply.

However I was using JSON syntax rather than YAML syntax. I thought that that whitespaces and tabs are both meaningless to JSON syntax and therefore either should technically be acceptable?

Is there a way to change so that instead of attempting to interpret as YAML, it treats the document as JSON?

Thanks again

elicoten avatar Apr 05 '19 00:04 elicoten

@elicoten , the following support article is written for our commercial product, RepreZen API Studio. But most or all of the information and tips in that document are relevant to KaiZen OpenAPI Editor:

Working with Swagger-OpenAPI in JSON Format

If you are planning to maintain your OpenAPI v2 or v3 document in KaiZen Editor, we recommend reformatting it to YAML format as described in the support article. KaiZen, like most OpenAPI editors, works much better with YAML format.

tedepstein avatar Apr 05 '19 01:04 tedepstein

Ok, thanks for clarifying that, that does answer the question - at least insofar as what the editor currently supports.

In that case this issue should perhaps be renamed to include "JSON syntax" in the title, and is more a question about whether you would consider adding JSON syntax support more generally.

It sounds like you might not feel that's worthwhile in which case at least having this as a record may help someone else like me who was searching your github issues for information about indentation with tabs.

elicoten avatar Apr 05 '19 10:04 elicoten

@elicoten , please feel free to change the name and we can leave this issue open. We don't have plans to support full editing with JSON syntax at this time.

tedepstein avatar Apr 05 '19 11:04 tedepstein