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

Specified file does not match OpenAPI 2.0 specification

 

Hi there, Having a problem with using the API for one of our pieces of software as a custom connector.

 

The Error coming up when importing the JSON file is "Specified file does not match OpenAPI 2.0 specification: 'JSON is valid against no schemas from 'oneOf'. Path 'securityDefinitions.auth'.' "

 

The code being used is 

"securityDefinitions":{"oauth2":{"type":"oauth2","description":"OAuth2 Password flow","flow":"password","tokenUrl":"/CherwellAPI/token","scopes":{}}}
 
or as it came out from another debug tool 
"securityDefinitions": {
"auth": {
"type": "oauth2",
"flow": "password",
"tokenUrl": "https://nnpcsapp18dev/CherwellAPI/token",
"scopes": {
"cherwellapi": null
},
"x-skip-client-authentication": false
}
},
 
From what I've been reading I think it may be the password flow, however I can't see anything in the powerapps Documentation that explicitly calls this out as a not to be used flow. 
 
Does anyone have a way to make this work? 
 
Cheers, 
Chris

 

 

7 REPLIES 7
Community Support Team
Community Support Team

Re: Specified file does not match OpenAPI 2.0 specification

The OpenAPI 2.0 specification is documented in the following page:

Security Scheme Object

 

The Password Flow should be supported.

I will do some research on this, and will share it out if I have found anything helpful.

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
CLS9
Level: Powered On

Re: Specified file does not match OpenAPI 2.0 specification

So reading further into this I can see that this has come up for others, but have not seen a solution for them. 

Is there a particular schema that powerapps is looking for with regards to the password flow? 
The Oauth2 spec that you linked to doesnt show an example I can work from for the password flow do you have an example of it working I could try use? 
Cheers, 
Chris

 

CLS9
Level: Powered On

Re: Specified file does not match OpenAPI 2.0 specification

Hi There, Is there any more information on this?

Cheers, 
Chris

 

timwalls
Level: Power Up

Re: Specified file does not match OpenAPI 2.0 specification

Having exactly the same issue trying to use the password schema for oAuth2.

See the definition bleow;

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#securitySchemeObject

CLS9
Level: Powered On

Re: Specified file does not match OpenAPI 2.0 specification

I've looked further into this, and am now using no authentication and trying to call the token call manually. 

The problem there is that Powerapps wants to send everything as json, and I cant seem to tell Powerapps that for that request I want just raw text.

 

The system I'm connecting to, for the token call is expecting something like this

grant_type=password&client_id=badf657f-1234-5678-9b07-a123f9fa50cd&username=user&password=password

 

So in short if I pass it as raw body it works. 

How do I get powerapps to allow this? 

Cheers, 
Chris

 

MarkIannucci
Level: Powered On

Re: Specified file does not match OpenAPI 2.0 specification

You're not the only one who got stuck here.  I too found that if I pass the string as a raw body it will work also.

 

I think the problem is that Cherwell's API has implemented the four parameters in the token call as formData and the connector appears to require us to send it as JSON.  I have not been able to workaround this limitation.

 

@CLS9 , have you been successful in your efforts?

awildash
Level: Powered On

Re: Specified file does not match OpenAPI 2.0 specification

Just wanted to add that I'm seeing the same error but for client credentials flow

 

"securityDefinitions":{
"oauth2":{
"type":"oauth2",
"description":"client credentials grant flow",
"flow":"application",
"tokenUrl":"<redacted>",
"scopes":{

 

}
}
}

 

It seems to be an issue with the front end validation making auth and refresh URLs mandatory. As it seems happy with the connector up until you try and create it. Then when you fill in the authorization URL it is correctly failing against the OpenAPI spec, as it now has a clientCredentials flow with an authorizationUrl which is invalid. So if the front end form fields werent mandatory this would probably be fine.