---
swagger: '2.0'
info:
  description: ''
  version: ''
  title: ''
host: localhost:7777
basePath: "/sample/openapi"
schemes:
- http
paths:
  "/contacts/2":
    post:
      summary: Create a contact
      description: |
        This service creates a contact.  
        If a contactId is provided, it will use that id, else it will generate one.  
        Service responses with the used contact id.  
      operationId: createContact
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: body
        in: body
        required: true
        schema:
          "$ref": "#/definitions/createcontact_req"
      responses:
        '200':
          description: Success response
          schema:
            "$ref": "#/definitions/createcontact_rpy"
    get:
      summary: retrieves a list of contacts
      description:
        Retrieves a list of contacts.
      operationId: queryContacts
      produces:
      - application/json
      responses:
        '200':
          description: Success response
          schema:
            "$ref": "#/definitions/getcontacts_rpy"
  "/contacts/2/{id}":
    get:
      summary: Get a contact
      description: |
        Gets a contact based on contactId.  
        if no contact with contactId exists, a 404 http code is returned.  
      operationId: getContact
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: id
        in: path
        required: true
        type: string
      responses:
        '200':
          description: Success response
          schema:
            "$ref": "#/definitions/getcontact_rpy"
    put:
      summary: retrieves a list of contacts
      description: |
        Updates a contact based on contactId.  
        if no contact with contactId exists, a 404 http code is returned.  
        Only provided fields will get updated.  
        In case a provided body-field is an empty string, that property will be removed.
      operationId: updateContact
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: id
        in: path
        required: true
        type: string
      - name: body
        in: body
        required: true
        schema:
          "$ref": "#/definitions/updatecontact_req"
      responses:
        '200':
          description: Success response
    delete:
      summary: retrieves a list of contacts
      description:
        Deletes a contact based on contactId.  
        if no contact with contactId exists, a 404 http code is returned.  
      operationId: deleteContact
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: id
        in: path
        required: true
        type: string
      responses:
        '200':
          description: Success response
          schema:
            "$ref": "#/definitions/createcontact_rpy"
definitions:
  getcontacts_rpy:
            type: array
            items:
             "$ref": "#/definitions/contact"
  createcontact_req:
    type: object
    properties:
      contactId:
        type: string
        description: Unique identifier for a contact. Identifier is automatically determined by the server when you do not provide a contactId.
      contactType:
        type: string
        enum: [prospect, suspect, customer, supplier]
      name:
        type: string
      phonenumber:
        type: string
      emailaddress:
        type: string
  createcontact_rpy:
    type: object
    properties:
      id:
        type: string
  getcontact_rpy:
    "$ref": "#/definitions/contact"
  updatecontact_req:
    type: object
    properties:
      contactType:
        type: string
        enum: [prospect, suspect, customer, supplier]
      name:
        type: string
      phonenumber:
        type: string
      emailaddress:
        type: string
  contact:
    type: object
    properties:
      contactId:
        type: string
        description: Unique identifier for a contact. Identifier is automatically determined by the server when you create a contact.
      contactType:
        type: string
        enum: [prospect, suspect, customer, supplier]
      name:
        type: string
      phonenumber:
        type: string
      emailaddress:
        type: string
      created:
        type: string
        format: date-time
