Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

JSON Visitor should use sample value for rendering JSON in array #519

Open
kylef opened this issue Nov 8, 2017 · 2 comments
Open

JSON Visitor should use sample value for rendering JSON in array #519

kylef opened this issue Nov 8, 2017 · 2 comments
Milestone

Comments

@kylef
Copy link
Member

kylef commented Nov 8, 2017

For example, if I want to reference another data structure inside an array of fixed-type. I'd like to provide multiple examples to be rendered in the JSON array example.

# API

## GET /users

+ Response 200 (application/json)
    + Attributes
        + users (array[User], fixed-type)
            + Sample
                + (User)
                    + username: doe
                + (User)
                    + username: tim

## Data Structures

### User

+ username: kyle

The Sample section is ignored when it comes to rendering a JSON body and I think the sample should be included.

Current Behaviour

{
  "users": [
    {
      "username": "kyle"
    }
  ]
}

Expected Behaviour

{
  "users": [
    {
      "username": "doe"
    },
    {
      "username": "tim"
    }
  ]
}
@kylef
Copy link
Member Author

kylef commented Dec 23, 2017

The same problem exists for objects as well as array.

@kylef
Copy link
Member Author

kylef commented Apr 19, 2018

Another case to reproduce:

+ Response 200 (application/json)
    + Attributes
        + location (array, fixed)
            + `43.3` (number, sample)
            + `-8.41` (number, sample)

@pksunkara pksunkara added this to the 4.0.0 milestone Jul 26, 2018
tjanc added a commit that referenced this issue Aug 13, 2018
tjanc added a commit that referenced this issue Aug 13, 2018
@tjanc tjanc mentioned this issue Aug 13, 2018
@pksunkara pksunkara modified the milestones: 4.0.0, 4.1.0 Aug 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants