jsonschema2md
jsonschema2md copied to clipboard
Possibility to also show which properties are required
Would it be possible to add an option that prints out the required properties of the jsonschema ? This would come in handy in numerous cases. Take for example the following simple schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Test schema",
"description": "I am a test schema.",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the person."
},
"lastName": {
"type": "string",
"description": "Last name of the person."
},
"address": {
"type": "string",
"description": "Where does the person live."
}
},
"required": [
"name",
"lastName"
]
}
It gets currenty translated into the following markdown:
# Test schema
*I am a test schema.*
## Properties
- **`name`** *(string)*: Name of the person.
- **`lastName`** *(string)*: Last name of the person.
- **`address`** *(string)*: Where does the person live.
It would be nice if some kind of reference to the fact that two properties are required would be there. If this was already discussed and decided to be irrelevant sorry for the spam.
You probably use an old version because it's already implemented!
I think that I was able to reproduce the error on main.
In https://github.com/sbrunner/jsonschema2md/pull/18 you introduced the possibility to show required attributes. However, this only worked properly within the definitions keyword. Here the required keyword is on a higher level.
Within the PR #331 I also added test for the bug I tried to report here.
I believe this should be closed with #331.
@sbrunner Can you close this?
Sure, thanks :-)