cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Issue with creating definition for custom API swagger json

I have some trouble with creating a swagger json definition for a custom API, could it be that the property with name "value" is not working since it is a reserved name within PowerApps.

JSON Response from API is like that:

{
   "odata.metadata":"some metadata",
   "value":[
   {
      "RoleId":"GUID1",
      "DisplayName":"DisplayName1 ",
      "Description":"Test1",
   },
   {
      "RoleId":"GUID2",
      "DisplayName":"DisplayName2",
      "Description":"Test2",
   }
   ]
}



 I think I have definitions correctly like this, right ?

 

definitions:
	role:
	  type: object
	  description: role object
	properties:
	  value:
		type: array
		items:
		  $ref: '#/definitions/value'
	value:
	  type: object
	  properties:
		RoleID:
		  type: string
		DisplayName:
		  type: string
		Description:
		  type: string



When trying to call API i get "invalid Name" on BrowserGallery, I assume because of the property is named value, am I right or do I have some wrong defintions

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
New Member

Re: Issue with creating definition for custom API swagger json

Got an answer on another forum, I get the JSON wrong, catched an array instead of an object.

View solution in original post

3 REPLIES 3
Highlighted
New Member

Re: Issue with creating definition for custom API swagger json

Seems there was some data cut off in the editor, this is the full JSON response:

(Putting in a screenshot as the editor will not display my JSON data correctly:

 

issue.PNG

Highlighted
New Member

Re: Issue with creating definition for custom API swagger json

Got an answer on another forum, I get the JSON wrong, catched an array instead of an object.

View solution in original post

Highlighted
Advocate IV
Advocate IV

Re: Issue with creating definition for custom API swagger json

There are three great tools you can use in the future to at least see if your JSON is formatted correctly.

  • editor.swagger.io
  • jsonvalidatortool.com
  • jsonlint.com
Confluent

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,802)