From 0f2a08bb250386613807f35ccca1bb0b99976574 Mon Sep 17 00:00:00 2001 From: Dave Westerveld Date: Thu, 20 Mar 2025 08:30:27 -0400 Subject: [PATCH] potential updates --- Chapter03/budgeting.yaml | 126 ++++++++++++++++++ Chapter03/todo_list.yaml | 121 +++++++++++++++++ ...I_Chapter6_initial.postman_collection.json | 56 -------- Chapter12/Space-camp.yaml | 125 +++++++++++++++++ 4 files changed, 372 insertions(+), 56 deletions(-) create mode 100644 Chapter03/budgeting.yaml create mode 100644 Chapter03/todo_list.yaml delete mode 100644 Chapter06/Star Wars API_Chapter6_initial.postman_collection.json create mode 100644 Chapter12/Space-camp.yaml diff --git a/Chapter03/budgeting.yaml b/Chapter03/budgeting.yaml new file mode 100644 index 0000000..67e85cf --- /dev/null +++ b/Chapter03/budgeting.yaml @@ -0,0 +1,126 @@ +openapi: 3.0.1 +info: + title: Budgeting API + description: Manages budget line items + version: '1.0' +servers: + - url: http://localhost:5000/budgeting/api + +paths: + /items: + get: + description: Get the list budget line items + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + $ref: '#/components/schemas/items' + post: + description: Create a new budget line item + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/item' + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + $ref: '#/components/schemas/item' + /item/{itemId}: + get: + description: Gets the information for the specified line item + parameters: + - in: path + schema: + $ref: '#/components/schemas/itemId' + name: itemId + description: Id of the line item + required: true + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + $ref: '#/components/schemas/item' + put: + description: Updates the information for the specified line item + parameters: + - in: path + schema: + $ref: '#/components/schemas/itemId' + example: + title: Example Task itemId + value: 1 + name: itemId + description: Id of the line item + required: true + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/item' + examples: + Groceries: + value: + transaction_date: 2024-06-01 + amount: 123.45 + category: groceries + Rent: + value: + transaction_date: 2024-06-01 + amount: 1500 + category: rent + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + $ref: '#/components/schemas/item' + delete: + description: Removes the specified line item + parameters: + - in: path + schema: + $ref: '#/components/schemas/itemId' + name: itemId + description: Id of the line item + required: true + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + type: object +components: + schemas: + item: + type: object + required: + - transaction_date + - amount + - category + properties: + transaction_date: + type: string + format: date + amount: + type: integer + category: + type: string + itemId: + type: integer + minimum: 1 + items: + type: array + items: + $ref: '#/components/schemas/item' diff --git a/Chapter03/todo_list.yaml b/Chapter03/todo_list.yaml new file mode 100644 index 0000000..390a361 --- /dev/null +++ b/Chapter03/todo_list.yaml @@ -0,0 +1,121 @@ +openapi: 3.0.1 +info: + title: ToDo List API + description: Manages ToDo list tasks + version: '1.0' +servers: + - url: http://localhost:5000 + +paths: + /tasks: + get: + description: Get the list of all tasks + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + $ref: '#/components/schemas/tasks' + post: + description: Create a new task + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/task' + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + $ref: '#/components/schemas/task' + /tasks/{taskId}: + get: + description: Gets the information for the specified task + parameters: + - in: path + schema: + $ref: '#/components/schemas/taskId' + name: taskId + description: Id of the task + required: true + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + $ref: '#/components/schemas/task' + put: + description: Updates the information for the specified task + parameters: + - in: path + schema: + $ref: '#/components/schemas/taskId' + example: + title: Example Task taskId + value: 1 + name: taskId + description: Id of the task + required: true + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/task' + examples: + New: + value: + title: Start Learning API Testing + status: New + In Progress: + value: + title: Keeep learning API Testing + status: In Progress + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + $ref: '#/components/schemas/task' + delete: + description: Updates the information for the specified task + parameters: + - in: path + schema: + $ref: '#/components/schemas/taskId' + name: taskId + description: Id of the task + required: true + responses: + '200': + description: Succussful Operation + content: + application/json: + schema: + type: object +components: + schemas: + task: + type: object + required: + - title + - status + properties: + title: + type: string + status: + type: string + enum: [New,In Progress,Completed] + taskId: + type: integer + minimum: 1 + tasks: + type: array + items: + $ref: '#/components/schemas/task' diff --git a/Chapter06/Star Wars API_Chapter6_initial.postman_collection.json b/Chapter06/Star Wars API_Chapter6_initial.postman_collection.json deleted file mode 100644 index 305566a..0000000 --- a/Chapter06/Star Wars API_Chapter6_initial.postman_collection.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "info": { - "_postman_id": "f6cac2da-eb1c-4b51-9859-8e7ee78a4ef6", - "name": "Star Wars API - Chapter 6", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "Get People", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "https://swapi.dev/api/people/1", - "protocol": "https", - "host": [ - "swapi", - "dev" - ], - "path": [ - "api", - "people", - "1" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - }, - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "" - ] - } - } - ], - "variable": [ - { - "key": "base_url", - "value": "https://swapi.dev/api" - } - ] -} \ No newline at end of file diff --git a/Chapter12/Space-camp.yaml b/Chapter12/Space-camp.yaml new file mode 100644 index 0000000..50e8183 --- /dev/null +++ b/Chapter12/Space-camp.yaml @@ -0,0 +1,125 @@ +openapi: 3.0.0 +info: + version: '0.1' + title: 'LibraryAPI' + license: + name: MIT +servers: + - description: The base path for all resources + url: http://localhost:3000/ +paths: + /book: + get: + summary: 'get one book' + operationId: getBook + tags: + - book + parameters: + - name: bookId + in: query + description: ID of the book + required: true + schema: + type: string + format: uuid + responses: + '200': + description: 'Details about a book by ID' + content: + application/json: + schema: + $ref: '#/components/schemas/book' + default: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + /books: + get: + summary: 'get all books' + operationId: getBooks + tags: + - book + responses: + '200': + description: 'Details about many books' + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/books' + default: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + +components: + schemas: + book: + type: object + required: + - id + - title + - author + properties: + id: + type: string + format: uuid + description: ID of the book + example: "e8f70452-0607-4e7b-8ae4-15c4345c9007" + title: + type: string + description: Title of the book + example: "Ready Player One" + author: + type: string + description: Name of the book author + example: "Cline, Ernest" + genre: + type: string + description: Category/genre of the book + example: "Science Fiction" + yearPublished: + type: integer + format: int32 + description: integer year of book publication, negative for B.C. + example: 2011 + checkedOut: + type: boolean + description: is book currently checked out of the library + example: false + createdAt: + type: string + format: date-time + description: date entry was added to library database + example: "2021-06-02 17:37:38" + books: + type: array + items: + $ref: '#/components/schemas/book' + Error: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + example: 404 + description: "integer value indicating a client/server problem" + message: + type: string + securitySchemes: + BasicAuth: + type: http + scheme: basic +security: + - BasicAuth: [] \ No newline at end of file