Closed RothAndrew closed 5 months ago
@RothAndrew Is the issue how you declare it in comment or generated schema? I think it boils down to the yaml library because null
and absent will be translated in go to nil
. If I remove that check, then every property will get "Default: null
to the schema even if you don't use it comment.
Can you provide more info or use case?
EDIT: nevermind, skip to the bottom. Even if this tool did what I thought I wanted it to do, the jsonschema2md
tool just discards the default key if its value is null
.
Hello!
My use case is that I'm using this tool, followed by Adobe's jsonschema2md
to do my documentation. It suits my needs better than helm-docs.
Several of my helm values default to null
. If I do this in the values.yaml:
someValue: null # @schema type: [string, null]; default: null
The default never shows up in the .schema.json file.
If I do this instead:
someValue: null # @schema type: [string, null]; default: "null"
the .schema.json value has a default, but it is the string "null" instead of JSON's null
.
My markdown documentation then makes it seem like the default value is the string "null"
If I manually edit the .schema.json file to:
...the default doesn't show up in the markdown at all... Maybe this is a limitation of JSON schema.. Okay nevermind, I'll figure out how to document this in a different way.
If I use:
The default is not recorded in the schema.
I can use
default: "null"
which does work, but it makes it look like the default should be the string"null"
rather thannull
which is not a string in YAML-land.This issue looks to be unique to
null
. If I have a boolean like:That works fine, and correctly says the default is
true
, not"true"