cancel
Showing results for 
Search instead for 
Did you mean: 

How do I assign a label to the json object that is returned like "Test" in Test: { name: test1 }

Highlighted
Occasional Contributor

How do I assign a label to the json object that is returned like "Test" in Test: { name: test1 }

I have a customer who is expecting the json objects in the response to contain a label like the following:

 

Test: {

  name: test1

  passed: false

}

 

I'm using Swagger 2.0.  How do I assign "Test" to the object in the yaml file?

 

3 REPLIES 3
Moderator

Re: How do I assign a label to the json object that is returned like "Test" in Test: { na

By defintion, you can't - that's not a valid JSON.

 

The most you can do is something like:

 

{
  "Test": {
    "name": "test1",
    "passed": false
  }
}
Occasional Contributor

Re: How do I assign a label to the json object that is returned like "Test" in Test: { na

Actually that's what I think I want. How would you define that within the Swagger 2.0 components?

Moderator

Re: How do I assign a label to the json object that is returned like "Test" in Test: { na

Do you have anything as a starting point?

New Here?
Join us and watch the welcome video:
SeptemberNews
Join our online event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win