1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-24 01:18:01 +02:00

fix: correct oas for creating feature toggle

This commit is contained in:
Ivar Conradi Østhus 2022-02-24 08:24:47 +01:00
parent f097822084
commit bec32f726b
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09

View File

@ -39,13 +39,17 @@ tags:
info: info:
title: Unleash API title: Unleash API
description: |- description: |-
> The Open API specifications are currently considered a **"beta feature"** and will not cover the full Unleash Admin API.
> You can follow the progress on making OAS official in [GitHub issue 1391](https://github.com/Unleash/unleash/issues/1391)
Unleash is an open source feature flag and toggle system for all your applications and services. Unleash is an open source feature flag and toggle system for all your applications and services.
# Try it out # Try it out
## Try it in your browser ## Try it in your browser
Once you have [set your Unleash server up](https://unleash.github.io/docs/getting_started), you can test the API from inside your browser. The following assumes the server is running on localhost:4242. Once you have [set your Unleash server up](https://docs.getunleash.io/deploy/getting_started), you can test the API from inside your browser. The following assumes the server is running on localhost:4242.
The following 'endpoints' (such as `GET /admin/metrics/applications`) provide reference documentation for the Unleash REST API. To try out API calls: The following 'endpoints' (such as `GET /admin/metrics/applications`) provide reference documentation for the Unleash REST API. To try out API calls:
1. Navigate to an endpoint 1. Navigate to an endpoint
@ -63,7 +67,7 @@ info:
version: 4.0.13 version: 4.0.13
contact: contact:
name: The Unleash team name: The Unleash team
url: 'https://unleash.github.io/' url: 'https://docs.getunleash.io'
externalDocs: externalDocs:
description: Unleash documentation description: Unleash documentation
url: 'https://unleash.github.io/docs/getting_started' url: 'https://unleash.github.io/docs/getting_started'
@ -223,7 +227,7 @@ paths:
source: | source: |
curl --request POST \ curl --request POST \
--url http://localhost:4242/api/admin/features \ --url http://localhost:4242/api/admin/features \
--data '[{"name":"featureX","description":"Toggles featureX on and off","type":"release","enabled":true,"stale":false,"strategies":[{"name":"default","editable":true,"description":"Default on/off strategy.","parameters":{"parameter":{"name":"groupId","type":"string","description":"Define activation groups to allow you to correlate across feature toggles.","required":false}}}],"variants":[{"name":"yellow","weight":20}],"createdAt":"string"}]' --data '{"name":"featureX","description":"Toggles featureX on and off","type":"release","enabled":true,"stale":false,"strategies":[{"name":"default","editable":true,"description":"Default on/off strategy.","parameters":{"parameter":{"name":"groupId","type":"string","description":"Define activation groups to allow you to correlate across feature toggles.","required":false}}}],"variants":[{"name":"yellow","weight":20}],"createdAt":"string"}'
'/admin/features/{featureName}': '/admin/features/{featureName}':
get: get:
summary: Fetches a specific Feature Toggle from the Unleash server. summary: Fetches a specific Feature Toggle from the Unleash server.
@ -917,7 +921,7 @@ components:
version: version:
$ref: '#/components/schemas/versionSchema' $ref: '#/components/schemas/versionSchema'
features: features:
$ref: '#/components/schemas/featureToggleSchema' $ref: '#/components/schemas/featureToggleListSchema'
x-tags: x-tags:
- Responses - Responses
'401': '401':
@ -1276,7 +1280,7 @@ components:
minLength: 1 minLength: 1
example: '2020-11-13T16:56:29.279Z' example: '2020-11-13T16:56:29.279Z'
seenToggles: seenToggles:
$ref: '#/components/schemas/featureToggleSchema' $ref: '#/components/schemas/featureToggleListSchema'
links: links:
type: object type: object
properties: properties:
@ -1312,46 +1316,48 @@ components:
example: 1 example: 1
x-tags: x-tags:
- Schemas - Schemas
featureToggleSchema: featureToggleListSchema:
type: array type: array
items: items:
type: object type: array
required: featureToggleSchema:
- name type: object
- description required:
- type - name
- enabled - description
- stale - type
- strategies - enabled
properties: - stale
name: - strategies
description: Feature Toggle name must be unique. properties:
type: string name:
minLength: 1 description: Feature Toggle name must be unique.
example: featureX type: string
description: minLength: 1
type: string example: featureX
minLength: 1 description:
example: Toggles featureX on and off type: string
type: minLength: 1
$ref: '#/components/schemas/featureToggleTypeSchema' example: Toggles featureX on and off
enabled: type:
description: Is the Feature Toggle enabled? $ref: '#/components/schemas/featureToggleTypeSchema'
type: boolean enabled:
example: true description: Is the Feature Toggle enabled?
stale: type: boolean
description: Is the Feature Toggle 'stale' (deprecated)? example: true
type: boolean stale:
example: false description: Is the Feature Toggle 'stale' (deprecated)?
strategies: type: boolean
$ref: '#/components/schemas/strategySchema' example: false
variants: strategies:
$ref: '#/components/schemas/variantsSchema' $ref: '#/components/schemas/strategySchema'
createdAt: variants:
type: string $ref: '#/components/schemas/variantsSchema'
minLength: 1 createdAt:
x-tags: type: string
- Schemas minLength: 1
x-tags:
- Schemas
strategySchema: strategySchema:
type: array type: array
items: items:
@ -1607,7 +1613,7 @@ components:
version: version:
$ref: '#/components/schemas/versionSchema' $ref: '#/components/schemas/versionSchema'
features: features:
$ref: '#/components/schemas/featureToggleSchema' $ref: '#/components/schemas/featureToggleListSchema'
strategies: strategies:
$ref: '#/components/schemas/strategySchema' $ref: '#/components/schemas/strategySchema'
x-tags: x-tags: