External Services: Writing Swagger Schema? Now a PIECE OF CAKE!
Okay, I know you’re all excited for this one but you gotta hold it for a moment.
Before we begin, you MUST go and thank Gorav Seth for this. Spam his Twitter with: 😂
THANK YOU OP#ExternalServices
It’s only because of this man, I came to know about a free Swagger tool that helps you write Swagger Schema without actually writing anything. You can get a working schema simply by point and click. Isn’t it cool? Writing JSON without actually writing anything! 😎
Okay, enough blabbing! Let’s get to it.
Getting Started
So the tool is called Swagger Inspector, very similar to Postman, a tool that enables you to test callouts to APIs.
Side note: If you don't know how to use Postman, I'd recommend watching some tutorials videos on YouTube for 'How to make callouts using Postman'.
Now before you get your hands dirty, make sure you sign up at Swagger.io because you can only create schema when logged in. 🙂
How it works?
Swagger Inspector works exactly like a Postman when it comes to testing callouts, and that’s what you need to do.
Step 1: Just make the callout to the desired API as you would do in Postman. Once your callout is a success, you will be able to see the callout response under ‘Response’ section and the callout details under ‘History’ section.

Step 2: Now select the callout(one which was successful) from the ‘History’ section and click on ‘CREATE API DEFINITION’ button. Also, make sure to select ‘OAS 2.0’ option(only OpenAPI 2.0 is supported by External Services) from the dropdown next to the button.

Once you click on the button, you will see a popup saying ‘Success… blah blah’. Click on ‘GO TO SWAGGERHUB’.
Step 3: In this step, you will be prompted to enter some details like name, version etc. for your schema. Enter the details and click on ‘IMPORT OPENAPI’ button.

Step 4: Now copy the code from the code editor and paste it in editor.swagger.io. Then select ‘File’ and click on ‘Convert and save as JSON’ to download the JSON schema.
And you’re all set to use the downloaded schema in your External Services! 😎 *dab*
Feel free to play around and drop your questions in the comments! Writing Swagger schema can’t get easier than this, so no excuses! 😉
If you wish to understand more about Swagger Schema, check out one of my recent post: Introduction to Swagger Schema.
Hope you find this one useful! Catch you in the next one! ✌ And thank you for being an awesome reader! Subscribe to this blog for receiving all the latest updates straight to your inbox. 🙂

.png)




Comments