From 452cb06d307eaf6e0b9887ae4120edefdae5a0b5 Mon Sep 17 00:00:00 2001 From: Casey Waldren Date: Fri, 9 Aug 2024 15:18:57 -0700 Subject: [PATCH] feat: generate feature JSON data products (#132) * feat: generate features/feature info data products --- README.md | 18 +++--- api/sdkmeta/data/feature_info.json | 94 ++++++++++++++++++++++++++++++ api/sdkmeta/data/features.json | 9 +++ products/feature_info.json | 94 ++++++++++++++++++++++++++++++ products/features.json | 9 +++ schemas/feature_info.json | 19 ++++++ schemas/features.json | 10 +++- scripts/ci/check-json-schemas.sh | 2 + scripts/generate-products.sh | 6 ++ 9 files changed, 251 insertions(+), 10 deletions(-) create mode 100644 api/sdkmeta/data/feature_info.json create mode 100644 api/sdkmeta/data/features.json create mode 100644 products/feature_info.json create mode 100644 products/features.json create mode 100644 schemas/feature_info.json diff --git a/README.md b/README.md index 0e8da51..5ddda5f 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,16 @@ The data is intended for consumption by downstream products and services. It also contains a [Go module](./api) exposing the metadata for easier consumption by Go applications. -| Data Product | Description | Format | -|------------------------------------------|-----------------------------------------------------------------|----------| -| [Database](./metadata.sqlite3) | Database containing data from which other products are derived. | sqlite3 | -| [SDK Names](products/names.json) | SDK friendly names for display. | JSON | -| [SDK Releases](products/releases.json) | SDK major/minor releases with EOL dates. | JSON | -| [SDK Types](products/types.json) | SDK types for categorization. | JSON | -| [SDK Languages](products/languages.json) | Programming languages associated with SDKs. | JSON | -| [SDK Repos](products/repos.json) | SDK source repositories | JSON | +| Data Product | Description | Format | +|------------------------------------------------|-----------------------------------------------------------------|---------| +| [Database](./metadata.sqlite3) | Database containing data from which other products are derived. | sqlite3 | +| [SDK Names](products/names.json) | SDK friendly names for display. | JSON | +| [SDK Releases](products/releases.json) | SDK major/minor releases with EOL dates. | JSON | +| [SDK Types](products/types.json) | SDK types for categorization. | JSON | +| [SDK Languages](products/languages.json) | Programming languages associated with SDKs. | JSON | +| [SDK Repos](products/repos.json) | SDK source repositories | JSON | +| [SDK Features](products/features.json) | SDK supported features | JSON | +| [SDK Feature Info](products/feature_info.json) | Descriptions of SDK features | JSON | ## structure diff --git a/api/sdkmeta/data/feature_info.json b/api/sdkmeta/data/feature_info.json new file mode 100644 index 0000000..d63ae9f --- /dev/null +++ b/api/sdkmeta/data/feature_info.json @@ -0,0 +1,94 @@ +{ + "allFlags": { + "description": "Return the flag variations for all feature flags for a given context.", + "name": "Getting all flags" + }, + "appMetadata": { + "description": "Specify application and application version information.", + "name": "Application metadata" + }, + "autoEnvAttrs": { + "description": "Automatically include device and application data in each evaluated context.", + "name": "Automatic environment attributes" + }, + "bigSegments": { + "description": "Configure a persistent store to hold segments that are either synced from external tools, or that contain an arbitrarily large number of contexts of any one context kind.", + "name": "Big segments" + }, + "bootstrapping": { + "description": "Provide an initial set of flag values that are immediately available during client initialization.", + "name": "Bootstrapping" + }, + "contexts": { + "description": "Evaluate flags based on contexts. A context is a generalized way of referring to the people, services, machines, or other resources that encounter feature flags. SDKs without this feature only support flag evaluation for users.", + "name": "Contexts and context kinds" + }, + "experimentation": { + "description": "Connect a flag with one or more metrics to measure end-user behavior for different variations of a flag. Requires minimum SDK versions, but no SDK configuration.", + "name": "Experimentation" + }, + "fileDataSource": { + "description": "Use flag values, specified in JSON or YAML files, for all flag evaluations. Useful for testing or prototyping; do not use in production.", + "name": "Reading flags from a file" + }, + "flagChanges": { + "description": "Use a listener pattern to subscribe to flag change notifications.", + "name": "Subscribing to flag changes" + }, + "hooks": { + "description": "Define callbacks that are executed by the SDK at various points of interest, usually for metrics or tracing.", + "name": "Hooks" + }, + "migrations": { + "description": "Configure how to read and write data for an old and new system, determine which stage of a migration the application is in, execute the correct read and write calls for each stage.", + "name": "Migration flags" + }, + "multiEnv": { + "description": "Evaluate flags from multiple environments using a single client instance", + "name": "Multiple environments" + }, + "offlineMode": { + "description": "Close the SDK's connection to LaunchDarkly. Use cached or fallback values for each flag evaluation.", + "name": "Offline mode" + }, + "otel": { + "description": "Add flag evaluation information to OpenTelemetry spans.", + "name": "OpenTelemetry" + }, + "privateAttrs": { + "description": "Use context attribute values for targeting, but do not send them to LaunchDarkly.", + "name": "Private attributes" + }, + "relayProxyDaemon": { + "description": "Configure the SDK to connect to a persistent store, such as the Relay Proxy's data store.", + "name": "Relay Proxy in daemon mode" + }, + "relayProxyProxy": { + "description": "Configure the SDK to connect to alternate service endpoints, such as the Relay Proxy.", + "name": "Relay Proxy in proxy mode" + }, + "secureMode": { + "description": "For clent-side SDKs, require a hash, signed with the SDK key for the LaunchDarkly environment, to evaluate flag variations. For server-side or edge SDKs, generate a secure mode hash.", + "name": "Secure mode" + }, + "storingData": { + "description": "Configure an external database as a feature store. Persist flag data across application restarts.", + "name": "Storing data" + }, + "testDataSource": { + "description": "Mock data of an SDK. Useful for unit tests; cannot be used in production.", + "name": "Test data sources" + }, + "track": { + "description": "Record actions taken in your application as events. You can connect to these events to metrics for use in experiments.", + "name": "Sending custom events" + }, + "variationDetail": { + "description": "Receive information about how a flag variation was calculated, for example, because it matched a specific targeting rule.", + "name": "Flag evaluation reasons" + }, + "webProxy": { + "description": "Configure the SDK to connect to LaunchDarkly through a web proxy.", + "name": "Web proxy configuration" + } +} diff --git a/api/sdkmeta/data/features.json b/api/sdkmeta/data/features.json new file mode 100644 index 0000000..cbb1588 --- /dev/null +++ b/api/sdkmeta/data/features.json @@ -0,0 +1,9 @@ +{ + "dotnet-server-sdk": { + "hooks": { + "deprecated": null, + "introduced": "8.3", + "removed": null + } + } +} diff --git a/products/feature_info.json b/products/feature_info.json new file mode 100644 index 0000000..d63ae9f --- /dev/null +++ b/products/feature_info.json @@ -0,0 +1,94 @@ +{ + "allFlags": { + "description": "Return the flag variations for all feature flags for a given context.", + "name": "Getting all flags" + }, + "appMetadata": { + "description": "Specify application and application version information.", + "name": "Application metadata" + }, + "autoEnvAttrs": { + "description": "Automatically include device and application data in each evaluated context.", + "name": "Automatic environment attributes" + }, + "bigSegments": { + "description": "Configure a persistent store to hold segments that are either synced from external tools, or that contain an arbitrarily large number of contexts of any one context kind.", + "name": "Big segments" + }, + "bootstrapping": { + "description": "Provide an initial set of flag values that are immediately available during client initialization.", + "name": "Bootstrapping" + }, + "contexts": { + "description": "Evaluate flags based on contexts. A context is a generalized way of referring to the people, services, machines, or other resources that encounter feature flags. SDKs without this feature only support flag evaluation for users.", + "name": "Contexts and context kinds" + }, + "experimentation": { + "description": "Connect a flag with one or more metrics to measure end-user behavior for different variations of a flag. Requires minimum SDK versions, but no SDK configuration.", + "name": "Experimentation" + }, + "fileDataSource": { + "description": "Use flag values, specified in JSON or YAML files, for all flag evaluations. Useful for testing or prototyping; do not use in production.", + "name": "Reading flags from a file" + }, + "flagChanges": { + "description": "Use a listener pattern to subscribe to flag change notifications.", + "name": "Subscribing to flag changes" + }, + "hooks": { + "description": "Define callbacks that are executed by the SDK at various points of interest, usually for metrics or tracing.", + "name": "Hooks" + }, + "migrations": { + "description": "Configure how to read and write data for an old and new system, determine which stage of a migration the application is in, execute the correct read and write calls for each stage.", + "name": "Migration flags" + }, + "multiEnv": { + "description": "Evaluate flags from multiple environments using a single client instance", + "name": "Multiple environments" + }, + "offlineMode": { + "description": "Close the SDK's connection to LaunchDarkly. Use cached or fallback values for each flag evaluation.", + "name": "Offline mode" + }, + "otel": { + "description": "Add flag evaluation information to OpenTelemetry spans.", + "name": "OpenTelemetry" + }, + "privateAttrs": { + "description": "Use context attribute values for targeting, but do not send them to LaunchDarkly.", + "name": "Private attributes" + }, + "relayProxyDaemon": { + "description": "Configure the SDK to connect to a persistent store, such as the Relay Proxy's data store.", + "name": "Relay Proxy in daemon mode" + }, + "relayProxyProxy": { + "description": "Configure the SDK to connect to alternate service endpoints, such as the Relay Proxy.", + "name": "Relay Proxy in proxy mode" + }, + "secureMode": { + "description": "For clent-side SDKs, require a hash, signed with the SDK key for the LaunchDarkly environment, to evaluate flag variations. For server-side or edge SDKs, generate a secure mode hash.", + "name": "Secure mode" + }, + "storingData": { + "description": "Configure an external database as a feature store. Persist flag data across application restarts.", + "name": "Storing data" + }, + "testDataSource": { + "description": "Mock data of an SDK. Useful for unit tests; cannot be used in production.", + "name": "Test data sources" + }, + "track": { + "description": "Record actions taken in your application as events. You can connect to these events to metrics for use in experiments.", + "name": "Sending custom events" + }, + "variationDetail": { + "description": "Receive information about how a flag variation was calculated, for example, because it matched a specific targeting rule.", + "name": "Flag evaluation reasons" + }, + "webProxy": { + "description": "Configure the SDK to connect to LaunchDarkly through a web proxy.", + "name": "Web proxy configuration" + } +} diff --git a/products/features.json b/products/features.json new file mode 100644 index 0000000..cbb1588 --- /dev/null +++ b/products/features.json @@ -0,0 +1,9 @@ +{ + "dotnet-server-sdk": { + "hooks": { + "deprecated": null, + "introduced": "8.3", + "removed": null + } + } +} diff --git a/schemas/feature_info.json b/schemas/feature_info.json new file mode 100644 index 0000000..a762a68 --- /dev/null +++ b/schemas/feature_info.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://launchdarkly.com/sdk-meta/feature_info.json", + "title": "SDK Feature Info", + "description": "Description of SDK features", + "type": "object", + "$defs": { + "SDKFeature" : { + "type": "object", + "description": "Description of an individual feature", + "required" : ["name", "description"] + } + }, + "patternProperties" : { + "^[a-z-]+$" : { + "$ref" : "#/$defs/SDKFeature" + } + } +} diff --git a/schemas/features.json b/schemas/features.json index 355cdd3..5688266 100644 --- a/schemas/features.json +++ b/schemas/features.json @@ -25,11 +25,17 @@ }, "deprecated": { "description": "The version that the feature was deprecated", - "$ref": "#/$defs/SDKVersion" + "anyOf": [ + { "$ref": "#/$defs/SDKVersion" }, + { "type": "null" } + ] }, "removed": { "description": "The version that the feature was removed", - "$ref": "#/$defs/SDKVersion" + "anyOf": [ + { "$ref": "#/$defs/SDKVersion" }, + { "type": "null" } + ] } } }, diff --git a/scripts/ci/check-json-schemas.sh b/scripts/ci/check-json-schemas.sh index ed0c183..3be76c1 100755 --- a/scripts/ci/check-json-schemas.sh +++ b/scripts/ci/check-json-schemas.sh @@ -25,3 +25,5 @@ runTest ./schemas/names.json ./products/names.json runTest ./schemas/languages.json ./products/languages.json runTest ./schemas/repos.json ./products/repos.json runTest ./schemas/releases.json ./products/releases.json +runTest ./schemas/features.json ./products/features.json +runTest ./schemas/feature_info.json ./products/feature_info.json diff --git a/scripts/generate-products.sh b/scripts/generate-products.sh index 6412a7e..9c8b24b 100755 --- a/scripts/generate-products.sh +++ b/scripts/generate-products.sh @@ -22,6 +22,12 @@ sqlite3 -json metadata.sqlite3 "SELECT * from sdk_types;" | sqlite3 -json metadata.sqlite3 "SELECT * from sdk_repos;" | jq -S 'reduce .[] as $item ({}; .[$item.id] += {github: $item.github})' > products/repos.json +sqlite3 -json metadata.sqlite3 "SELECT * from sdk_features;" | + jq -S 'reduce .[] as $item ({}; .[$item.id] += {($item.feature): {introduced: $item.introduced, deprecated: $item.deprecated, removed: $item.removed}})' > products/features.json + +sqlite3 -json metadata.sqlite3 "SELECT * from sdk_feature_info;" | + jq -S 'reduce .[] as $item ({}; .[$item.id] += {name: $item.name, description: $item.description})' > products/feature_info.json + ./scripts/eols.sh metadata.sqlite3 | jq -n 'reduce inputs[] as $input ({}; .[$input.id] += [$input | del(.id)])' > products/releases.json