cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Peter_Stapf
Level: Powered On

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
Peter_Stapf
Level: Powered On

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
Peter_Stapf
Level: Powered On

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

Peter_Stapf
Level: Powered On

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

EvanChaki
Level: Powered On

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
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,444)