danielgtaylor / danielgtaylor/aglio
nullable members weird rendering behaviour
- Dominant language
- CoffeeScript
- Stars
- 4.7k
- Forks
- 471
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.