RepreZen / KaiZen-OpenAPI-Editor

Eclipse Editor for the Swagger-OpenAPI Description Language
Eclipse Public License 1.0
115 stars 12 forks source link

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

Open elicoten opened 5 years ago

elicoten commented 5 years ago

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!

tedepstein commented 5 years ago

@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.

elicoten commented 5 years ago

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

tedepstein commented 5 years ago

@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.

elicoten commented 5 years ago

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.

tedepstein commented 5 years ago

@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.