Why is power automate reading my JSON OAS file as YAML?

72 Views Asked by At

I am attempting to create a custom connector in Power Automate to send data to my company's quoting/inventory software. The API documentation is here and the OAS is here. The OAS is too large to import to PA directly since there is a 1MB limit, so I removed all of the paths I don't need and saved to a .json file like so:

{
     "openapi": "3.0.1",
  "info": {
    "title": "LightningAPI",
    "version": "v1"
  },
  "paths": {
    "/api/v1/Jobs/JobActions/Update": {
      "put": {
        "tags": [
          "JobActions"
        ],
        "summary": "Update a single job action.",
        "requestBody": {
          "description": "The details of the update.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenericUpdateParameters"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Returns the updated job action.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          },
          "400": {
            "description": "Problems with the access token - reason given.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "Internal problem updating the job action."
          }
        }
      }
    }
  },
  "securitySchemes": {
    "Bearer": {
      "type": "apiKey",
      "description": "JWT Authorization header using the Bearer scheme...",
      "name": "Authorization",
      "in": "header"
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ]
}

Now when I try to import it, I get the error message "An error happened while parsing the Open API contract in YAML format. Please try again with a valid Open API contract." What am I doing wrong here and why does it read as a YAML file?

I do realize that there is an existing connector in PA for this, but it's a premium connector which will be a harder sell for what I am trying to ultimately accomplish. If there's a way to make this work it would be ideal. Can it even be done or am I barking up the wrong tree here?

Edit: realized i was missing an opening bracket here, but that's just because I missed copying it from my json file, the error is the same

1

There are 1 best solutions below

0
rb86 On

Answered my own question...

Had to remove

 "openapi": "3.0.1",

from the top and add "x-" in front of "RequestBody" and all instances of "content", then it worked just fine. Unfortunately, I also learned that custom connectors require a premium license to use (this is very unclear in the documentation), too, so I may as well just use the built in one anyway. Bummer.