Skip to content

Commit 596abb6

Browse files
authored
Merge pull request #4 from davejohnston/FFM-676/Remove_Anyof
FFM-676: Remove AnyOf from Evaluations
2 parents 6ae6c76 + 906f225 commit 596abb6

File tree

4 files changed

+397
-141
lines changed

4 files changed

+397
-141
lines changed

api.yaml

Lines changed: 99 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,41 @@ paths:
9292
$ref: '#/components/responses/NotFound'
9393
'500':
9494
$ref: '#/components/responses/InternalServerError'
95+
'/client/env/{environmentUUID}/target-segments/{identifier}':
96+
get:
97+
summary: Retrieve a segment by identifier
98+
description: Used to retrieve a segment for a certain account id by identifier
99+
operationId: GetSegmentByIdentifier
100+
parameters:
101+
- name: identifier
102+
in: path
103+
required: true
104+
description: Unique identifier for the segment object in the API
105+
schema:
106+
type: string
107+
- name: environmentUUID
108+
in: path
109+
required: true
110+
description: Unique identifier for the environment object in the API
111+
schema:
112+
type: string
113+
security:
114+
- BearerAuth: []
115+
responses:
116+
'200':
117+
description: OK
118+
content:
119+
application/json:
120+
schema:
121+
$ref: '#/components/schemas/Segment'
122+
'401':
123+
$ref: '#/components/responses/Unauthenticated'
124+
'403':
125+
$ref: '#/components/responses/Unauthorized'
126+
'404':
127+
$ref: '#/components/responses/NotFound'
128+
'500':
129+
$ref: '#/components/responses/InternalServerError'
95130
/client/auth:
96131
post:
97132
summary: Authenticate with the admin server.
@@ -173,17 +208,16 @@ paths:
173208
application/json:
174209
schema:
175210
$ref: '#/components/schemas/Evaluation'
176-
'/stream/environments/{environmentId}':
211+
/stream:
177212
get:
178213
summary: Stream endpoint.
179214
operationId: Stream
180215
parameters:
181-
- name: environmentId
182-
in: path
183-
required: true
184-
description: Unique UUID for the environemnt object in the API.
216+
- in: header
217+
name: API-Key
185218
schema:
186219
type: string
220+
required: true
187221
security:
188222
- BearerAuth: []
189223
responses:
@@ -309,6 +343,16 @@ components:
309343
required:
310344
- feature
311345
- variations
346+
TargetMap:
347+
type: object
348+
properties:
349+
identifier:
350+
type: string
351+
name:
352+
type: string
353+
required:
354+
- idenfifier
355+
- name
312356
VariationMap:
313357
type: object
314358
properties:
@@ -317,7 +361,7 @@ components:
317361
targets:
318362
type: array
319363
items:
320-
type: string
364+
$ref: '#/components/schemas/TargetMap'
321365
targetSegments:
322366
type: array
323367
items:
@@ -405,11 +449,11 @@ components:
405449
included:
406450
type: array
407451
items:
408-
type: string
452+
$ref: '#/components/schemas/Target'
409453
excluded:
410454
type: array
411455
items:
412-
type: string
456+
$ref: '#/components/schemas/Target'
413457
rules:
414458
type: array
415459
items:
@@ -429,6 +473,39 @@ components:
429473
required:
430474
- identifier
431475
- name
476+
Target:
477+
type: object
478+
properties:
479+
identifier:
480+
type: string
481+
account:
482+
type: string
483+
org:
484+
type: string
485+
environment:
486+
type: string
487+
project:
488+
type: string
489+
name:
490+
type: string
491+
anonymous:
492+
type: boolean
493+
attributes:
494+
type: object
495+
createdAt:
496+
type: integer
497+
format: int64
498+
segments:
499+
type: array
500+
items:
501+
$ref: '#/components/schemas/Segment'
502+
required:
503+
- identifier
504+
- name
505+
- environment
506+
- project
507+
- account
508+
- org
432509
Error:
433510
type: object
434511
properties:
@@ -445,6 +522,19 @@ components:
445522
apiKey:
446523
type: string
447524
example: 896045f3-42ee-4e73-9154-086644768b96
525+
target:
526+
type: object
527+
properties:
528+
identifier:
529+
type: string
530+
name:
531+
type: string
532+
anonymous:
533+
type: boolean
534+
attributes:
535+
type: object
536+
required:
537+
- identifier
448538
required:
449539
- apiKey
450540
AuthenticationResponse:
@@ -482,11 +572,7 @@ components:
482572
flag:
483573
type: string
484574
value:
485-
anyOf:
486-
- type: boolean
487-
- type: string
488-
- type: integer
489-
- type: object
575+
type: string
490576
required:
491577
- flag
492578
- value

rest/adapter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ func (s Segment) Convert() evaluation.Segment {
120120
if s.Excluded != nil {
121121
excluded = make(evaluation.StrSlice, len(*s.Excluded))
122122
for i, excl := range *s.Excluded {
123-
excluded[i] = excl
123+
excluded[i] = excl.Name
124124
}
125125
}
126126

127127
included := make(evaluation.StrSlice, 0)
128128
if s.Included != nil {
129129
included = make(evaluation.StrSlice, len(*s.Included))
130130
for i, incl := range *s.Included {
131-
included[i] = incl
131+
included[i] = incl.Name
132132
}
133133
}
134134

0 commit comments

Comments
 (0)