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

Apiary: Fields not displayed in json Body #394

Open
regmimilan opened this issue May 11, 2017 · 3 comments
Open

Apiary: Fields not displayed in json Body #394

regmimilan opened this issue May 11, 2017 · 3 comments

Comments

@regmimilan
Copy link

regmimilan commented May 11, 2017

I have done the following:

Create a New Preference [POST /preferences]

Accepts json request with preference object and creates preference, returns preference id after successful creation.

  • Request (application/json)

    • Headers

        REW3-UserId: string
      
    • Attributes (Add Preference)

  • Response 202

    • Attributes (JSONResponse)
      • preferenceId (number)

In Data Structure

Add Preference

  • name(string, optional) - preference name
  • min_price(number, optional) - minimum amount of Property
  • max_price(number, optional) - maximum amount of Property
  • designed_move_in_date(string, optional) - date format must be as in 2014-11-11T08:40:51.620Z
  • cities(array[string], optional) - List of Preference Cities
  • max_lot_size(number, optional) - Maximum empty land size
  • min_lot_size(number, optional) - Minimum empty land size

In Response
Body
{
"cities": []
}

But I expect to get all the fields of Add Preference as I have called Add Preference while creating the Preference.

@regmimilan regmimilan changed the title Apriary: Fields not displayed in json Body Apiary: Fields not displayed in json Body May 11, 2017
@kylef
Copy link
Member

kylef commented May 11, 2017

@regmimilan You have not included any sample values, and the attributes are optional and thus they are not included in the rendered JSON example. If you make them either required, or attach sample values they should show up.

For example:

## Add Preference
+ name: Test (string, optional) - preference name
+ `min_price`: 1.99 (number, optional) - minimum amount of Property
+ `max_price`: 99.99 (number, optional) - maximum amount of Property
+ `designed_move_in_date`: `2014-11-11T08:40:51.620Z` (string, optional) - date format must be as in 2014-11-11T08:40:51.620Z
+ cities: London, Prague (array[string], optional) - List of Preference Cities
+ max_lot_size: 1000 (number, optional) - Maximum empty land size
+ min_lot_size: 1 (number, optional)  - Minimum empty land size

@regmimilan
Copy link
Author

@kylef cities is displayed which do not include sample value neither it is a required field but other fields are not displayed.

@kylef
Copy link
Member

kylef commented May 11, 2017

@regmimilan Non primitive types such as array and object are rendered differently because they may contain other value types inside them. I may be wrong, but I think this is down to an implementation detail for the API Blueprint parser, it doesn't recursively check inside the type to check if there are values anywhere inside.

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