Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify OFREP OpenAPI Definition #7

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
simplify openapi def
Signed-off-by: Michael Beemer <[email protected]>
  • Loading branch information
beeme1mr committed Feb 21, 2024
commit acff95e15e22f0a81dee3cea76d2d1de41125141
178 changes: 55 additions & 123 deletions service/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openapi: 3.0.0
openapi: 3.1.0
info:
version: 0.1.0
title: OpenFeature Remote Evaluation Protocol (OFREP)
Expand All @@ -11,9 +11,11 @@ security:
- ApiKeyAuth: []
- BearerAuth: []
paths:
/ofrep/v1/evaluate/{key}:
/ofrep/v1/flags/{key}:
post:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposal in the comment was to use /ofrep/v1/evaluate/flags.
I've already edited the other branch with the proposal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that too 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How necessary do we think /ofrep/ is?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a discussion about that in the other PR.
We added /ofrep/ to avoid any collision with existing v1 that can exist in other systems

description: OFREP flag evaluation request
description: Evaluate an individual flag
tags:
- evaluate
parameters:
- name: key
in: path
Expand Down Expand Up @@ -59,9 +61,11 @@ paths:
example: '2024-02-07T12:00:00Z'
'500':
description: Internal server error
/ofrep/v1/evaluate:
/ofrep/v1/flags:
post:
description: OFREP bulk evaluation request
description: Bulk evaluate multiple flags
tags:
- evaluate
requestBody:
content:
application/json:
Expand Down Expand Up @@ -95,103 +99,58 @@ paths:
example: '2024-02-07T12:00:00Z'
'500':
description: Internal server error
/ofrep/v1/flag/changes:
post:
description: OFREP polling endpoint to check if the flags have been modified
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/flags'
responses:
'200':
description: OFREP successful flag changes response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/flagChange'
'400':
description: OFREP error response
content:
application/json:
schema:
$ref: '#/components/schemas/flagChangeFailure'
'401':
description: Unauthorized - You need credentials to access the API
'403':
description: Forbidden - You are not authorized to access the API
'429':
description: Rate limit reached on the Flag Management System
headers:
Retry-Later:
description: Indicates when to retry the request
schema:
type: string
format: date-time
example: '2024-02-07T12:00:00Z'
'500':
description: Internal server error
components:
securitySchemes:
BearerAuth:
description: (optional) Bearer Authorization to your flag management system.
description: (optional) Bearer Authorization to your flag management system
type: http
scheme: bearer
ApiKeyAuth:
description: (optional) API Key to your flag management system.
description: (optional) API Key to your flag management system
type: apiKey
in: header
name: X-API-Key
schemas:
bulkEvaluationRequest:
description: Evaluate multiple flags in one request
description: Bulk evaluate multiple flags
properties:
flags:
$ref: '#/components/schemas/flags'
context:
$ref: '#/components/schemas/context'
bulkEvaluationSuccess:
description: Response of the bulk evaluation
type: array
items:
properties:
key:
$ref: '#/components/schemas/key'
value:
type: object
description: Flag evaluation result
reason:
type: string
description: Reason matching OpenFeature reason
variant:
type: string
description: Variant of the evaluated flag value
metadata:
type: object
description: Arbitrary metadata supporting flag evaluation
errorCode:
type: string
description: OpenFeature compatible error code. See https://openfeature.dev/specification/types#error-code
errorDetails:
type: string
description: Optional error details description for logging or other needs
ETag:
$ref: '#/components/schemas/flagChange/properties/ETag'
bulkEvaluationFailure:
description: Bulk evaluation failure response
properties:
errorCode:
type: string
description: Error code specific to the bulk evaluation.
errorDetails:
type: string
description: Optional error details description for logging or other needs
required:
- errorCode
flagChangeFailure:
description: Bulk evaluation failure response
flags:
type: array
items:
beeme1mr marked this conversation as resolved.
Show resolved Hide resolved
properties:
key:
$ref: '#/components/schemas/key'
value:
type: object
description: Flag evaluation result
reason:
type: string
description: Reason matching OpenFeature reason
externalDocs:
url: https://openfeature.dev/specification/types#resolution-details
variant:
type: string
description: Variant of the evaluated flag value
metadata:
type: object
description: Arbitrary metadata supporting flag evaluation
errorCode:
type: string
description: OpenFeature compatible error code.
externalDocs:
url: https://openfeature.dev/specification/types#error-code
errorDetails:
type: string
description: Optional error details description for logging or other needs
required:
- key
bulkEvaluationFailure:
description: Bulk evaluation failure response.
properties:
errorCode:
type: string
Expand All @@ -204,8 +163,6 @@ components:
evaluationRequest:
description: Flag evaluation request
properties:
flagType:
$ref: '#/components/schemas/flagType'
context:
$ref: '#/components/schemas/context'
success:
Expand Down Expand Up @@ -235,8 +192,16 @@ components:
$ref: '#/components/schemas/key'
errorCode:
type: string
enum: [FLAG_NOT_FOUND,PARSE_ERROR,TYPE_MISMATCH,TARGETING_KEY_MISSING,INVALID_CONTEXT,GENERAL]
description: OpenFeature compatible error code. See https://openfeature.dev/specification/types#error-code
enum:
- FLAG_NOT_FOUND
- PARSE_ERROR
- TYPE_MISMATCH
- TARGETING_KEY_MISSING
- INVALID_CONTEXT
- GENERAL
description: OpenFeature compatible error code.
externalDocs:
url: https://openfeature.dev/specification/types#error-code
errorDetails:
type: string
description: Optional error details description for logging or other needs
Expand All @@ -247,39 +212,6 @@ components:
type: string
description: Feature flag key
example: my-flag
flagType:
type: string
enum:
- string
- boolean
- integer
- float
- object
description: Type to evaluate the given flag
flags:
type: array
description: (optional) List of flags to be evaluated, if not set all the flag available will be evaluated against the context.
items:
$ref: '#/components/schemas/key'
example:
- my-flag
- my-other-flag
context:
type: object
description: Context information for flag evaluation
flagChange:
description: Flag changes response.
properties:
key:
$ref: '#/components/schemas/key'
ETag:
type: string
description: identifier for a specific version of a resource. If the flag is modified the ETag should be different. It lets caches be more efficient and save bandwidth,the provider will refresh only the changed flags.
example: S1xXXGYIXzwhdCwKwMYUFRalIlJoJXLqbd0uYcm3sWg=
errorCode:
type: string
enum: [FLAG_NOT_FOUND,PARSE_ERROR,GENERAL]
description: OpenFeature compatible error code. See https://openfeature.dev/specification/types#error-code
errorDetails:
type: string
description: Optional error details description for logging or other needs
description: Context information for flag evaluation
Loading