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

External reference breaks arrays #1879

Open
wburgers opened this issue Feb 29, 2024 · 0 comments
Open

External reference breaks arrays #1879

wburgers opened this issue Feb 29, 2024 · 0 comments

Comments

@wburgers
Copy link

wburgers commented Feb 29, 2024

Suppose we have the following types:

fileA:

export interface ClassA {
  property: string;
}

fileB:

export interface ClassB {
  /**
     * @ref ./ClassA.json
     */
  array: ClassA[];
}

Then the output becomes:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "additionalProperties": false,
    "definitions": {},
    "properties": {
        "array": {
            "$ref": "./ClassA.json"
        },
    },
    "required": [
        "array",
    ],
    "type": "object"
}

Where I would expect:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "additionalProperties": false,
    "definitions": {},
    "properties": {
        "array": {
            "items": {
                "$ref": "./ClassA.json"
            },
            "type": "array"
        },
    },
    "required": [
        "array",
    ],
    "type": "object"
}

Is there a way to get the right output as expected?
Am I using the generator incorrectly?

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

No branches or pull requests

1 participant