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

Failed to dereference following schema #259

Closed
ExcitedSpider opened this issue Feb 25, 2022 · 1 comment
Closed

Failed to dereference following schema #259

ExcitedSpider opened this issue Feb 25, 2022 · 1 comment

Comments

@ExcitedSpider
Copy link

{
    "$schema": "http:https://json-schema.org/draft-04/schema#",
    "$ref": "#/definitions/Example",
    "definitions": {
        "Example": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "price": {
                    "type": "number"
                },
                "byte": {
                    "type": "string",
                    "format": "binary",
                    "binaryEncoding": "base64"
                },
                "name": {
                    "type": "string"
                },
                "map_int32_string": {
                    "additionalProperties": {
                        "type": "string"
                    },
                    "type": "object"
                },
                "map_string_int32": {
                    "additionalProperties": {
                        "type": "integer"
                    },
                    "type": "object"
                },
                "action": {
                    "enum": [
                        "ONLINE",
                        0,
                        "OFFLINE",
                        1
                    ],
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "integer"
                        }
                    ]
                },
                "item": {
                    "$ref": "#/definitions/example.Item",
                    "additionalProperties": true
                },
                "items": {
                    "items": {
                        "$ref": "#/definitions/example.Item"
                    },
                    "type": "array"
                },
                "nonexistent": {
                    "type": "string"
                },
                "sourceType": {
                    "enum": [
                        "Producer",
                        0,
                        "Consumer",
                        1
                    ],
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "integer"
                        }
                    ]
                },
                "mq_config": {
                    "$ref": "#/definitions/example.MqConfig",
                    "additionalProperties": true
                },
                "enable": {
                    "type": "boolean"
                }
            },
            "additionalProperties": true,
            "type": "object"
        },
        "example.Item": {
            "properties": {
                "id": {
                    "type": "integer"
                },
                "price": {
                    "type": "number"
                },
                "name": {
                    "type": "string",
                    "description": "bytes byte = 3;"
                },
                "map_int32_string": {
                    "additionalProperties": {
                        "type": "string"
                    },
                    "type": "object"
                },
                "map_string_int32": {
                    "additionalProperties": {
                        "type": "integer"
                    },
                    "type": "object"
                },
                "action": {
                    "enum": [
                        "ONLINE",
                        0,
                        "OFFLINE",
                        1
                    ],
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "integer"
                        }
                    ]
                },
                "snippets": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                }
            },
            "additionalProperties": true,
            "type": "object"
        },
        "example.KafkaCfg": {
            "properties": {
                "name": {
                    "type": "string"
                }
            },
            "additionalProperties": true,
            "type": "object"
        },
        "example.MqConfig": {
            "properties": {
                "rmq_config": {
                    "$ref": "#/definitions/example.RMQCfg",
                    "additionalProperties": true
                },
                "nsq_config": {
                    "$ref": "#/definitions/example.NSQCfg",
                    "additionalProperties": true
                },
                "kafka_config": {
                    "$ref": "#/definitions/example.KafkaCfg",
                    "additionalProperties": true
                }
            },
            "additionalProperties": true,
            "type": "object"
        },
        "example.NSQCfg": {
            "properties": {
                "name": {
                    "type": "string"
                }
            },
            "additionalProperties": true,
            "type": "object"
        },
        "example.RMQCfg": {
            "properties": {
                "name": {
                    "type": "string"
                }
            },
            "additionalProperties": true,
            "type": "object"
        }
    }
}
@ExcitedSpider
Copy link
Author

I saw that there is a similar issue relating to the top-level $ref, so I am going to close this one.
#48

For those who have same problems, you can try to remove the top-level $ref.

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