Skip to content

Instantly share code, notes, and snippets.

@keithweaver
Created June 13, 2023 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keithweaver/154921a9c960e140a684ec44c7a11082 to your computer and use it in GitHub Desktop.
Save keithweaver/154921a9c960e140a684ec44c7a11082 to your computer and use it in GitHub Desktop.
Down Swagger
{
"swagger": "2.0",
"info": {
"title": "API",
"contact": {}
},
"host": "http://localhost:9000",
"paths": {
"/basics/cars/downstream": {
"get": {
"description": "List cars",
"tags": [
"Cars"
],
"operationId": "list-downstream-cars",
"parameters": [
{
"type": "string",
"description": "Cursor ID",
"name": "cursor",
"in": "query"
},
{
"type": "string",
"description": "Model",
"name": "model",
"in": "query"
},
{
"type": "string",
"description": "Make",
"name": "make",
"in": "query"
},
{
"type": "string",
"description": "Year",
"name": "year",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cars.ListDownstreamResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.Error"
}
}
}
},
"post": {
"description": "Create a new car in the system",
"tags": [
"Cars"
],
"operationId": "create-downstream-cars",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cars.NewCarResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.Error"
}
}
}
}
},
"/basics/cars/downstream/{id}": {
"delete": {
"description": "Remove a car from the system",
"tags": [
"Cars"
],
"operationId": "delete-downstream-cars",
"parameters": [
{
"type": "string",
"description": "Car ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cars.NewCarResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.Error"
}
}
}
},
"patch": {
"description": "Update a car inventory in the system",
"tags": [
"Cars"
],
"operationId": "update-downstream-cars",
"parameters": [
{
"type": "string",
"description": "Car ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/cars.NewCarResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.Error"
}
}
}
}
}
},
"definitions": {
"cars.AdjustInventoryResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"cars.Body": {
"type": "object",
"properties": {
"doors": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"cars.Car": {
"type": "object",
"properties": {
"body": {
"$ref": "#/definitions/cars.Body"
},
"color": {
"type": "string"
},
"id": {
"type": "string"
},
"inventory": {
"type": "integer"
},
"make": {
"type": "string"
},
"model": {
"type": "string"
},
"topSpeed": {
"type": "integer"
},
"year": {
"type": "integer"
},
"zeroToSixty": {
"type": "number"
}
}
},
"cars.CarListResponse": {
"type": "object",
"properties": {
"cars": {
"type": "array",
"items": {
"$ref": "#/definitions/cars.Car"
}
},
"message": {
"type": "string"
}
}
},
"cars.DownstreamCar": {
"type": "object",
"properties": {
"bodyType": {
"type": "string"
},
"color": {
"type": "string"
},
"doors": {
"type": "integer"
},
"id": {
"type": "string"
},
"inventory": {
"type": "number"
},
"make": {
"type": "string"
},
"model": {
"type": "string"
},
"performance": {
"$ref": "#/definitions/cars.DownstreamPerformance"
},
"year": {
"type": "string"
}
}
},
"cars.DownstreamPerformance": {
"type": "object",
"properties": {
"topSpeed": {
"type": "integer"
},
"zeroToSixty": {
"type": "number"
}
}
},
"cars.ListDownstreamResponse": {
"type": "object",
"properties": {
"cursor": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/cars.DownstreamCar"
}
},
"message": {
"type": "string"
}
}
},
"cars.NewCarResponse": {
"type": "object",
"properties": {
"car": {
"$ref": "#/definitions/cars.DownstreamCar"
},
"message": {
"type": "string"
}
}
},
"common.Error": {
"type": "object",
"properties": {
"code": {
"$ref": "#/definitions/common.ErrorCode"
},
"message": {
"type": "string"
},
"statusCode": {
"type": "integer"
}
}
},
"common.ErrorCode": {
"type": "string",
"enum": [
"validate_password_empty",
"check_if_user_exists",
"get_encrypted_password",
"save_user",
"send_verification_email",
"sign_in_fetch_user",
"sign_in_failed_to_fetch_user",
"sign_in_invalid_password",
"sign_in_account_locked",
"sign_in_validation_failed",
"sign_in_invalid_session",
"save_new_session",
"save_new_company",
"failed_to_list_companies",
"verify_referral_code_invalid",
"failed_to_list_platforms"
],
"x-enum-varnames": [
"ValidatePasswordEmpty",
"CheckIfUserExists",
"GetEncryptedPassword",
"SaveUser",
"SendVerificationEmail",
"SignInFetchUser",
"SignInFailedToFetchUser",
"SignInInvalidPassword",
"SignInAccountLocked",
"SignInValidationFailed",
"SignInInvalidSession",
"SaveNewSession",
"SaveNewCompany",
"FailedToListCompanies",
"VerifyReferralCodeInvalid",
"FailedToListPlatforms"
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment