Skip to content

Commit 0718fce

Browse files
patrick thorntonpatrick thornton
authored andcommitted
operator/value combined to filter
discriminated union using oneOf adds strict typechecks for single filter queries
1 parent a4e232b commit 0718fce

File tree

1 file changed

+89
-8
lines changed

1 file changed

+89
-8
lines changed

fern/openapi-overrides.yml

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -787,21 +787,76 @@ components:
787787
intercom_version:
788788
x-fern-ignore: true
789789
single_filter_search_request:
790+
properties:
791+
operator: null
792+
value: null
793+
filter:
794+
description: Filter with operator determining the valid value type
795+
type: object
796+
oneOf:
797+
- "$ref": '#/components/schemas/equality_filter'
798+
- "$ref": '#/components/schemas/collection_filter'
799+
- "$ref": '#/components/schemas/string_filter'
800+
- "$ref": '#/components/schemas/comparison_filter'
801+
802+
# equality operators (=, !=) can work with strings or integers
803+
equality_filter:
804+
type: object
790805
properties:
791806
operator:
807+
type: string
808+
enum:
809+
- "="
810+
- "!="
792811
x-fern-enum:
793812
"=":
794813
name: Equals
795814
"!=":
796815
name: NotEquals
816+
value:
817+
oneOf:
818+
- type: string
819+
- type: integer
820+
required:
821+
- operator
822+
- value
823+
824+
# collection operators (IN, NIN) require arrays
825+
collection_filter:
826+
type: object
827+
properties:
828+
operator:
829+
type: string
830+
enum:
831+
- IN
832+
- NIN
833+
x-fern-enum:
797834
IN:
798835
name: In
799836
NIN:
800837
name: NotIn
801-
"<":
802-
name: LessThan
803-
">":
804-
name: GreaterThan
838+
value:
839+
type: array
840+
items:
841+
oneOf:
842+
- type: string
843+
- type: integer
844+
required:
845+
- operator
846+
- value
847+
848+
# string matching operators (~, !~, ^, $) require string values
849+
string_filter:
850+
type: object
851+
properties:
852+
operator:
853+
type: string
854+
enum:
855+
- "~"
856+
- "!~"
857+
- "^"
858+
- "$"
859+
x-fern-enum:
805860
"~":
806861
name: Contains
807862
"!~":
@@ -810,6 +865,34 @@ components:
810865
name: StartsWith
811866
"$":
812867
name: EndsWith
868+
value:
869+
type: string
870+
required:
871+
- operator
872+
- value
873+
874+
# comparison operators (<, >) work with integers or strings (dates)
875+
comparison_filter:
876+
type: object
877+
properties:
878+
operator:
879+
type: string
880+
enum:
881+
- "<"
882+
- ">"
883+
x-fern-enum:
884+
"<":
885+
name: LessThan
886+
">":
887+
name: GreaterThan
888+
value:
889+
oneOf:
890+
- type: string
891+
- type: integer
892+
required:
893+
- operator
894+
- value
895+
813896
create_contact_request:
814897
properties: null
815898
anyOf:
@@ -1436,6 +1519,8 @@ components:
14361519
- section
14371520
visitor:
14381521
properties:
1522+
custom_attributes:
1523+
additionalProperties: true
14391524
type:
14401525
enum:
14411526
- visitor
@@ -1466,10 +1551,6 @@ components:
14661551
properties:
14671552
custom_attributes:
14681553
additionalProperties: true
1469-
visitor:
1470-
properties:
1471-
custom_attributes:
1472-
additionalProperties: true
14731554

14741555
securitySchemes:
14751556
bearerAuth:

0 commit comments

Comments
 (0)