api-designer
api-designer copied to clipboard
CodeMirror is slow
Hello,
I have been working on some models (a few thousand of lines) for my customer (SNCF).
My models include very big json files (examples of request and response data).
I understand that CodeMirror is well suited for editing the raml files.
But It seems to me that CodeMirror is overkill for visualizing JSON files.
I replaced CodeMirror with a "simpler" editor (https://github.com/hrovira/jsoneditor)
The tool is now much much faster ...
Maybe you could keep on using CodeMirror for the RAML files and choose another editor for the other kind of files ?
Best regards, Mehdi
Hi @elkouhen this is a really good suggestion. CM is a bit slow, although it is not 100% its fault. We also do a lot of magic in the back when you are editing a RAML file. Using a separate editor for non RAML content is a good idea. Thanks a lot!
I love the idea too, but I’m thinking about the UX — how do we know which editor to create? Specifically, how do I know, when a user creates a new file in the designer, whether to use a CM instance or a different editor? Would we suggest they use a different extension for these files? Say the user created a file named schemas.json, we could use a more efficient JSON editor. But when I !include a set of JSON schemas, the file itself is a RAML fragment, something like:
- users: |
{
"$schema": "http://json-schema.org/draft-03/schema" ,
"type": "array",
"items":
{
"type": "object",
"properties":
{
"id": { "type": "string", "required": true },
"name": { "type": "string", "required": true },
"email": { "type": "string", "required": true }
}
}
}
- user: |
{
"$schema": "http://json-schema.org/draft-03/schema" ,
"type": "object",
"properties":
{
"id": { "type": "string", "required": true },
"name": { "type": "string", "required": true },
"email": { "type": "string", "required": true }
}
}
So should there be different extensions for RAML fragments, and specifically ones that are optimized for JSON or XML?
Fully for using a separate JSON Editor to create JSON schemas and examples. Therefore, can we reopen this discussion, please :)