Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type arrays report "Unknown Type" in properties overview #237

Closed
jirikopecky opened this issue Jul 17, 2020 · 4 comments · Fixed by #242
Closed

Type arrays report "Unknown Type" in properties overview #237

jirikopecky opened this issue Jul 17, 2020 · 4 comments · Fixed by #242

Comments

@jirikopecky
Copy link

What did you do

Ran jsonschema2md against a schema file that has an array as a value for type like this: [ "string", "null" ]

What did you expect to happen

Property listed in properties overview as nullable string

What happened

Property is reported as Unknown Type in the overview, but with correct type string later in the document.

What's your environment

  • Operating System: macOS 10.15.6
  • node.js version: v12.16.3

Do you have example files:

For this schema

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/type-array-repro.json",
    "type": "object",
    "title": "Type Array Repro",
    "description": "Type Array Issue Reproduction",
    "required": [
        "sampleProp"
    ],
    "additionalProperties": false,
    "properties": {
        "sampleProp": {
            "type": ["string", "null"],
            "title": "Sample Property"
        }
    }
}

I'm getting following Markdown

# Type Array Repro Properties

| Property                  | Type         | Required | Nullable    | Defined by                                                                                                                     |
| :------------------------ | ------------ | -------- | ----------- | :----------------------------------------------------------------------------------------------------------------------------- |
| [sampleProp](#sampleProp) | Unknown Type | Required | can be null | [Type Array Repro](repro-properties-sample-property.md "http://example.com/type-array-repro.json#/properties/sampleProp") |

## sampleProp




`sampleProp`

-   is required
-   Type: `string` ([Sample Property](repro-properties-sample-property.md))
-   can be null
-   defined in: [Type Array Repro](repro-properties-sample-property.md "http://example.com/type-array-repro.json#/properties/sampleProp")

### sampleProp Type

`string` ([Sample Property](repro-properties-sample-property.md))
@trieloff trieloff added the bug label Jul 21, 2020
@stephenholleran
Copy link

+1 I am having the exact same issue.

trieloff pushed a commit that referenced this issue Jul 31, 2020
## [4.1.6](v4.1.5...v4.1.6) (2020-07-31)

### Bug Fixes

* **markdown:** correcly show type of nullable types in header ([53c1a0b](53c1a0b)), closes [#237](#237)
@trieloff
Copy link
Collaborator

🎉 This issue has been resolved in version 4.1.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@stephenholleran
Copy link

Thanks!

@jirikopecky
Copy link
Author

Fix worked, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants