From da6251f078e138d502b947a4dcf7b21d99857788 Mon Sep 17 00:00:00 2001 From: zhirezhixin Date: Wed, 8 Apr 2020 14:08:30 -0700 Subject: [PATCH 1/6] docs: initiate first version api --- api/FHDA-1.1.0-swagger.yaml | 187 ++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 api/FHDA-1.1.0-swagger.yaml diff --git a/api/FHDA-1.1.0-swagger.yaml b/api/FHDA-1.1.0-swagger.yaml new file mode 100644 index 0000000..e16418d --- /dev/null +++ b/api/FHDA-1.1.0-swagger.yaml @@ -0,0 +1,187 @@ +swagger: '2.0' +info: + description: Initial API for FHDA + version: "1.1.0" + title: FHDA API + # put the contact info for your development or API team + + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + +# tags are used for organizing operations +tags: +- name: admins + description: Secured Admin-only calls + +paths: + /course_by_quarter: + get: + tags: + - admins + summary: get course info + operationId: getCourseByQuarter + description: | + Search for course by quarter + produces: + - application/json + parameters: + - in: query + name: quarter + description: the quarter for searching + type: string + + responses: + 200: + description: search results matching criteria + schema: + type: array + items: + $ref: '#/definitions/Course' + 400: + description: bad input parameter + + /course_by_quarter_and_dept: + get: + tags: + - admins + summary: get course info + operationId: getCourseByQuarterAndDept + description: | + Search for course by inputing both quarter and department name + produces: + - application/json + parameters: + - in: query + name: quarter + description: the quarter for searching + type: string + - in: query + name: dept + description: the department name for searching + type: string + + responses: + 200: + description: search results matching criteria + schema: + type: array + items: + $ref: '#/definitions/Course' + 400: + description: bad input parameter + + + + /add_course: + post: + tags: + - admins + summary: adds a course + operationId: addCourse + description: Adds a course to the system + parameters: + - in: body + name: course + description: course object to add + schema: + $ref: '#/definitions/Course' + responses: + 201: + description: course created + 400: + description: invalid input, object invalid + 409: + description: an existing course already exists +definitions: + Course: + type: object + required: + - crn + - courseName + - instructorName + - Dates + - Time + properties: + crn: + type: string + format: uuid + example: 00002 + courseName: + type: string + example: FINAN ACCOUNTNG I + startDate: + type: string + format: date + example: 2018-09-02 + endDate: + type: string + format: date + example: 2018-12-12 + startTime: + type: string + example: 8:00:00 + endTime: + type: string + example: 10:00:00 + capacity: + type: integer + example: 40 + wl_capacity: + type: integer + example: 10 + active: + type: array + items: + type: integer + format: int32 + example: [0, 0, 1, 13] + wl_active: + type: array + items: + type: integer + format: int32 + example: [0, 0, 0, 0] + fetchTime: + type: array + items: + type: string + format: date-time + example: ['2018-07-02T15:00:00Z', '2018-07-02T18:00:00Z', + '2018-07-03T15:00:00Z', '2018-07-03T18:00:00Z'] + instructor: + $ref: '#/definitions/Instructor' + department: + $ref: '#/definitions/Department/properties/dept_name' + Instructor: + required: + - name + properties: + name: + type: string + example: Farshod Mosh + email: + type: string + example: moshfarshod@fhda.edu + phone: + type: string + example: 1234567890 + Department: + required: + - dept_name + properties: + dept_name: + type: string + example: ACCT + courses: + type: array + example: ['00002', '00004'] + instructors: + type: array + example: ['Accounting Instructor', 'Accounting Professor'] + +# Added by API Auto Mocking Plugin +host: virtserver.swaggerhub.com +basePath: /yifeili98/FHDA_Incubator/1.1.0 +schemes: + - https \ No newline at end of file From 1d71c32bb9b332e5fcfecd0e3ec3ac936c56c2a7 Mon Sep 17 00:00:00 2001 From: zhirezhixin Date: Sat, 11 Apr 2020 21:39:13 -0700 Subject: [PATCH 2/6] docs: add some more course and lab examples --- api/FHDA-1.1.0-swagger.yaml | 187 ------------------ api/fhda_api_1.1.yaml | 382 ++++++++++++++++++++++++++++++++++++ 2 files changed, 382 insertions(+), 187 deletions(-) delete mode 100644 api/FHDA-1.1.0-swagger.yaml create mode 100644 api/fhda_api_1.1.yaml diff --git a/api/FHDA-1.1.0-swagger.yaml b/api/FHDA-1.1.0-swagger.yaml deleted file mode 100644 index e16418d..0000000 --- a/api/FHDA-1.1.0-swagger.yaml +++ /dev/null @@ -1,187 +0,0 @@ -swagger: '2.0' -info: - description: Initial API for FHDA - version: "1.1.0" - title: FHDA API - # put the contact info for your development or API team - - license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html - -# tags are used for organizing operations -tags: -- name: admins - description: Secured Admin-only calls - -paths: - /course_by_quarter: - get: - tags: - - admins - summary: get course info - operationId: getCourseByQuarter - description: | - Search for course by quarter - produces: - - application/json - parameters: - - in: query - name: quarter - description: the quarter for searching - type: string - - responses: - 200: - description: search results matching criteria - schema: - type: array - items: - $ref: '#/definitions/Course' - 400: - description: bad input parameter - - /course_by_quarter_and_dept: - get: - tags: - - admins - summary: get course info - operationId: getCourseByQuarterAndDept - description: | - Search for course by inputing both quarter and department name - produces: - - application/json - parameters: - - in: query - name: quarter - description: the quarter for searching - type: string - - in: query - name: dept - description: the department name for searching - type: string - - responses: - 200: - description: search results matching criteria - schema: - type: array - items: - $ref: '#/definitions/Course' - 400: - description: bad input parameter - - - - /add_course: - post: - tags: - - admins - summary: adds a course - operationId: addCourse - description: Adds a course to the system - parameters: - - in: body - name: course - description: course object to add - schema: - $ref: '#/definitions/Course' - responses: - 201: - description: course created - 400: - description: invalid input, object invalid - 409: - description: an existing course already exists -definitions: - Course: - type: object - required: - - crn - - courseName - - instructorName - - Dates - - Time - properties: - crn: - type: string - format: uuid - example: 00002 - courseName: - type: string - example: FINAN ACCOUNTNG I - startDate: - type: string - format: date - example: 2018-09-02 - endDate: - type: string - format: date - example: 2018-12-12 - startTime: - type: string - example: 8:00:00 - endTime: - type: string - example: 10:00:00 - capacity: - type: integer - example: 40 - wl_capacity: - type: integer - example: 10 - active: - type: array - items: - type: integer - format: int32 - example: [0, 0, 1, 13] - wl_active: - type: array - items: - type: integer - format: int32 - example: [0, 0, 0, 0] - fetchTime: - type: array - items: - type: string - format: date-time - example: ['2018-07-02T15:00:00Z', '2018-07-02T18:00:00Z', - '2018-07-03T15:00:00Z', '2018-07-03T18:00:00Z'] - instructor: - $ref: '#/definitions/Instructor' - department: - $ref: '#/definitions/Department/properties/dept_name' - Instructor: - required: - - name - properties: - name: - type: string - example: Farshod Mosh - email: - type: string - example: moshfarshod@fhda.edu - phone: - type: string - example: 1234567890 - Department: - required: - - dept_name - properties: - dept_name: - type: string - example: ACCT - courses: - type: array - example: ['00002', '00004'] - instructors: - type: array - example: ['Accounting Instructor', 'Accounting Professor'] - -# Added by API Auto Mocking Plugin -host: virtserver.swaggerhub.com -basePath: /yifeili98/FHDA_Incubator/1.1.0 -schemes: - - https \ No newline at end of file diff --git a/api/fhda_api_1.1.yaml b/api/fhda_api_1.1.yaml new file mode 100644 index 0000000..25206e1 --- /dev/null +++ b/api/fhda_api_1.1.yaml @@ -0,0 +1,382 @@ +swagger: '2.0' +info: + description: Initial API for FHDA + version: "1.1.1" + title: FHDA API + + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + +# tags are used for organizing operations +tags: +- name: admins + description: Secured Admin-only calls + +paths: + /course_by_quarter: + get: + tags: + - admins + summary: get course info + operationId: getCourseByQuarter + description: | + Search for course by quarter + produces: + - application/json + parameters: + - in: query + name: quarter + description: the quarter for searching + type: string + + responses: + 200: + description: search results matching criteria + schema: + type: array + items: + $ref: '#/definitions/CourseAcctD001A' + 400: + description: bad input parameter + + /course_by_quarter_and_dept: + get: + tags: + - admins + summary: get course info + operationId: getCourseByQuarterAndDept + description: | + Search for course by inputing both quarter and department name + produces: + - application/json + parameters: + - in: query + name: quarter + description: the quarter for searching + type: string + - in: query + name: dept + description: the department name for searching + type: string + + responses: + 200: + description: search results matching criteria + schema: + type: array + items: + $ref: '#/definitions/CourseAcctD001A' + 400: + description: bad input parameter + + /get_dept: + get: + tags: + - admins + summary: get deptartment info + operationId: getDept + description: | + Search for department given input department name + produces: + - application/json + parameters: + - in: query + name: deptName + description: the department name for searching + type: string + responses: + 200: + description: search results matching criteria + schema: + type: array + items: + $ref: '#/definitions/DepartmentAcct' + 400: + description: bad input parameter + + /add_course: + post: + tags: + - admins + summary: adds a course + operationId: addCourse + description: Adds a course to the system + parameters: + - in: body + name: course + description: course object to add + schema: + $ref: '#/definitions/CourseAcctD001A' + responses: + 201: + description: course created + 400: + description: invalid input, object invalid + 409: + description: an existing course already exists + +###############################DEFINITIONS#################################### +definitions: + CourseAcctD001A: + type: object + required: + - crn + - courseName + - instructorName + - Dates + - Time + properties: + crn: + type: string + format: uuid + example: 00002 + courseName: + type: string + example: FINAN ACCOUNTNG I + courseNum: + type: string + example: D001A + startDate: + type: string + format: date + example: 09/02 + endDate: + type: string + format: date + example: 12/12 + startTime: + type: string + example: 8:00 am + endTime: + type: string + example: 10:00 am + capacity: + type: integer + example: 40 + wl_capacity: + type: integer + example: 10 + active: + type: array + items: + type: integer + format: int32 + example: 0, 0, 1, 13 + + wl_active: + type: array + items: + type: integer + format: int32 + example: 0, 0, 0, 0 + fetchTime: + type: array + items: + type: string + format: date-time + example: 2018-07-02T15:00:00Z, 2018-07-02T18:00:00Z, + 2018-07-03T15:00:00Z, 2018-07-03T18:00:00Z + instructor: + $ref: '#/definitions/InstructorFarshod' + department: + $ref: '#/definitions/DepartmentAcct/properties/dept_name' + + CourseCSD022A: + type: object + required: + - crn + - courseName + - instructorName + - Dates + - Time + properties: + crn: + type: string + format: uuid + example: 44663 + courseName: + type: string + example: Beginning Programming Methodologies in C++ + courseNum: + type: string + example: D022A + startDate: + type: string + format: date + example: 04/09 + endDate: + type: string + format: date + example: 06/29 + startTime: + type: string + example: 08:00 pm + endTime: + type: string + example: 09:50 pm + capacity: + type: integer + example: 40 + wl_capacity: + type: integer + example: 10 + active: + type: array + items: + type: integer + format: int32 + example: 0, 20, 27, 40 + wl_active: + type: array + items: + type: integer + format: int32 + example: 0, 0, 0, 10 + fetchTime: + type: array + items: + type: string + format: date-time + example: 2018-03-02T15:00:00Z, 2018-03-02T18:00:00Z, + 2018-04-03T15:00:00Z, 2018-05-03T18:00:00Z + + CoursePhysicsD004A: + type: object + required: + - crn + - courseName + - instructorName + - Dates + - Time + properties: + crn: + type: string + format: uuid + example: 02076 + courseName: + type: string + example: PHYS SCIENT/ENG:MECHANCS + courseNum: + type: string + example: D004A + days: + type: string + example: MTWRF + startDate: + type: string + format: date + example: 09/20 + endDate: + type: string + format: date + example: 12/10 + startTime: + type: string + example: 09:30 am + endTime: + type: string + example: 12:15 pm + capacity: + type: integer + example: 40 + wl_capacity: + type: integer + example: 10 + active: + type: array + items: + type: integer + format: int32 + example: 0, 20, 27, 40 + wl_active: + type: array + items: + type: integer + format: int32 + example: 0, 0, 0, 10 + fetchTime: + type: array + items: + type: string + format: date-time + example: 2018-03-02T15:00:00Z, 2018-03-02T18:00:00Z, + 2018-04-03T15:00:00Z, 2018-05-03T18:00:00Z + + InstructorFarshod: + required: + - name + properties: + name: + type: string + example: Mosh,Farshod + email: + type: string + example: moshfarshod@fhda.edu + phone: + type: string + example: 1234567890 + + InstructorLuna: + required: + - name + properties: + name: + type: string + example: Eduardo,F,Luna + email: + type: string + example: eduardoluna@fhda.edu + phone: + type: string + example: 3213123133 + + DepartmentAcct: + required: + - dept_name + properties: + dept_name: + type: string + example: ACCT + courses: + type: array + example: 00002, 00004 + instructors: + type: array + example: Accounting Instructor, Accounting Professor + + LabPhysicsD004A: + required: + - uid + properties: + uid: + type: string + example: 02076L + days: + type: string + example: W + startDate: + type: string + format: date + example: 09/20 + endDate: + type: string + format: date + example: 12/10 + startTime: + type: string + example: 09:30 am + endTime: + type: string + example: 12:15 pm + instructor: + $ref: '#/definitions/InstructorLuna' + location: + type: string + example: DA S11 + +# Added by API Auto Mocking Plugin +host: virtserver.swaggerhub.com +basePath: /yifeili98/FHDA_Incubator/1.1.0 +schemes: + - https \ No newline at end of file From f28cf8545c5117011aff870a4fd282dbcf175c15 Mon Sep 17 00:00:00 2001 From: zhirezhixin Date: Sat, 11 Apr 2020 22:01:43 -0700 Subject: [PATCH 3/6] fix: correct a version number typo --- api/fhda_api_1.1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/fhda_api_1.1.yaml b/api/fhda_api_1.1.yaml index 25206e1..40983dd 100644 --- a/api/fhda_api_1.1.yaml +++ b/api/fhda_api_1.1.yaml @@ -377,6 +377,6 @@ definitions: # Added by API Auto Mocking Plugin host: virtserver.swaggerhub.com -basePath: /yifeili98/FHDA_Incubator/1.1.0 +basePath: /yifeili98/FHDA_Incubator/1.1.1 schemes: - https \ No newline at end of file From 6735bfda0599560d4028248268635072f541d8d2 Mon Sep 17 00:00:00 2001 From: zhirezhixin Date: Wed, 15 Apr 2020 22:17:17 -0700 Subject: [PATCH 4/6] docs: reformat api structure --- api/fhda_api_1.1.yaml | 148 +++++++++++++++++++++++++++--------------- 1 file changed, 96 insertions(+), 52 deletions(-) diff --git a/api/fhda_api_1.1.yaml b/api/fhda_api_1.1.yaml index 25206e1..8a17847 100644 --- a/api/fhda_api_1.1.yaml +++ b/api/fhda_api_1.1.yaml @@ -1,35 +1,34 @@ swagger: '2.0' info: description: Initial API for FHDA - version: "1.1.1" + version: "1.1.2" title: FHDA API license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html - -# tags are used for organizing operations -tags: -- name: admins - description: Secured Admin-only calls + name: License Not determined + url: http://www.blank.org paths: - /course_by_quarter: +#################COURSE OPERATIONS########################### + /course/get: get: - tags: - - admins - summary: get course info - operationId: getCourseByQuarter + summary: get course info by passing parameters + operationId: getCourse description: | Search for course by quarter produces: - application/json parameters: - - in: query - name: quarter - description: the quarter for searching - type: string - + - in: query + name: quarter + description: the quarter for searching + type: string + required: true + - in: query + name: crn + description: the crn for searching + type: string + required: false responses: 200: description: search results matching criteria @@ -39,84 +38,129 @@ paths: $ref: '#/definitions/CourseAcctD001A' 400: description: bad input parameter + 404: + description: cannot find the course with given parameter - /course_by_quarter_and_dept: + /course/add: + post: + summary: adds a course + operationId: addCourse + description: Adds a course to the system + parameters: + - in: body + name: course + description: course object to add + schema: + $ref: '#/definitions/CourseAcctD001A' + responses: + 201: + description: course created + 400: + description: invalid input, object invalid + 409: + description: an existing course already exists + +#################DEPTARTMENT OPERATIONS########################### + /dept/get: get: - tags: - - admins - summary: get course info - operationId: getCourseByQuarterAndDept + summary: get deptartment info + operationId: getDept description: | - Search for course by inputing both quarter and department name + Search for department given input department name produces: - application/json parameters: - in: query - name: quarter - description: the quarter for searching - type: string - - in: query - name: dept + name: deptName description: the department name for searching type: string - + required: true responses: 200: description: search results matching criteria schema: type: array items: - $ref: '#/definitions/CourseAcctD001A' + $ref: '#/definitions/DepartmentAcct' 400: description: bad input parameter + 404: + description: cannot find the department with given parameter + + /dept/add: + post: + summary: adds a department + operationId: addDept + description: Adds a department to the system + parameters: + - in: body + name: department + description: departmentr object to add + schema: + $ref: '#/definitions/DepartmentAcct' + responses: + 201: + description: department created + 400: + description: invalid input, object invalid + 409: + description: an existing department already exists - /get_dept: + +#################Instructor OPERATIONS########################### + /instructor/get: get: - tags: - - admins - summary: get deptartment info - operationId: getDept + summary: get instructor info + operationId: getInstructor description: | - Search for department given input department name + Search for an instructor using either instructor name or course crn produces: - application/json parameters: - in: query - name: deptName - description: the department name for searching + name: instructorName + description: using instructor name for searching + type: string + required: false + - in: query + name: crn + description: search for the instructor of a specific course type: string + required: false responses: 200: description: search results matching criteria schema: type: array items: - $ref: '#/definitions/DepartmentAcct' + $ref: '#/definitions/InstructorFarshod' 400: description: bad input parameter + 404: + description: cannot find the instructor with given parameter - /add_course: + /instructor/add: post: - tags: - - admins - summary: adds a course - operationId: addCourse - description: Adds a course to the system + summary: adds an instructor + operationId: addInstructor + description: Adds a instructor to the system parameters: - in: body - name: course - description: course object to add + name: instructor + description: instructor object to add schema: - $ref: '#/definitions/CourseAcctD001A' + $ref: '#/definitions/InstructorFarshod' responses: 201: - description: course created + description: instructor added 400: description: invalid input, object invalid 409: - description: an existing course already exists + description: an existing instructor already exists + + -###############################DEFINITIONS#################################### +###############################DEFINITIONS############################### definitions: CourseAcctD001A: type: object From 828e6aee3626fee63ac70f156779f5caf1448426 Mon Sep 17 00:00:00 2001 From: zhirezhixin Date: Wed, 20 May 2020 10:02:34 -0700 Subject: [PATCH 5/6] feat: finish CRUD API for Department,Course and Instructor --- api/fhda_api_1.1.yaml | 257 +++++++++++++++++++++++++++++++++--------- 1 file changed, 205 insertions(+), 52 deletions(-) diff --git a/api/fhda_api_1.1.yaml b/api/fhda_api_1.1.yaml index 40983dd..cce1687 100644 --- a/api/fhda_api_1.1.yaml +++ b/api/fhda_api_1.1.yaml @@ -1,35 +1,34 @@ swagger: '2.0' info: description: Initial API for FHDA - version: "1.1.1" + version: "1.1.3" title: FHDA API license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html -# tags are used for organizing operations -tags: -- name: admins - description: Secured Admin-only calls - paths: - /course_by_quarter: +#################COURSE OPERATIONS########################### + /courses: get: - tags: - - admins - summary: get course info - operationId: getCourseByQuarter + summary: get course info by passing parameters + operationId: getCourse description: | Search for course by quarter produces: - application/json parameters: - - in: query - name: quarter - description: the quarter for searching - type: string - + - in: query + name: quarter + description: the quarter for searching + type: string + required: true + - in: query + name: crn + description: the crn for searching + type: string + required: false responses: 200: description: search results matching criteria @@ -39,84 +38,230 @@ paths: $ref: '#/definitions/CourseAcctD001A' 400: description: bad input parameter + 404: + description: cannot find the course with given parameter + + put: + summary: adds a new course + operationId: addCourse + description: Adds a course to the system + parameters: + - in: body + name: course + description: course object to add + schema: + $ref: '#/definitions/CourseAcctD001A' + responses: + 201: + description: course created + 400: + description: invalid input, object invalid + 409: + description: an existing course already exists + + post: + summary: edit a course + operationId: editCourse + description: Edits a course in the system + parameters: + - in: query + name: crn + description: using crn for searching + type: string + required: true + responses: + 201: + description: course editted + 400: + description: invalid input, object invalid - /course_by_quarter_and_dept: + delete: + summary: deletes a course + operationId: deleteCourse + description: Deletes a course from the system + parameters: + - in: query + name: crn + description: using crn for searching + type: string + required: true + responses: + 200: + description: course deleted + 400: + description: invalid input, object invalid + 404: + description: requested course not found + + + +#################DEPTARTMENT OPERATIONS########################### + /departments: get: - tags: - - admins - summary: get course info - operationId: getCourseByQuarterAndDept + summary: get deptartment info + operationId: getDept description: | - Search for course by inputing both quarter and department name + Search for department given input department name produces: - application/json parameters: - in: query - name: quarter - description: the quarter for searching - type: string - - in: query - name: dept + name: deptName description: the department name for searching type: string - + required: true responses: 200: description: search results matching criteria schema: type: array items: - $ref: '#/definitions/CourseAcctD001A' + $ref: '#/definitions/DepartmentAcct' 400: description: bad input parameter + 404: + description: cannot find the department with given parameter + + put: + summary: adds a department + operationId: addDept + description: Adds a department to the system + parameters: + - in: body + name: department + description: departmentr object to add + schema: + $ref: '#/definitions/DepartmentAcct' + responses: + 201: + description: department created + 400: + description: invalid input, object invalid + 409: + description: an existing department already exists - /get_dept: + post: + summary: edit a department + operationId: editDepartment + description: Edits a department in the system + parameters: + - in: query + name: departmentName + description: using department name for searching + type: string + required: true + responses: + 201: + description: department editted + 400: + description: invalid input, object invalid + + delete: + summary: deletes a department + operationId: deleteDepartment + description: Deletes a department from the system + parameters: + - in: query + name: departmentName + description: using department name for searching + type: string + required: true + responses: + 200: + description: department deleted + 400: + description: invalid input, object invalid + 404: + description: requested department not found + + +#################Instructor OPERATIONS########################### + /instructors: get: - tags: - - admins - summary: get deptartment info - operationId: getDept + summary: get instructor info + operationId: getInstructor description: | - Search for department given input department name + Search for an instructor using either instructor name or course crn produces: - application/json parameters: - in: query - name: deptName - description: the department name for searching + name: instructorName + description: using instructor name for searching + type: string + required: false + - in: query + name: crn + description: search for the instructor of a specific course type: string + required: false responses: 200: description: search results matching criteria schema: type: array items: - $ref: '#/definitions/DepartmentAcct' + $ref: '#/definitions/InstructorFarshod' 400: description: bad input parameter + 404: + description: cannot find the instructor with given parameter - /add_course: - post: - tags: - - admins - summary: adds a course - operationId: addCourse - description: Adds a course to the system + put: + summary: adds an instructor + operationId: addInstructor + description: Adds an instructor to the system parameters: - in: body - name: course - description: course object to add + name: instructor + description: instructor object to add schema: - $ref: '#/definitions/CourseAcctD001A' + $ref: '#/definitions/InstructorFarshod' responses: 201: - description: course created + description: instructor added 400: description: invalid input, object invalid 409: - description: an existing course already exists + description: an existing instructor already exists + + post: + summary: edit an instructor + operationId: editInstructor + description: Edits an instructor in the system + parameters: + - in: query + name: instructorName + description: using instructor name for searching + type: string + required: true + responses: + 201: + description: instructor editted + 400: + description: invalid input, object invalid -###############################DEFINITIONS#################################### + delete: + summary: deletes an instructor + operationId: deleteInstructor + description: Deletes an instructor from the system + parameters: + - in: query + name: instructorName + description: using instructor name for searching + type: string + required: true + responses: + 200: + description: instructor deleted + 400: + description: invalid input, object invalid + 404: + description: requested instructor not found + + + +###############################DEFINITIONS############################### definitions: CourseAcctD001A: type: object @@ -137,6 +282,9 @@ definitions: courseNum: type: string example: D001A + days: + type: string + example: TR startDate: type: string format: date @@ -201,6 +349,9 @@ definitions: courseNum: type: string example: D022A + days: + type: string + example: MW startDate: type: string format: date @@ -277,6 +428,8 @@ definitions: endTime: type: string example: 12:15 pm + lab: + $ref: '#/definitions/LabPhysicsD004A' capacity: type: integer example: 40 @@ -377,6 +530,6 @@ definitions: # Added by API Auto Mocking Plugin host: virtserver.swaggerhub.com -basePath: /yifeili98/FHDA_Incubator/1.1.1 +basePath: /yifeili98/FHDA_Incubator/1.1.3 schemes: - https \ No newline at end of file From 2f7b6aedbef1a5cde4e30166b9caf46802c132ca Mon Sep 17 00:00:00 2001 From: zhirezhixin Date: Tue, 16 Jun 2020 21:32:28 -0700 Subject: [PATCH 6/6] fix: improve RESTful naming logic --- api/fhda_api_1.1.yaml | 44 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/api/fhda_api_1.1.yaml b/api/fhda_api_1.1.yaml index a29bdc8..72f5551 100644 --- a/api/fhda_api_1.1.yaml +++ b/api/fhda_api_1.1.yaml @@ -1,16 +1,43 @@ swagger: '2.0' info: description: Initial API for FHDA - version: "1.1.3" + version: "1.1.4" title: FHDA API license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html + name: License Not determined + url: http://www.blank.org paths: #################COURSE OPERATIONS########################### /courses: + get: + summary: get courses of a given quarter (possibly specify the department) + operationId: getCourses + description: | + Search for all courses of a quarter (possibly specify the department) + produces: + - application/json + parameters: + - in: query + name: quarter + description: the quarter for displaying + type: string + required: true + - in: query + name: department + description: the department for displaying + type: string + required: false + responses: + 200: + description: search results matching criteria + 400: + description: bad input parameter + 404: + description: cannot find the course with given parameter + + /course: get: summary: get course info by passing parameters operationId: getCourse @@ -96,7 +123,7 @@ paths: #################DEPTARTMENT OPERATIONS########################### - /departments: + /department: get: summary: get deptartment info operationId: getDept @@ -121,7 +148,7 @@ paths: description: bad input parameter 404: description: cannot find the department with given parameter - + put: summary: adds a department operationId: addDept @@ -176,7 +203,7 @@ paths: #################Instructor OPERATIONS########################### - /instructors: + /instructor: get: summary: get instructor info operationId: getInstructor @@ -206,7 +233,7 @@ paths: description: bad input parameter 404: description: cannot find the instructor with given parameter - + put: summary: adds an instructor operationId: addInstructor @@ -260,6 +287,7 @@ paths: description: requested instructor not found + ###############################DEFINITIONS############################### definitions: CourseAcctD001A: @@ -529,6 +557,6 @@ definitions: # Added by API Auto Mocking Plugin host: virtserver.swaggerhub.com -basePath: /yifeili98/FHDA_Incubator/1.1.3 +basePath: /yifeili98/FHDA_Incubator/1.1.4 schemes: - https \ No newline at end of file