Skip to content

Commit

Permalink
Enable Markdown in schema descriptions (devfile#93)
Browse files Browse the repository at this point in the history
* Fix the space and line return management as generated
by the operator-sdk in the CRD OpenApi schema,
so that the descriptions in Json schemas can be markdown with lists.
It mainly cleans up spaces added before and after line returns.
And double every line return unless it is before a list item.

* Copy the descriptions to a new `markdownDescription` so that VSCode can present markdown in hovers.

* Update generated schemas

Signed-off-by: David Festal <[email protected]>
  • Loading branch information
davidfestal authored Jul 2, 2020
1 parent f5fd4ba commit 122bbc6
Show file tree
Hide file tree
Showing 6 changed files with 3,267 additions and 1,570 deletions.
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ onError() {
}
trap 'onError' ERR

sed -i -e '/"description":/s/ \\n - /\\n- /g' -e '/"description":/s/ \\n \([^-]\)/\\n\\n\1/g' "${BASE_DIR}/schemas/devworkspace-template.json" "${BASE_DIR}/schemas/devworkspace.json"

transform "devworkspace" "${BASE_DIR}/schemas/devworkspace-template.json" ""
transform "devworkspace" "${BASE_DIR}/schemas/devworkspace.json" 's#"path" *: *"/properties/spec/#"path": "/properties/spec/properties/template/#'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
walk(if type == "object" and .description then . += { markdownDescription: .description } else . end)
1,113 changes: 749 additions & 364 deletions schemas/devfile.json

Large diffs are not rendered by default.

Loading

0 comments on commit 122bbc6

Please sign in to comment.