Skip to content

ResponseBuilder.Example() not outputting indented JSON #159

@mgibson2020

Description

@mgibson2020

Expected Behavior

When I don't use r.Example, I get a correctly formatted string, but it does have the default values that I would like to show the user. I want it to look something like this:
{
"location": {
"latitude": 0,
"longitude": 0,
"name": "string",
"radius": 0
},
"options": {
"groupByID": false,
"groupByType": false,
"makeSingleID": true,
"makeSingleType": true,
"site": "Center",
"useFlag": true
}
}

Actual Behavior

If I add my example object like so r.Example("", myObject) I get the following:

{"location":{"name":"Bullseye","latitude":38,"longitude":-120,"radius":250},"options":{"makeSingleID":true,"makeSingleType":true,"groupByID":false,"groupByType":false,"groupBySameWeapon":false,"useFlag":false,"site":"Center"}}

I'm not sure if I am doing wrong but I have tried to use different forms of formatting but it continues to come out flat.

Steps to Reproduce the Problem

  1. Create an Object
  2. Add to ResponseBuilder Example(string myType, object example)

Specifications

  • Version: 2.2.51-alpha
  • Project: Nancy.Swagger

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions