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

nullable members weird rendering behaviour #313

Open
CameronLonsdale opened this issue Dec 19, 2016 · 5 comments
Open

nullable members weird rendering behaviour #313

CameronLonsdale opened this issue Dec 19, 2016 · 5 comments

Comments

@CameronLonsdale
Copy link

I have the following data structures defined

### LocationStruct (object)
+ country: Australia (CountryStruct)
+ city: Sydney (string)
+ latitude (number, nullable)
+ longitude (number, nullable)

### CountryStruct (object)
+ name: Australia (string)
+ code (string, nullable)

And the use case for this data is the following

+ Request (application/json)
    + Attributes (LocationStruct)

This renders to the following JSON

{
  "country": {
    "name": "Australia",
    "code": "Hello, world!"
  },
  "city": "Sydney",
  "latitude": 1,
  "longitude": 1
}

I was expecting code, latitude and longitude to have the value null, as a sample value was not specified for them.

However, when I change the CountryStruct to be empty. eg.

### CountryStruct (object)

The following is rendered.

{
  "country": {},
  "city": "Sydney",
  "latitude": null,
  "longitude": null
}

Fairly strange behaviour. The functionality I'm looking for is to have the value null be rendered when no sample value is given to an objects member.

@OrangeDog
Copy link

OrangeDog commented Feb 2, 2017

Please sort this out. It's so infuriating that all optional members in the schema get instantiated as "Hello World!", 1, etc. instead of using the actual Body I have supplied.

See also http://stackoverflow.com/q/41986351/476716

@stipsan
Copy link

stipsan commented May 28, 2017

@stipsan
Copy link

stipsan commented May 28, 2017

Looks like you can disable it by setting DRAFTER_EXAMPLES=true.
Like so: DRAFTER_EXAMPLES=true aglio -i apiary.apib.

@optimuspaul
Copy link

DRAFTER_EXAMPLES=true does nothing for me. Super frustrating as I was seeing the samples I put in the blueprints and now I only see the Hello, World! stuff.

@brendensoares
Copy link

@optimuspaul looks like #177 and #304 my be relevant. PR is sitting idle.

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

5 participants