1

I have been using "$ref" for cases which are having the exact same "key-value" pairs. In some cases however, the value is different and I want to change that manually. How can this be done in the code?

Example: the "$ref" "Permission" has been used for the property "can_confirm". Written this way, I am unable to change the default values of "Permission" for when it is used in "can_confirm".

Any help would be higly appreciated! : )

Here is the code:

},
"schemas": {
  "Job": {
    "properties": {
      "id": {
        "type": "integer",
        "example": 2584075,
        "description": "Unique identifier"
      },
      "currency_code": {
        "type": "string",
        "example": "GBP",
        "description": "Currency code"
      },
      "payment_method": {
        "properties": {
          "id": {
            "type": "integer",
            "example": 1,
            "description": "Unique identifier"
          },
          "name": {
            "type": "string",
            "example": "Cash",
            "description": "test"
          }
        }
      },
      "app_time": {
        "type": "integer",
        "example": 1504620000,
        "description": "Appointment time for the job in UTC timestamp"
      },
      "flexible_from": {
        "type": "integer",
        "example": null,
        "description": "Start of timeframe to execute the job in UTC timestamp"
      },
      "flexible_to": {
        "type": "integer",
        "example": null,
        "description": "End of timeframe to execute the job in UTC timestamp"
      },
      "insufficient_travel_time_warning_time": {
        "type": "integer",
        "example": "1504616400",
        "description": "Time up until Pro should leave previous job in order to get to this job in time in UTC timestamp"
      },
      "total_formatted": {
        "type": "string",
        "example": "£97",
        "description": "Price of the service after discounts"
      },
      "base_total_formatted": {
        "type": "string",
        "example": "£97",
        "description": "Price of the service before discounts"
      },
      "price_notes": {
        "type": "array",
        "example": [
          "Credit applied",
          "Compensation included"
        ],
        "description": "Description notes for the price of the services."
      },
      "require_summary": {
        "type": "integer",
        "example": 4,
        "description": "\n * `0` - No summary required \n * `1` - Should send summary at the end of the day \n * `2` - Should send summary now \n * `3` - Can’t proceed until summary sent \n * `4` - Summary sent"
      },
      "work_time": {
        "type": "integer",
        "example": 120,
        "description": "Job duration in minutes"
      },
      "valid_to": {
        "type": "integer",
        "example": "1504620000",
        "description": "Time after which job is no more valid and has to be updated in UTC timestamp"
      },
      "attachments.origin_key": {
        "type": "string",
        "example": "checklist",
        "description": "\n Identifies where the attachment is coming from: \n * `checklist` - from answering a question that requires attachment \n * `job` - from job screen \n * `configurator` - from booking process when filling a choice item of type attachment"
      },
      "reference_number": {
        "type": "string",
        "example": "20082602SYS",
        "description": "Unique identifying number for each job"
      },
      "purchase_order_number": {
        "type": "string",
        "example": "12-13-14-15-16",
        "description": "Unique number assigned to a purchase order form"
      },
      "contacts": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Contact"
        }
      },
      "message_templates": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/MessageTemplate"
        }
      },
      "decline_reason_groups": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/DeclineReasonGroup"
        }
      },
      "icons": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Icon"
        }
      },
      "service_details": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ServiceDetails"
        }
      },
      "checklists": {
        "type": "array",
        "example": [
          "123",
          "345"
          ]
      },
      "checklist_reports": {
        "type": "array",
        "example": [
          "1",
          "2"
          ]
      },
      "attachments": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Attachment"
        }
      },
      "summary": {
        "properties": {
          "id": {
           "type": "string",
          "example": "20",
          "description": "Unique identifier"
          },
          "work_time": {
            "type": "integer",
            "example": 360,
            "description": "The duration of the service"
          },
          "comment": {
            "type": "string",
            "example": null,
            "description": "Field for additional information"
          },
          "money_collected": {
            "type": "integer",
            "example": 0,
            "description": "The cash payment that has been obtained while on the address"
          },
          "event_time": {
            "type": "integer",
            "example": 1431936812,
            "description": "The point of time at which the summary has been opened"
          }
        }
      },
      "services_price_modifiers": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ServicePriceModifier"
        }
      },
      "geofence_radiuses": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/GeofenceRadius"
        }
      },
      "arrival_timeframes": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ArrivalTimeframe"
        }
      },
      "permissions": {
        "properties": {
          "can_confirm": {
            "$ref": "#/components/schemas/Permission",
            "example": {
              "from": 2,
              "to": 1
            }
          },
          "can_checkin": {
            "properties": {
              "from": {
                "type": "string",
                "example": "1534953201",
                "description": "The starting time from which the user can check in"
              },
              "to": {
                "type": "string",
                "example": "1534993201",
                "description": "The time until the user can check in"
              }
            }
          },
          "can_checkout": {
            "properties": {
              "from": {
                "type": "string",
                "example": "0",
                "description": "The starting time from which the user can check out"
              },
              "to": {
                "type": "string",
                "example": "1534993201",
                "description": "The time until the user can check out"
              }
            }              
          },
          "can_add_attachment": {
            "properties": {
              "from": {
                "type": "string",
                "example": "0",
                "description": "The starting time from which the user can add attachment"
              },
              "to": {
                "type": "string",
                "example": "1534993201",
                "description": "The time until the user can add attachment"
              }
            }                  
          },
          "can_add_comment": {
            "properties": {
              "from": {
                "type": "string",
                "example": "0",
                "description": "The starting time from which the user can add comment"
              },
              "to": {
                "type": "string",
                "example": "999999999",
                "description": "The time until the user can add comment"
              }
            }                  
          },
          "can_call_office": {
            "properties": {
              "from": {
                "type": "string",
                "example": "0",
                "description": "The starting time from which the user can call the office"
              },
              "to": {
                "type": "string",
                "example": "1534993201",
                "description": "The time until the user can call the office"
              }
            }                 
          },
          "can_video_call": {
            "properties": {
              "from": {
                "type": "string",
                "example": "0",
                "description": "The starting time from which the user can start a video call"
              },
              "to": {
                "type": "string",
                "example": "1534993201",
                "description": "The time until the user can start a video call"
              }
            }  
          }
        }
      },
      "events": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Event"
        }
      },
      "performed": {
        "type": "integer",
        "example": 0,
        "description": "Identifies whether the jobs has been performed or not"
      },
      "client": {
        "properties": {
          "name": {
            "type": "string",
            "example": "Leigh Turner",
            "description": "The name of the client"
          },
          "stop_sms_channel": { 
            "type": "boolean",
            "example": true,
            "description": "Defines whether the client could be contacted via sms"
          },
          "stop_phone_channel": { 
            "type": "boolean",
            "example": true,
            "description": "Defines whether the client could be contacted via phone"
          },
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClientContact"
            }
          }
        }
      }
    }
  },
  "Contact": {
    "properties": {
      "id": {
        "type": "integer",
        "example": 203,
        "description": "Unique identifier"
      },
      "value": {
        "type": "string",
        "example": "02034042956",
        "description": "Contact number"
      },
      "type": {
        "$ref": "#/components/schemas/ContactType"
      },
      "description": {
        "type": "string",
        "example": "Customer Service",
        "description": "Name of the corresponding department"
      },
      "display_positions": {
        "type": "array",
        "example": [
          2,
          3,
          7,
          8,
          10
        ],
        "description": ""
      }
    }
  },
  "MessageTemplate": {
    "properties": {
      "id": {
        "type": "integer",
        "example": 15,
        "description": "Unique identifier"
      },
      "title": {
        "type": "string",
        "example": "In front of the property",
        "description": "Template message title"
      },
      "message": {
        "type": "string",
        "example": "Dear [CLIENT_NAME], I am in front of your property. Please let me in or call our office on 02034041930. Your Fantastic Professional",
        "description": "The containing text of the message"
      },
      "vars": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Var"
        },
      },
      "destination_option_title": {
        "type": "string",
        "example": "to office",
        "description": "Optionally defines the destination of the title"
      }
    }
  },
  "DeclineReasonGroup": {
    "properties": {
      "title": {
        "type": "string",
        "example": "Technical issues",
        "description": "Decline reason title"
      },
      "sort": {
        "type": "integer",
        "example": 100,
        "description": "Order of item in list"
      },
      "decline_reasons": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/DeclineReason"
        }
      }
    }
  },
  "Icon": {
    "properties": {
      "name": {
        "type": "string",
        "example": "Key:",
        "description": "The name of the icon"
      },
      "note": {
        "type": "string",
        "example": "Yes",
        "description": "Addiditonal information about the icon"
      }
    }
  },
   "ServiceDetails": {
    "properties": {
      "id": {
        "type": "integer",
        "example": 1,
        "description": "Unique identifier"
      },
      "name": {
        "type": "string",
        "example": "Gardening",
        "description": "The name of the service"
      },
      "prop": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PropType"
        }
      }
    }
  },
  "Var": {
    "properties": {
      "variable": {
        "type": "string",
        "example": "CLIENT_NAME",
        "description": "Different client details"
      },
      "type": {
        "$ref": "#/components/schemas/VarType"
      },
      "field": {
        "type": "string",
        "example": "clientName",
        "description": "Fields where the client's information is filled"
      }
    }
  },
  "PropType": {
    "properties": {
      "name": {
        "type": "string",
        "example": "Additional charges such as team compensation,parking,congestion",
        "description": "The name of the property"
      },
      "sort": {
        "type": "integer",
        "example": 1,
        "description": "Order of item in list"
      },
      "opt": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/OptType"
        }
      }
    }
  },
  "OptType": {
    "properties": {
      "name": {
        "type": "string",
        "example": "Charges",
        "description": "The name of the option"
      },
      "sort": {
        "type": "integer",
        "example": 1,
        "description": "Order of item in list"
      },
      "attr": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/AttrType"
        }
      }
    }
  },
  "AttrType": {
    "properties": {
      "name": {
        "type": "string",
        "example": "Administration fee",
        "description": "The name of the attribute"
      },
      "sort": {
        "type": "integer",
        "example": 1,
        "description": "Order of item in list"
      }
    }
  },
  "Attachment": {
    "properties": {
      "mime_type": {
        "type": "string",
        "example": "image/jpeg",
        "description": "Indicates the nature and format of a document/file"
      },
      "app_token": {
        "type": "string",
        "example": "YgAznLLDEDZhOzkmyTI7RwDy2pnC9RiXFu9sXFOtLsdqbSJVuud9avjlsDzF",
        "description": "Unique alphanumeric code"
      },
      "thumbnail_url": {
        "type": "string",
        "example": "https://files.dxr.cloud/YgAznLLDEDZhOzkmyTI7RwDy2pnC9RiXFu9sXFOtLsdqbSJVuud9avjldwAP",
        "description": "Url link for a thumbnail"
      },
      "url": {
        "type": "string",
        "example": "https://files.dxr.cloud/YgAznLLDEDZhOzkmyTI7RwDy2pnC9RiXFu9sXFOtLsdqbSJVuud9avjlsDzF",
        "description": "A url link"
      },
      "note": {
        "type": "string",
        "example": "Front view of garden after work is done.",
        "description": "Addiditonal information about the attachment"
      },
      "lat": {
        "type": "integer",
        "example": 23.4324324,
        "description": "The measurement of distance north or south of the Equator"
      },
      "lng": {
        "type": "integer",
        "example": 23.4324324,
        "description": "The measurement east or west of the prime meridian"
      },
      "event_time": {
        "type": "integer",
        "example": 1431936812,
        "description": "The point of time at which the attachment is uploaded."
      },
      "origin_key": {
        "type": "string",
        "example": "checklist",
        "description": "The location where the attachment is uploaded"
      }
    }
  },
  "ServicePriceModifier": {
    "properties": {
      "service_title": {
        "type": "string",
        "example": "One-Off cleaning",
        "description": "The name of the service"
      },
      "price_modifiers": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PriceModifier"
        }
      }
    }
  },
  "PriceModifier": {
    "properties": {
      "id": {
        "type": "string",
        "example": "41",
        "description": "Unique identifier"
      },
      "name": {
        "type": "string",
        "example": "Parking",
        "description": "Name of the selected price modifier"
      },
      "description": {
        "type": "string",
        "example": "How much was the parking?",
        "description": "Description of the corresponding price modifier"
      },
      "type": {
        "type": "integer",
        "example": 11,
        "description": ""
      },
      "sort": {
        "type": "integer",
        "example": 100,
        "description": "Order of item in list"
      },
      "type_options": {
        "properties": {
          "min": {
            "type": "integer",
            "example": 0,
            "description": "Minimum price that could be entered"
          },
          "max": {
            "type": "integer",
            "example": "80",
            "description": "Maximum price that could be entered"
          },
          "step": {
            "type": "integer",
            "example": 0.5,
            "description": "The amount with which the price is increased/decreased"
          },
          "value": {
            "type": "integer",
            "example": 0,
            "description": "Value type is based on choice item type: \n * `checkbox` - integer \n * `radio` - integer \n * `stepper` - double \n * `text_field` - string \n * `hours` - double \n * `distance` - address object \n * `always_apply` - boolean \n * `price_per_hour` - double \n * `decimal_text` - string \n * `attachment` - array of string (tokens). \n * `dropdown` - integer \n * `address` - address object"
          },
          "select_options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SelectOption"
            }
          }
        }
      }
    }
  },
  "GeofenceRadius": {
    "properties": {
      "id": {
        "type": "string",
        "example": "1",
        "description": "Unique identifier"
      },
      "distance": {
        "type": "integer",
        "example": 150,
        "description": "The length of the space between the professional and the address"
      }
    }
  },
  "ArrivalTimeframe": {
    "properties": {
      "id": {
        "type": "string",
        "example": "1",
        "description": "Unique identifier"
      },
      "name": {
        "type": "string",
        "example": "10:00 - 10:30",
        "description": "The time within the professional is expected to arrive to the address"
      },
      "sort": {
        "type": "integer",
        "example": 100,
        "description": "Order of item in list"
      }
    }
  },
  "Event": {
    "properties": {
      "type": {
        "type": "integer",
        "example": 7,
        "description": "The type of event"
      },
      "radius": {
        "type": "integer",
        "example": 1,
        "description": ""
      },
      "arrival_timeframe_id": {
        "type": "integer",
        "example": 25,
        "description": "The unique identification number of the arrival timeframe"
      },
      "lat": {
        "type": "integer",
        "example": 23.4324324,
        "description": "The measurement of distance north or south of the Equator"
       },
       "lng": { 
         "type": "integer",
         "example": 23.4324324,
         "description": "The measurement east or west of the prime meridian",
      },
      "event_time": {
        "type": "integer",
        "example": 1504610238,
        "description": "The point of time at which the event has happened"
      }
    }
  },
  "ClientContact": {
    "properties": {
      "id": {
        "type": "integer",
        "example": 2197447,
        "description": "Unique identifier"
      },
      "info": {
        "type": "string",
        "example": "07568***919",
        "description": "The contact information of the client"
      },
      "type": {
        "type": "integer",
        "example": 1,
        "description": "The type of contact method"
      },
      "sort": {
        "type": "integer",
        "example": 1,
        "description": "Order of item in list"
      }
    }
  },
  "SelectOption": {
    "properties": {
      "id": {
        "type": "integer",
        "example": 6000,
        "description": "Unique identifier"
      },
      "name": {
        "type": "string",
        "example": "Chairs",
        "description": "The name of the selected item"
      }
    }
  },
  "Permission": {
            "properties": {
              "from": {
                "type": "integer",
                "example": "1534953201",
                "description": "The starting time from which the user can confirm the job"
              },
              "to": {
                "type": "integer",
                "example": "1534993201",
                "description": "The time until the user can confirm the job"
              }
            }
  },
  "DeclineReason": {
    "properties": {
      "id": {
        "type": "integer",
        "example": 11,
        "description": "Unique identifier"
      },
      "name": {
        "type": "string",
        "example": "Car is broken",
        "description": "The name of a decline reason"
      },
      "requires_comment": {
        "type": "boolean",
        "example": true,
        "description": "Determines whether the comment section is required to be filled "
      },
      "success_message": {
        "type": "string",
        "example": "Please contact Stanimir Tomov on 07472761402 - he can find you another.",
        "description": "The message which pops up after the request made is successful"
      },
      "sort": {
        "type": "integer",
        "example": 100,
        "description": "Order of item in list"
      }
    }
  },
  "ContactType": {
    "type": "integer",
    "enum": [
      1,
      2,
      3,
      4
    ],
    "description": "* `1` - Customer Service \n * `2` - Sales \n * `3` - Finance \n * `4` - Other"
  },
  "VarType": {
    "type": "string",
    "enum": [
      "auto",
      "manual"
    ],
    "description": "* `auto` - information being filled automatically \n * `manual` - information being filled manually "
  }
}

} }

Helen
  • 87,344
  • 17
  • 243
  • 314
Chefoy12
  • 11
  • 2

0 Answers0