Style JSON code with comments? #854
-
It is possible to enable comments in the json code for styling? Kind Regards |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Since JSON does not support comments, the answer unfortunately is a firm no. |
Beta Was this translation helpful? Give feedback.
-
Adding additional elements like "comments" in any object of the style should work, at least when the style is manually placed in the "api-resources" folder. However, when the style is accessed via the API, the "comments" member will no longer be included. The same is true, if a style is created/replaced via the API using POST/PUT. The reason is that for validation and security purposes the style content is de-serialized into a Java object following the style schema - and that does not include "comments" members. If the styles are not submitted via the API and the comments are only for those editing the styles, would adding additional members as needed work for your use case? If not, in what objects would you need a comments member in addition to layers? What can always be included is a top-level "metadata" member with any object content. This will be visible when the style is accessed via the API. |
Beta Was this translation helpful? Give feedback.
Adding additional elements like "comments" in any object of the style should work, at least when the style is manually placed in the "api-resources" folder.
However, when the style is accessed via the API, the "comments" member will no longer be included. The same is true, if a style is created/replaced via the API using POST/PUT. The reason is that for validation and security purposes the style content is de-serialized into a Java object following the style schema - and that does not include "comments" members.
If the styles are not submitted via the API and the comments are only for those editing the styles, would adding additional members as needed work for your use case? If not, in wh…