While working with the sync OpenAPI specification in openfeature/cli, I noticed an inconsistency regarding numeric flag types, specifically missing support for floating-point values.
Current OpenAPI definition
|
FlagDefaultValue: |
|
description: Default value for a flag (can be boolean, string, integer, or object) |
|
oneOf: |
|
- type: boolean |
|
- type: string |
|
- type: integer |
|
- type: object |
|
ManifestFlag: |
|
type: object |
|
required: |
|
- key |
|
- type |
|
- defaultValue |
|
properties: |
|
key: |
|
type: string |
|
description: Unique flag key within the flag set. |
|
example: search-rollout |
|
name: |
|
type: string |
|
description: Human-friendly flag name. Defaults to the key when omitted. |
|
example: Search rollout |
|
type: |
|
type: string |
|
description: Flag data type. |
|
enum: [boolean, string, integer, object] |
Both:
FlagDefaultValue.oneOf
|
oneOf: |
|
- type: boolean |
|
- type: string |
|
- type: integer |
|
- type: object |
ManifestFlag.type.enum
|
enum: [boolean, string, integer, object] |
are missing a floating-point / number representation.
Why this is incorrect per OpenFeature spec
https://openfeature.dev/specification/sections/flag-evaluation/#conditional-requirement-1331
https://openfeature.dev/specification/types/#number
This clearly establishes that floating-point values are a first-class concept in OpenFeature.
Existing manifest schema already supports floats : the current v0 flag manifest JSON Schema already allows float flags: flag-manifest.json#L37
This creates a mismatch where:
- JSON Schema ✅ allows float flags
- Sync OpenAPI spec ❌ does not
Impact
Because floating-point is missing from the OpenAPI spec:
- Code generation for provider servers becomes incorrect or incomplete
Suggested fix
Add number (or float) to:
FlagDefaultValue.oneOf
ManifestFlag.type.enum
I’m happy to provide a PR once the expected direction is agreed upon. 👍
While working with the sync OpenAPI specification in
openfeature/cli, I noticed an inconsistency regarding numeric flag types, specifically missing support for floating-point values.Current OpenAPI definition
cli/api/v0/sync.yaml
Lines 22 to 47 in 144eb0f
Both:
FlagDefaultValue.oneOfcli/api/v0/sync.yaml
Lines 24 to 28 in 144eb0f
ManifestFlag.type.enumcli/api/v0/sync.yaml
Line 47 in 144eb0f
are missing a floating-point / number representation.
Why this is incorrect per OpenFeature spec
https://openfeature.dev/specification/sections/flag-evaluation/#conditional-requirement-1331
https://openfeature.dev/specification/types/#number
This clearly establishes that floating-point values are a first-class concept in OpenFeature.
Existing manifest schema already supports floats : the current v0 flag manifest JSON Schema already allows float flags: flag-manifest.json#L37
This creates a mismatch where:
Impact
Because floating-point is missing from the OpenAPI spec:
Suggested fix
Add number (or float) to:
FlagDefaultValue.oneOfManifestFlag.type.enumI’m happy to provide a PR once the expected direction is agreed upon. 👍