Skip to content

Commit

Permalink
feat: Add type, is_enabled to expenses custom fields key (#386)
Browse files Browse the repository at this point in the history
* testing

* Auto generate API docs

* typo

* Auto generate API docs

* typo

* Auto generate API docs

---------

Co-authored-by: Siva <siva@fylehq.com>
  • Loading branch information
Code0987 and snarayanank2 authored Nov 6, 2023
1 parent da456f4 commit 39e4d1e
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 25 deletions.
54 changes: 53 additions & 1 deletion reference/admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2678,6 +2678,58 @@ components:
null_field:
type: string
nullable: true
expense_custom_field:
type: object
description: |
Expense custom field
properties:
name:
type: string
example: cf1
value:
nullable: true
oneOf:
- type: string
example: string1
- type: boolean
example: true
- type: integer
example: 123
- $ref: '#/components/schemas/location'
- type: array
items:
type: string
example:
- v1
- v2
type:
type: string
nullable: true
enum:
- TEXT
- NUMBER
- SELECT
- BOOLEAN
- MULTI_SELECT
- LOCATION
- USER_LIST
- DATE
- DEPENDENT_SELECT
- null
description: |
This field specifies the type of the expense field.
example: SELECT
is_enabled:
anyOf:
- $ref: '#/components/schemas/null_field'
- $ref: '#/components/schemas/is_enabled'
nullable: true
expense_custom_fields:
type: array
description: |
Expense custom fields
items:
$ref: '#/components/schemas/expense_custom_field'
amount:
type: number
description: |
Expand Down Expand Up @@ -3481,7 +3533,7 @@ components:
items:
$ref: '#/components/schemas/location'
custom_fields:
$ref: '#/components/schemas/custom_fields'
$ref: '#/components/schemas/expense_custom_fields'
custom_fields_flattened:
$ref: '#/components/schemas/flattened_custom_field'
code:
Expand Down
80 changes: 66 additions & 14 deletions reference/approver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -676,10 +676,19 @@ components:
type: number
nullable: true
example: 77.594566
custom_field:
null_field:
type: string
nullable: true
is_enabled:
type: boolean
description: |
This indicates if the resource is enabled for use within the organisation.
default: true
example: true
expense_custom_field:
type: object
description: |
Custom field
Expense custom field
properties:
name:
type: string
Expand All @@ -700,12 +709,34 @@ components:
example:
- v1
- v2
custom_fields:
type:
type: string
nullable: true
enum:
- TEXT
- NUMBER
- SELECT
- BOOLEAN
- MULTI_SELECT
- LOCATION
- USER_LIST
- DATE
- DEPENDENT_SELECT
- null
description: |
This field specifies the type of the expense field.
example: SELECT
is_enabled:
anyOf:
- $ref: '#/components/schemas/null_field'
- $ref: '#/components/schemas/is_enabled'
nullable: true
expense_custom_fields:
type: array
description: |
Custom fields
Expense custom fields
items:
$ref: '#/components/schemas/custom_field'
$ref: '#/components/schemas/expense_custom_field'
flattened_custom_field:
type: object
description: |
Expand Down Expand Up @@ -736,9 +767,6 @@ components:
example:
cf1: string1
custom_field_2: Value 2
null_field:
type: string
nullable: true
report_out_embed:
type: object
nullable: true
Expand Down Expand Up @@ -906,12 +934,36 @@ components:
- id
- name
- band
is_enabled:
type: boolean
custom_field:
type: object
description: |
This indicates if the resource is enabled for use within the organisation.
default: true
example: true
Custom field
properties:
name:
type: string
example: cf1
value:
nullable: true
oneOf:
- type: string
example: string1
- type: boolean
example: true
- type: integer
example: 123
- $ref: '#/components/schemas/location'
- type: array
items:
type: string
example:
- v1
- v2
custom_fields:
type: array
description: |
Custom fields
items:
$ref: '#/components/schemas/custom_field'
employee_out_embed_for_expense:
type: object
additionalProperties: false
Expand Down Expand Up @@ -1555,7 +1607,7 @@ components:
items:
$ref: '#/components/schemas/location'
custom_fields:
$ref: '#/components/schemas/custom_fields'
$ref: '#/components/schemas/expense_custom_fields'
custom_fields_flattened:
$ref: '#/components/schemas/flattened_custom_field'
code:
Expand Down
70 changes: 61 additions & 9 deletions reference/spender.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,13 @@ components:
type: number
nullable: true
example: 77.594566
custom_field:
null_field:
type: string
nullable: true
expense_custom_field:
type: object
description: |
Custom field
Expense custom field
properties:
name:
type: string
Expand All @@ -793,12 +796,34 @@ components:
example:
- v1
- v2
custom_fields:
type:
type: string
nullable: true
enum:
- TEXT
- NUMBER
- SELECT
- BOOLEAN
- MULTI_SELECT
- LOCATION
- USER_LIST
- DATE
- DEPENDENT_SELECT
- null
description: |
This field specifies the type of the expense field.
example: SELECT
is_enabled:
anyOf:
- $ref: '#/components/schemas/null_field'
- $ref: '#/components/schemas/is_enabled'
nullable: true
expense_custom_fields:
type: array
description: |
Custom fields
Expense custom fields
items:
$ref: '#/components/schemas/custom_field'
$ref: '#/components/schemas/expense_custom_field'
flattened_custom_field:
type: object
description: |
Expand Down Expand Up @@ -829,9 +854,6 @@ components:
example:
cf1: string1
custom_field_2: Value 2
null_field:
type: string
nullable: true
amount:
type: number
description: |
Expand Down Expand Up @@ -1056,6 +1078,36 @@ components:
- id
- name
- band
custom_field:
type: object
description: |
Custom field
properties:
name:
type: string
example: cf1
value:
nullable: true
oneOf:
- type: string
example: string1
- type: boolean
example: true
- type: integer
example: 123
- $ref: '#/components/schemas/location'
- type: array
items:
type: string
example:
- v1
- v2
custom_fields:
type: array
description: |
Custom fields
items:
$ref: '#/components/schemas/custom_field'
employee_out_embed_for_expense:
type: object
additionalProperties: false
Expand Down Expand Up @@ -1699,7 +1751,7 @@ components:
items:
$ref: '#/components/schemas/location'
custom_fields:
$ref: '#/components/schemas/custom_fields'
$ref: '#/components/schemas/expense_custom_fields'
custom_fields_flattened:
$ref: '#/components/schemas/flattened_custom_field'
code:
Expand Down
2 changes: 1 addition & 1 deletion src/components/schemas/expense.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ expense_out:
items:
$ref: './fields.yaml#/location'
custom_fields:
$ref: './fields.yaml#/custom_fields'
$ref: './fields.yaml#/expense_custom_fields'
custom_fields_flattened:
$ref: './fields.yaml#/flattened_custom_field'
code:
Expand Down
53 changes: 53 additions & 0 deletions src/components/schemas/fields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,59 @@ custom_fields:
items:
$ref: '#/custom_field'

expense_custom_field:
type: object
description: |
Expense custom field
properties:
name:
type: string
example: cf1
value:
nullable: true
oneOf:
- type: string
example: string1
- type: boolean
example: True
- type: integer
example: 123
- $ref: '#/location'
- type: array
items:
type: string
example: [ 'v1', 'v2' ]
type:
type: string
nullable: true
enum:
- TEXT
- NUMBER
- SELECT
- BOOLEAN
- MULTI_SELECT
- LOCATION
- USER_LIST
- DATE
- DEPENDENT_SELECT
- null
description: |
This field specifies the type of the expense field.
example: SELECT
is_enabled:
anyOf:
- $ref: '#/null_field'
- $ref: '#/is_enabled'
nullable: true

expense_custom_fields:
type: array
description: |
Expense custom fields
items:
$ref: '#/expense_custom_field'


flattened_custom_field:
type: object
description: |
Expand Down

0 comments on commit 39e4d1e

Please sign in to comment.