Skip to content

Instantly share code, notes, and snippets.

@hose1021
Last active October 28, 2021 10:13
Show Gist options
  • Save hose1021/00f54d2320dab72101a2e9af2ad06737 to your computer and use it in GitHub Desktop.
Save hose1021/00f54d2320dab72101a2e9af2ad06737 to your computer and use it in GitHub Desktop.

Revisions

  1. hose1021 revised this gist Oct 28, 2021. No changes.
  2. hose1021 revised this gist Oct 28, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion api.yaml
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@ paths:
    '404':
    description: User Not Found
    operationId: get-users-userId
    description: Retrieve the information of the user with the matching user ID.
    description: Retrieve the information of the user with the matching user ID.asdasddasdasdasdasdasdasd
    x-internal: false
    patch:
    summary: Update User Information
  3. hose1021 created this gist Oct 28, 2021.
    188 changes: 188 additions & 0 deletions api.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,188 @@
    openapi: 3.1.0
    info:
    title: api
    version: '1.0'
    servers:
    - url: 'http://localhost:3000'
    paths:
    '/users/{userId}':
    parameters:
    - schema:
    type: integer
    name: userId
    in: path
    required: true
    description: Id of an existing user.
    get:
    summary: Get User Info by User ID
    tags: []
    responses:
    '200':
    description: User Found
    content:
    application/json:
    schema:
    $ref: '#/components/schemas/User'
    examples:
    Get User Alice Smith:
    value:
    id: 142
    firstName: Alice
    lastName: Smith
    email: [email protected]
    dateOfBirth: '1997-10-31'
    emailVerified: true
    signUpDate: '2019-08-24'
    '404':
    description: User Not Found
    operationId: get-users-userId
    description: Retrieve the information of the user with the matching user ID.
    x-internal: false
    patch:
    summary: Update User Information
    operationId: patch-users-userId
    responses:
    '200':
    description: User Updated
    content:
    application/json:
    schema:
    $ref: '#/components/schemas/User'
    examples:
    Updated User Rebecca Baker:
    value:
    id: 13
    firstName: Rebecca
    lastName: Baker
    email: [email protected]
    dateOfBirth: '1985-10-02'
    emailVerified: false
    createDate: '2019-08-24'
    '404':
    description: User Not Found
    '409':
    description: Email Already Taken
    description: Update the information of an existing user.
    requestBody:
    content:
    application/json:
    schema:
    type: object
    properties:
    firstName:
    type: string
    lastName:
    type: string
    email:
    type: string
    description: 'If a new email is given, the user''s email verified property will be set to false.'
    dateOfBirth:
    type: string
    examples:
    Update First Name:
    value:
    firstName: Rebecca
    Update Email:
    value:
    email: [email protected]
    Update Last Name & Date of Birth:
    value:
    lastName: Baker
    dateOfBirth: '1985-10-02'
    description: Patch user properties to update.
    /user:
    post:
    summary: Create New User
    operationId: post-user
    responses:
    '200':
    description: User Created
    content:
    application/json:
    schema:
    $ref: '#/components/schemas/User'
    examples:
    New User Bob Fellow:
    value:
    id: 12
    firstName: Bob
    lastName: Fellow
    email: [email protected]
    dateOfBirth: '1996-08-24'
    emailVerified: false
    createDate: '2020-11-18'
    '400':
    description: Missing Required Information
    '409':
    description: Email Already Taken
    requestBody:
    content:
    application/json:
    schema:
    type: object
    properties:
    firstName:
    type: string
    lastName:
    type: string
    email:
    type: string
    dateOfBirth:
    type: string
    format: date
    required:
    - firstName
    - lastName
    - email
    - dateOfBirth
    examples:
    Create User Bob Fellow:
    value:
    firstName: Bob
    lastName: Fellow
    email: [email protected]
    dateOfBirth: '1996-08-24'
    description: Post the necessary fields for the API to create a new user.
    description: Create a new user.
    components:
    schemas:
    User:
    title: User
    type: object
    description: ''
    examples:
    - id: 142
    firstName: Alice
    lastName: Smith
    email: [email protected]
    dateOfBirth: '1997-10-31'
    emailVerified: true
    signUpDate: '2019-08-24'
    properties:
    id:
    type: integer
    description: Unique identifier for the given user.
    firstName:
    type: string
    lastName:
    type: string
    email:
    type: string
    format: email
    dateOfBirth:
    type: string
    format: date
    example: '1997-10-31'
    emailVerified:
    type: boolean
    description: Set to true if the user's email has been verified.
    createDate:
    type: string
    format: date
    description: The date that the user was created.
    required:
    - id
    - firstName
    - lastName
    - email
    - emailVerified