adobe / adobe/jsonschema2md

if-then components get generated but are not linked to parent document

Open
#222 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
724
Forks
150
Avg merge
18h 22m
Merged PRs (30d)
4

Description

## What did you do
Convert the if-then example from JSON Schema doc at https://json-schema.org/understanding-json-schema/reference/conditionals.html using filename `test.json`. Example replicated below

## What did you expect to happen
The if-then parts should be in the file "test.md" .

## What happened
The files generated were:
```
README.md test-properties-country.md
test-else-properties-postal_code.md test-properties-street_address.md
test-else-properties.md test-properties.md
test-else.md test-then-properties-postal_code.md
test-if-properties-country.md test-then-properties.md
test-if-properties.md test-then.md
test-if.md test.md
```
So the files related to the if-then-else clause are generated, but there is no link to them, nor is the if-then-else structure documented in a way to understand the linked `then` and `else` clauses. In other words the file `test-if.md` has no links to the files `test-then.md` and `test-else.md` .

## What's your environment

* Operating System: Windows 10
* node.js version: 10.13.0
* jsonschema2md version: 4.1.1

## Do you have example files:

For this schema
```json
{
"type": "object",
"properties": {
"street_address": {
"type": "string"
},
"country": {
"enum": ["United States of America", "Canada"]
}
},
"if": {
"properties": { "country": { "const": "United States of America" } }
},
"then": {
"properties": { "postal_code": { "pattern": "[0-9]{5}(-[0-9]{4})?" } }
},
"else": {
"properties": { "postal_code": { "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]" } }
}
}
```

I'm getting following Markdown (in test.md)

```markdown
# Untitled object in undefined Schema

COMMENTED OUT for Github ```txt
COMMENTED OUT for Github undefined
COMMENTED OUT for Github ```

| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
| :------------------ | ---------- | -------------- | ------------ | :---------------- | --------------------- | ------------------- | -------------------------------------------------------- |
| Can be instantiated | No | Unknown status | No | Forbidden | Allowed | none | [test.json](../schemas/test.json "open original schema") |

## Untitled object in undefined Type

`object` ([Details](test.md))

# undefined Properties

| Property | Type | Required | Nullable | Defined by |
| :-------------------------------- | ------------- | -------- | -------------- | :------------------------------------------------------------------------------------------ |
| [street_address](#street_address) | `string` | Optional | cannot be null | [Untitled schema](test-properties-street_address.md "undefined#/properties/street_address") |
| [country](#country) | Not specified | Optional | cannot be null | [Untitled schema](test-properties-country.md "undefined#/properties/country") |

## street_address

`street_address`

- is optional
- Type: `string`
- cannot be null
- defined in: [Untitled schema](test-properties-street_address.md "undefined#/properties/street_address")

### street_address Type

`string`

## country

`country`

- is optional
- Type: unknown
- cannot be null
- defined in: [Untitled schema](test-properties-country.md "undefined#/properties/country")

### country Type

unknown

### country Constraints

**enum**: the value of this property must be equal to one of the following values:

| Value | Explanation |
| :--------------------------- | ----------- |
| `"United States of America"` | |
| `"Canada"` | |

```

Contributor guide

Open the contributing guide

Research direction

Start by running the converter against the reported test.json schema and compare test.md with the generated test-if.md, test-then.md, and test-else.md files. Trace how these conditional files are referenced in the generated Markdown; done means test.md documents the if-then-else relationship and links to the related files.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.