cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rogersonra
Frequent Visitor

Customer connector: Property "" type mismatch

I'm creating a custom connector from an OpenApi file and when I test an operation (GetAd)

GetAd_1.png

I  am getting a Schema Validation error Schema_validation_error.png

Two of my operations work but four do not

 Operations.png

The two that work do not expect parameters in the path.  The other four do.

I've searched this forum as well as Google searches but have been unable to find the issue.

The custom connector was created from an OpenApi file. The swagger follows.

 

{
  "swagger": "2.0",
  "info": {
    "title": "adman APIs",
    "description": "APIs available for adman",
    "version": "1.0.0"
  },
  "host": "myserver:10182",
  "schemes": [ "http" ],
  "basePath": "/web/services",
  "tags": [
    {
      "name": "adman APIs",
      "description": "APIs available for adman"
    }
  ],
  "definitions": {
    "adHdrDsTmp": {
      "type": "object",
      "properties": {
        "adType": {
          "type": "string",
          "maxLength": 1
        },
        "adDate": {
          "type": "string",
          "maxLength": 10
        },
        "adDesc": {
          "type": "string",
          "maxLength": 30
        },
        "adDeadline": {
          "type": "string",
          "maxLength": 10
        },
        "adWhsDeadline": {
          "type": "string",
          "maxLength": 10
        }
      }
    },
    "GetAdResult": {
      "type": "object",
      "properties": {
        "adHdrDs": {
          "$ref": "#/definitions/adHdrDsTmp"
        }
      }
    },
    "GetAllAdsByTypeResult": {
      "type": "object",
      "properties": {
        "adHdrDs_length": {
          "type": "integer",
          "format": "int32"
        },
        "adHdrDs": {
          "type": "array",
          "maxItems": 1000,
          "items": {
            "$ref": "#/definitions/adHdrDsTmp"
          }
        }
      }
    },
    "GetAllAdsResult": {
      "type": "object",
      "properties": {
        "adHdrDs_length": {
          "type": "integer",
          "format": "int32"
        },
        "adHdrDs": {
          "type": "array",
          "maxItems": 1000,
          "items": {
            "$ref": "#/definitions/adHdrDsTmp"
          }
        }
      }
    }
  },
  "paths": {
        "/adman/{adtype}/{addate}": {
      "delete": {
        "tags": [
          "adman APIs"
        ],
        "operationId": "DeleteAd",
		"summary": "Delete an Ad by supplying the ad type char(1) and ad date char(8) in the format yyyymmdd",
		"description": "Delete an Ad by supplying the ad type and ad date",
        "consumes": [
          "*/*"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "adtype",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w",
            "maxLength": 1
          },
          {
            "name": "addate",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\d{4}-\\d{2}-\\d{2}",
            "maxLength": 10
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation"
          }
        }
      },
      "get": {
        "tags": [
          "adman APIs"
        ],
        "operationId": "GetAd",
		"summary": "Get an Ad by supplying the ad type char(1) and ad date char(8) in the format yyyymmdd",
		"description": "Get an Ad by supplying the ad type and ad date",
        "consumes": [
          "*/*"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "adtype",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w",
            "maxLength": 1
          },
          {
            "name": "addate",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\d{4}-\\d{2}-\\d{2}",
            "maxLength": 10
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "schema": {
              "$ref": "#/definitions/GetAdResult"
            }
          }
        }
      },
      "put": {
        "tags": [
          "adman APIs"
        ],
        "operationId": "UpdateAd",
		"summary": "Update an Ad by supplying the ad type char(1) and ad date char(8) in the format yyyymmdd",
		"description": "Update an Ad by supplying the ad type and ad date. The new values are specified in the body",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "adtype",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w",
            "maxLength": 1
          },
          {
            "name": "addate",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\d{4}-\\d{2}-\\d{2}",
            "maxLength": 10
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/adHdrDsTmp"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation"
          }
        }
      }
    },
    "/{adtype}": {
      "get": {
        "tags": [
          "adman APIs"
        ],
        "operationId": "GetAllAdsByType",
		"summary": "Get all Ads by Type by dupllying s type",
		"description": "Get all Ads by Type by dupllying s type",		
        "consumes": [
          "*/*"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "adtype",
            "in": "path",
            "required": true,
            "type": "string",
            "pattern": "\\w",
            "maxLength": 1
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "schema": {
              "$ref": "#/definitions/GetAllAdsByTypeResult"
            }
          }
        }
      }
    },
    "/": {
      "get": {
        "tags": [
          "adman APIs"
        ],
        "operationId": "GetAllAds",
		"summary": "getallads",
		"description": "Get all ads - there are no parameters",
        "consumes": [
          "*/*"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful operation",
            "schema": {
              "$ref": "#/definitions/GetAllAdsResult"
            }
          }
        }
      },
      "post": {
        "tags": [
          "adman APIs"
        ],
        "operationId": "CreateAd",
		"summary": "Createad",
		"description": "Create a new ad.  There are no parameters but the values are specified in the body",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/adHdrDsTmp"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation"
          }
        }
      }
    }
  }
}

 

If anyone has any suggestions as to what the issue may be please respond.

Thanks,

Rob

 

 
 

 

5 REPLIES 5
rohsh354
Community Support
Community Support

Hello,

 

Type value mismatch usually means that property is defined as object, but the default value is being passed as string.

 

Please check the parameters and its values which are being returned and its data type.

 

 

Thanks for replying @rohsh354

 

When you say "Please check the parameters and its values which are being returned and its data type." you're referring to the the Body in the Response correct?

If I call getad using postman and the same parameters 

GetAd_in_postman.png

an object is returned. 

Shouldn't the Response body in the connector be returning an object as well if both postman and powerapps are based on the same swagger file (which they are)?

 

Thanks,

rogersonra 

Hi @rogersonra ,

 

Just wondering if you are able to resolve this issue ? I have created a custom connector and when i "Test" , I get the error in Schema Validation saying  " Property "" type mismatch, Expected: "array", Actual: "string" ".

 

I have tried creating the custom connector by 

a. Importing a postman v1 collection

b. Exporting an API directly from APIM into Power APps environment. 

 

Both these custom connectors give the same error upon "Testing". Any help is highly appreciated. 

 

PS: Already tried adding https://powerapp.microsoft.com in the allowed origins in CORS policy of APIM

 

Thank you!

Atmaram90
Frequent Visitor

Clicking on update connector without making any change had resolved this issue for me.Unable to find root cause.

philstubbington
Frequent Visitor

I had exactly the same problem, and the "fix" was the same 🤷‍

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,642)