/test

後端考試(Python)

Primary LanguagePython

OpenAPI

/

-GET-

Swagger UI

/api/hello

-GET-

question1-a

Input Parameters :

  • No parameters

Success Example

"Hello!"

/api/item

-POST-

question1-b

Input Parameters :

  • item_name  ( string )

Success Example

{
  "result": "success"
}

/api/spec

-GET-

question1-c

Input Parameters :

  • No parameters

Success Example

definitions:
  AddResponse:
    properties:
      sum:
        example: 123
        type: number
    type: object
  ConvertResponse:
    properties:
      text:
        example: textstring
        type: string
    type: object
  PostRequest:
    properties:
      item_name:
        type: string
    required:
    - item_name
    type: object
  PostResponse:
    properties:
      result:
        example: success
        type: string
    type: object
info:
  title: "Jeff - \u5F8C\u7AEF\u8003\u8A66(Python)"
  version: v1
paths:
  /api/hello:
    get:
      description: question1-a
      parameters: []
      responses: {}
      tags:
      - question1
  /api/item:
    post:
      description: question1-b
      parameters:
      - in: body
        name: body
        required: false
        schema:
          $ref: '#/definitions/PostRequest'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/PostResponse'
      tags:
      - question1
  /api/spec:
    get:
      description: question1-c
      parameters: []
      responses: {}
      tags:
      - question1
  /question2/add:
    get:
      description: A function with two parameters, a and b. The return value is a+b.        
      parameters:
      - in: query
        name: a
        required: true
        type: number
      - in: query
        name: b
        required: true
        type: number
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/AddResponse'
      tags:
      - question2
  /question3/convert:
    get:
      description: Convert a ASCII numbers string to TEXT. The text matches a regular       
        expression, '[a-zA-Z]+'gm
      parameters:
      - in: query
        name: ASCII_numbers
        required: true
        type: string
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/ConvertResponse'
      tags:
      - question3
  /question4/sayHello:
    get:
      description: Only a single instance of a program is running.
      parameters:
      - in: query
        name: name
        required: true
        type: string
      - in: query
        name: message
        required: true
        type: string
      responses: {}
      tags:
      - question4
swagger: 2.0.0

/question2/add

-GET-

question2
A function with two parameters, a and b. The return value is a+b.

Input Parameters :

  • a  ( float )
  • b  ( float )

Success Example

{
  "sum": 28.5
}

/question3/convert

-GET-

question3
Convert a ASCII numbers string to TEXT. The text matches a regular expression, '[a-zA-Z]+'gm

Input Parameters :

  • ASCII_numbers  ( string )

Success Example

{
  "text": "Congratulations"
}

/question4/sayHello

-GET-

question4
Only a single instance of a program is running.

Input Parameters :

  • name  ( string )
  • message  ( string )

Success Example

"Hi, Amos. Your message: 透過threading模組的鎖將sayHello程式碼資源鎖定,執行完成後才釋放,如此可確保function一次只給一個程序啟動"