AllOf references not being displayed
- Dominant language
- JavaScript
- Stars
- 724
- Forks
- 150
- Avg merge
- 18h 22m
- Merged PRs (30d)
- 4
Description
### Expected Behaviour
Inherited nodes within ``allOf`` clauses would be displayed within the markdown.
### Actual Behaviour
Nodes inherited through ``allOf`` clauses from common definitions are not correctly linked within the markdowns of an object.
#### Steps to Reproduce
1. Have a schema with common definitions (in my example [``EGA.common-definitions.json``](https://github.com/EbiEga/ega-metadata-schema/blob/main/schemas/EGA.common-definitions.json)).
2. Reference definitions from that schema in another file (in my example [``EGA.ArrayAssay.json``](https://github.com/EbiEga/ega-metadata-schema/blob/main/schemas/EGA.ArrayAssay.json) - specifically at [this lines](https://github.com/EbiEga/ega-metadata-schema/blob/13040e697ac76fcbaef1b6730ea77f8575e1ccef/schemas/EGA.ArrayAssay.json#L14-L18)) or same file.
3. Generate markdown documents with ``jsonschema2md`` through the CLI:
```
jsonschema2md -d ./ -o ./markdown -e "json"
```
4. Check markdown of the referencing object (i.e. ``EGA.ArrayAssay.json``) and click on the node (in my example [``object_id``](https://github.com/EbiEga/ega-metadata-schema/blob/main/docs/json_browser/markdowns/ega.md#object_id)) right above the referenced object ([``object_id``](https://github.com/EbiEga/ega-metadata-schema/blob/13040e697ac76fcbaef1b6730ea77f8575e1ccef/schemas/EGA.ArrayAssay.json#L10-L28)). In my example, the reference of "allOf" to ``object_id`` is missing.
#### Platform and Version
* **Operating System**: Windows 10 with Windows Subsystem for Linux v2
* **node.js**: v16.13.0
* **jsonschema2md**: 6.1.4
#### Sample Code that illustrates the problem
Within the [``object_id``](https://github.com/EbiEga/ega-metadata-schema/blob/main/docs/json_browser/markdowns/ega-properties-objects-ids-block.md) object one can find the following markdown:
````
# Object's IDs block Schema
```txt
https://github.com/EbiEga/ega-metadata-schema/tree/main/schemas/EGA.ArrayAssay.json#/properties/object_id
```
Node containing the main identifiers of the object (e.g. alias, center_name...), inherited from the common definitions. #! We extend the core object (object_core_id) by adding a pattern check based on this schema's nature: an ArrayAssay (by using EGA-ArrayAssay-id-pattern)
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :------------------------------------------------------------------------ |
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [EGA.ArrayAssay.json*](../out/EGA.ArrayAssay.json "open original schema") |
## object_id Type
`object` ([Object's IDs block](ega-properties-objects-ids-block.md))
all of
* any of
* [Check core IDs: combination of Alias and Center name](ega-2-definitions-core-identifiers-of-an-object-anyof-check-core-ids-combination-of-alias-and-center-name.md "check type definition")
* [Check core IDs: EGA accession ID](ega-2-definitions-core-identifiers-of-an-object-anyof-check-core-ids-ega-accession-id.md "check type definition")
* [Check core IDs: external accessions](ega-2-definitions-core-identifiers-of-an-object-anyof-check-core-ids-external-accessions.md "check type definition")
* [Check that ArrayAssay EGA ID (EGAA) is correct](ega-properties-objects-ids-block-allof-check-that-arrayassay-ega-id-egaa-is-correct.md "check type definition")
````
As one can see, the "all of" part is erroneous, the references are the following (see [lines](https://github.com/EbiEga/ega-metadata-schema/blob/13040e697ac76fcbaef1b6730ea77f8575e1ccef/schemas/EGA.ArrayAssay.json#L14-L27)) within the schemas:
````
"allOf": [
{
"title": "Inherited object_core_id object",
"$ref": "https://github.com/EbiEga/ega-metadata-schema/tree/main/schemas/EGA.common-definitions.json#/definitions/object_core_id"
},
{
"title": "Check that ArrayAssay EGA ID (EGAA) is correct",
"properties": {
"ega_accession": {
"$ref": "https://github.com/EbiEga/ega-metadata-schema/tree/main/schemas/EGA.common-definitions.json#/definitions/EGA-ArrayAssay-id-pattern"
}
}
}
]
````
I would expect the "AllOf" to include a reference to the [``object_core_ids``](https://github.com/EbiEga/ega-metadata-schema/blob/main/docs/json_browser/markdowns/ega-2-definitions-core-identifiers-of-an-object.md) that is indeed displayed within the markdowns, just not linked to the nodes that reference it. Instead, the reference that appears is the [``object_id``](https://github.com/EbiEga/ega-metadata-schema/blob/main/docs/json_browser/markdowns/ega-properties-objects-ids-block.md) right above it, and no reference of ``object_core_ids`` can be seen within it.
It could be that the way I structured my reference with "allOf" is erroneous, but so far all validators I have used work properly with it.
Contributor guide
Research direction
Reproduce the issue with the provided EGA.common-definitions.json and EGA.ArrayAssay.json schemas using the jsonschema2md CLI, then inspect the generated markdown for object_id. Trace how allOf references are rendered and linked; done means the inherited object_core_id reference appears as a link instead of being replaced by object_id.
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