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

Examples should expand references? #166

Open
ghost opened this issue Oct 8, 2018 · 1 comment
Open

Examples should expand references? #166

ghost opened this issue Oct 8, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 8, 2018

I wonder if the example field should be allowed to have $refs in it.

In my app, there's a nested map type, let's call it FruitCartConfig:

type FruitCartConfig struct {
    fruits map[string]FruitConfig
}

type FruitConfig struct {
    values map[string]string
}

This allows me to make 1 API call that configures many fruits with many key-value pairs.

The example JSON I want to use is something like

{
    "definitions": {
        "FruitCartConfig": {
            ...
            "properties": {
                "fruits": {
                    ...
                    "example": {"apple": {"$ref": "#/definitions/FruitConfig"}}
                }
            }
        },
        "FruitConfig": {
            ...
            "properties": {
                "values": {
                    ...
                    "example": {"color": "red"}
                }
            }
        }
    }
}

which would end up generating the example shown in the output

{
    "fruits": {
        "apple": {
            "values": {
                "color": "red"
            }
        }
    }
}

Any thoughts on this?

@auscaster
Copy link
Member

This would be a great feature to have. I'll mark it as a feature request and maybe somebody would like to pick it up.

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

No branches or pull requests

1 participant