zapier / zapier-platform

The SDK for you to build an integration on Zapier
https://platform.zapier.com
Other
343 stars 187 forks source link

Import resources from an OpenAPI spec #187

Open jeff-french opened 4 years ago

jeff-french commented 4 years ago

Is there a way to "jump start" building out an integration by importing resources from a Swagger / OpenAPI spec?

xavdid commented 4 years ago

Hey Jeff!

That's currently not something we offer, but I'll leave this open as a FR. Thanks for mentioning it!

awilson9 commented 4 years ago

I was able to use a json schema as the defintion for outputFields in a zapier resource.

There is an exposed utility called ZapierSchemaBuilder that allows you to do this if you install the zapier-platform-json-schema dependency.

import ZapierSchemaBuilder from 'zapier-platform-json-schema/build/ZapierSchemaBuilder';
import * as schema from './schema.json'

const Resource = {
    ...,
    outputFields: new ZapierSchemaBuilder(schema).setExcludeAll(true).addInclude('style').build()
}

Not a full jumpstart but still super helpful for keeping your resources in sync with your own API definitions

tobyurff commented 3 years ago

Agree that a way to import an OpenAPI spec would be incredibly powerful.

xavdid commented 3 years ago

Could someone link to (or email to partners@zapier.com) an open API spec they use? I haven't used the tech much, so i'm not sure what the lift would look like or how specific we'd need to be.

tobyurff commented 3 years ago

@xavdid Sure, feel free to take a look at our the "API Reference" section of our documentation, which is generated from OpenAPI: https://docs.impala.travel/docs/booking-api/spec/openapi.seller.yaml

You'll see the different API endpoints (that map to triggers, actions, searches in Zapier) and more importantly all the query and other input params available (with human-readable descriptions) as well as output including examples.

The actual OpenAPI file this is generated from can be found here: https://docs.impala.travel/api/v1/projects/impala/booking-api/nodes/spec/openapi.seller.yaml?branch=master&deref=optimizedBundle

When setting things up in Zapier, I'd say 95% of my work was copying and pasting stuff from our OpenAPI document.

Katli95 commented 2 years ago

Commenting to revive this topic, it would be awesome to be able to just import OpenAPI definitions to at least jump start the integration process!

ejwhite7 commented 1 year ago

Any update on whether this feature has been added?

nielsenaa commented 1 year ago

same here, i'd like to import my definitions from a stoplight account export :)

valmoz commented 1 year ago

Hello, in my team, we use the OpenAPI generator to generate API client libraries in different programming languages for our customers. To add Zapier to our offer, we decided it was not worth it to implement a new integration manually, but instead, we decided to adopt the same approach by creating a custom Zapier generator for internal use. Then, we decided to offer it to the community, and it was recently released as a beta in the library.

It probably isn't perfect and it could be improved, but the generated code could help you to develop your integration faster.

You can find the documentation for the Zapier generator here.

We hope it will be helpful!

Mauro