Saving and Exporting an OAS Document
Learn how to save and export an OAS document.
We'll cover the following...
Overview
Previously, we learned what an OAS document looks like. In this lesson, we’ll cover saving and exporting a completed OAS document. For this, copy the code provided below and paste it into SwaggerHub Editor. We can use the initial onboarding-api
definition used previously or use the SwaggerHub Editor to create a brand new OAS definition.
Press + to interact
openapi: 3.0.0################################## BigCo Onboarding API# 2020-16-01# Design And Build Great APIs# Mike Amundsen (@mamund)#################################### general information block ###info:version: '1.0.0'title: 'BigCo Onboarding API'description: 'This is the OAS document for BigCo **Onboarding API**'tags:- name: onboardingdescription: "Onboarding APIs"### mock server reference ###servers:# Added by API Auto Mocking Plugin- description: SwaggerHub API Auto Mockingurl: https://virtserver.swaggerhub.com/mamund/onboarding-master/1.0.0### exposed paths for this API ###paths:### home ###/:get:operationId: homesummary: Use this to retrieve the home page for the onboarding APItags:- onboardingparameters:- $ref: "#/components/parameters/eTag"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"### start ###/start:post:operationId: startOnboardingsummary: Use this to start process of onboarding a customertags:- onboardingparameters:- $ref: "#/components/parameters/ifNoneMatch"requestBody:$ref: "#/components/requestBodies/start"responses:'201':$ref: "#/components/responses/created"default:$ref: "#/components/responses/error"### work in progress list ##/wip:get:operationId: wipListsummary: Use this to get a list of onboarding recordstags:- onboardingparameters:- $ref: "#/components/parameters/status"- $ref: "#/components/parameters/eTag"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"### work in progress record ###/wip/{identifier}:get:operationId: wipItemsummary: Use this to return a single onboarding recordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"- $ref: "#/components/parameters/eTag"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"### customer filter for WIP ###/wip/{identifier}/customer:get:operationId: getCustomerDatasummary: Use this to get the customer data for this WIP recordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"- $ref: "#/components/parameters/eTag"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"put:operationId: updateCustomerDatasummary: Use this to update the customer data for this WIP recordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"- $ref: "#/components/parameters/ifMatch"requestBody:$ref: "#/components/requestBodies/customer"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"### account filter for WIP ###/wip/{identifier}/account:get:operationId: getAccountDatasummary: Use this to get the account data for this WIP recxordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"- $ref: "#/components/parameters/eTag"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"put:operationId: updateAccountDatasummary: Use this to update the account data for this WIP recordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"- $ref: "#/components/parameters/ifMatch"requestBody:$ref: "#/components/requestBodies/account"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"### activity filter for WIP ###/wip/{identifier}/activity:get:operationId: getActivityDatasummary: Use this to get the activity data for this WIP recxordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"- $ref: "#/components/parameters/eTag"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"put:operationId: updateActivityDatasummary: Use this to update the activity data for this WIP recordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"- $ref: "#/components/parameters/ifMatch"requestBody:$ref: "#/components/requestBodies/activity"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"### status filter for WIP ###/wip/{identifier}/status:get:operationId: getStatussummary: Use this to get the status for this WIP recxordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"- $ref: "#/components/parameters/eTag"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"put:operationId: updateStatussummary: Use this to update the status for this WIP recordtags:- onboardingparameters:- $ref: "#/components/parameters/identifier"requestBody:$ref: "#/components/requestBodies/status"responses:'200':$ref: "#/components/responses/reply"default:$ref: "#/components/responses/error"### shared components ###components:### request parameters ###parameters:ifNoneMatch:name: if-None-Matchdescription: Conditional Create Headerin: headerschema:type: stringexample: "*"ifMatch:name: If-Matchdescription: Conditional Update Headerin: headerschema:type: stringexample: "zaxscdvfbg"eTag:name: ETagdescription: Conditional Read Headerin: headerschema:type: stringexample: "zaxscdvfbg"identifier:name: identifierdescription: record identifierin: pathrequired: trueschema:type: stringstatus:name: statusdescription: status flagin: queryschema:type: stringenum:- pending- completed- abandonedexample: "pending"### request bodies ###requestBodies:start:content:application/x-www-form-urlencoded:schema:$ref: '#/components/schemas/start'application/json:schema:$ref: '#/components/schemas/start'customer:content:application/x-www-form-urlencoded:schema:$ref: '#/components/schemas/customer'application/json:schema:$ref: '#/components/schemas/customer'account:content:application/x-www-form-urlencoded:schema:$ref: '#/components/schemas/account'application/json:schema:$ref: '#/components/schemas/account'activity:content:application/x-www-form-urlencoded:schema:$ref: '#/components/schemas/activity'application/json:schema:$ref: '#/components/schemas/activity'status:content:application/x-www-form-urlencoded:schema:$ref: '#/components/schemas/status'application/json:schema:$ref: '#/components/schemas/status'### response bodies ###responses:created:description: Createdheaders:Location:schema:type: stringdescription: URL of created resourceexample: '/wip/123'error:description: unexpected errorcontent:application/problem+json:schema:$ref: '#/components/schemas/error'application/json:schema:$ref: '#/components/schemas/error'reply:description: OKcontent:application/prag+json:schema:$ref: '#/components/schemas/reply'application/json:schema:$ref: '#/components/schemas/reply'### models ###schemas:### default error ###error:type: objectproperties:type:type: stringexample: "Invalid Record"title:type: stringexample: "One or more missing properties"detail:type: stringexample: "Review the submitted record for missing required properties."### 200 OK reply ###reply:type: objectproperties:metadata:type: arrayitems:properties:id:type: stringexample: "title"value:type: stringexample: "BigCo Onboarding"links:type: arrayitems:properties:id:type: stringexample: "home"href:type: stringexample: "http://api.example.org/"title:type: stringexample: "Home Page"method:type: stringenum:- "GET"- "POST"- "PUT"- "PATCH"- "DELETE"example: "GET"properties:type: arrayitems:properties:name:type: stringexample: ""value:type: stringexample: ""items:type: arrayitems:$ref: '#/components/schemas/wip'### define array of WIPs ###wipCollection:type: arrayitems:$ref: '#/components/schemas/wip'### internal work in progress record ###wip:type: objectproperties:wipIdentifier:type: stringexample: "q1w2e3r4"customerIdentifier:type: stringexample: "w2e3r4t5"accountIdentifier:type: stringexample: "e3r4t5y6"activityIdentifier:type: stringexample: "r4t5y6u7"givenName:type: stringexample: "Idara"familyName:type: stringexample: "Adams"email:type: stringexample: "idara.adams@example.org"telephone:type: stringexample: "123.456.7890"status:type: stringexample: "pending"maxValue:type: stringexample: "5000"discount:type: stringexample: "10"### input model for starting onboarding ###start:type: objectproperties:identifier:type: stringexample: "q1w2e3r4"### input model for customers ###customer:type: objectproperties:identifier:type: stringexample: "q1w2e3r4"givenName:type: stringexample: "Idara"familyName:type: stringexample: "Adams"### input model for accounts ###account:type: objectproperties:identifier:type: stringexample: "q1w2e3r4"### input model for activities ###activity:type: objectproperties:identifier:type: stringexample: "q1w2e3r4"### input model for status ###status:type: objectproperties:identifier:type: stringexample: "q1w2e3r4"status:type: stringenum:- pending- completed- abandonedexample: "pending"
Whichever definition we use, we ...