1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
Commit Graph

237 Commits

Author SHA1 Message Date
Thomas Heartman
1481c13b61
openapi: enable strict schema validation by default and fix (#4355)
Enable strict schema validation by default. It can still be overridden
by explicitly setting it to false.

I've also fixed the validation errors that appeared when turning it on.
I've opted for the simplest route and changed the schemas to comply with
the tests.
2023-07-31 11:04:13 +02:00
Thomas Heartman
4ab8accf5c
OpenAPI: remaining schema updates (#4354)
This fixes the last few exceptions to our meta schema validation
2023-07-28 07:25:34 +00:00
Thomas Heartman
df59b10fb6
OpenAPI: more schema cleanup (#4353)
This PR fixes additional schemas that hadn't been described properly
2023-07-28 06:59:05 +00:00
Thomas Heartman
12209ae21c
OpenAPI: clean up remaining schemas, part 1 (#4351)
Part of linear task 1-1167. Fixes the first slew of schemas missing
descriptions/examples, etc.
2023-07-28 08:45:56 +02:00
Mateusz Kwasniewski
88b935fdba
fix: global role is called root role (#4336) 2023-07-24 15:27:07 +02:00
Mateusz Kwasniewski
5de4958b0f
fix: group cleanup (#4334) 2023-07-24 11:05:55 +02:00
Mateusz Kwasniewski
f1d1d7d49a
feat: strategy variants in playground (#4281) 2023-07-21 08:15:15 +02:00
Thomas Heartman
5dd78f3c15
openapi: remove all the extra data info (#4277) 2023-07-19 17:20:17 +02:00
Thomas Heartman
87cec6c9b7
openapi: update ui-config endpoints (#4280) 2023-07-19 17:18:47 +02:00
Mateusz Kwasniewski
276261c913
feat: Group schema updates (#4258) 2023-07-18 11:08:45 +02:00
Thomas Heartman
34aeca2418
#4205: add openapi definition for the new endpoint (#4256)
This PR adds an operation and accompanying openapi docs for the new
"update feature type lifetime" API operation.

It also fixes an oversight where the other endpoint on the same
controller didn't use `respondWithValidation`.

Note: the API here is a suggestion. I'd like to hear whether you agree
with this implementation or not.
2023-07-18 09:00:51 +00:00
andreas-unleash
1f21770977
Feat/feature environment strategy execution reorder (#4248)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
When reordering strategies for a feature environment:
- Adds stop when CR are enabled
- Emits an event 

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-07-17 17:12:59 +03:00
Tymoteusz Czech
f91c8a338a
fix: feature OpenAPI endpoints - project related (#4212)
Update OpenAPI for `/api/admin/projects/{projectId}/features/` and
related endpoints

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-07-14 16:48:35 +02:00
Mateusz Kwasniewski
e8ea79c967
feat: client api with proper client segments and strategy variants (#4244) 2023-07-14 13:25:31 +02:00
andreas-unleash
5e45ec25e9
Revert "Feat/add strategy update event on strategy ordering (#4234)" (#4243)
This reverts commit 16e3799b9a.


<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2023-07-14 09:11:32 +00:00
Nuno Góis
383e522127
feat: Slack App addon (#4238)
https://linear.app/unleash/issue/2-1232/implement-first-iteration-of-the-new-slack-app-addon

This PR implements the first iteration of the new Slack App addon.
Unlike the old Slack addon, this one uses a Slack App (bot) that is
installed to Slack workspaces in order to post messages. This uses
`@slack/web-api`, which internally uses the latest Slack API endpoints
like `postMessage`.

This is currently behind a flag: `slackAppAddon`.

The current flow is that the Unleash Slack App is installed from
whatever source:
 - Unleash addons page;
 - Direct link;
 - https://unleash-slack-app.vercel.app/ (temporary URL);
 - Slack App Directory (in the future);
 - Etc;

After installed, we resolve the authorization to an `access_token` that
the user can paste into the Unleash Slack App addon configuration form.


https://github.com/Unleash/unleash/assets/14320932/6a6621b9-5b8a-4921-a279-30668be6d46c

Co-authored by: @daveleek

---------

Co-authored-by: David Leek <david@getunleash.io>
2023-07-14 09:49:34 +01:00
andreas-unleash
16e3799b9a
Feat/add strategy update event on strategy ordering (#4234)
Adds a `feature-strategy-update-event` when the strategy sort-order is
changed.

Makes all fields in the eventDataSchema nullable

Closes #
[1-11120](https://linear.app/unleash/issue/1-1112/we-should-have-event-for-re-ordering-strategies)

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-07-14 04:46:13 +03:00
Mateusz Kwasniewski
ce87806a80
feat: strategy variant schema openapi (#4232) 2023-07-13 13:50:03 +02:00
Thomas Heartman
8f5bda6b8a
openapi: document operations for admin ui feedback (#4226)
This PR updates the endpoint documentation and schemas related to Admin
UI feedback.
2023-07-13 13:27:52 +02:00
Jaanus Sellin
3da1cbba47
feat: feature creation limit crud together with frontend (#4221) 2023-07-13 14:02:35 +03:00
Thomas Heartman
a785465943
openapi: update the splash endpoints and schemas for splash (#4227)
This change updates the splash endpoints and related schemas for the
admin ui tag.
2023-07-13 08:29:54 +00:00
Thomas Heartman
b927615ebe
openapi: update misc 'features'-tagged endpoints (#4192)
This PR updates a slew of miscellaneous endpoints tagged `Features`
2023-07-11 14:17:10 +02:00
Mateusz Kwasniewski
81c005013e
fix: min items was breaking import (#4219) 2023-07-11 12:42:33 +02:00
Gastón Fournier
58151d8d80
docs: add descriptions and examples to tag schemas (#4194)
## About the changes
- Adding descriptions and examples to tag and tag types schemas
- Adding standard errors, summaries, and descriptions to tag and tag
types endpoints
- Some improvements on compilation errors

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-07-11 10:02:00 +02:00
Christopher Kolstad
4ce78ccecd
docs: add description to requests per seconds schemas (#4182)
### What
Adds a quick and dirty description to requestPerSeconds and
segmentedRequestPerSecondsSchema so the enterprise /rps endpoint has
better API docs.

---------

Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
2023-07-10 08:18:08 +00:00
Tymoteusz Czech
ace499d7c6
Update OpenAPI feature strategies (#4175)
## About the changes
Updates for endpoint
`/api/admin/projects/{projectId}/features/{featureName}/environments/{environment}/strategies`
and similar
2023-07-07 15:45:04 +00:00
Tymoteusz Czech
1b99b700d6
OpenAPI - feature environment endpoints (#4166)
## About the changes
Fix OpenAPI definitions for endpoint

`/api/admin/projects/{projectId}/features/{featureName}/environments/{environment}`
and similar.
2023-07-07 14:31:03 +02:00
Thomas Heartman
a51b47e956
openapi: update tag description (#4178)
Tiny PR to update the admin UI tag description, including a disclaimer
that it may change at any time.
2023-07-07 11:14:19 +00:00
Mateusz Kwasniewski
23981407ef
fix: validate min constraint values in openapi (#4179) 2023-07-07 12:41:48 +02:00
Mateusz Kwasniewski
d7b7d93533
feat: user openapi spec (#4162) 2023-07-06 15:27:43 +02:00
Thomas Heartman
46b4030d47
bug: mark descriptions on strategies as nullable (#4156)
This was omitted by mistake.

Fixes 1-1086
2023-07-06 13:39:23 +02:00
Christopher Kolstad
b04545c25f
docs: Events tag (#4152)
### What
This PR adds documentation for our endpoints that are covered by our
"Events" tag. It also adds a type for all valid events, and then uses
this as valid values for type argument.
2023-07-06 08:57:09 +00:00
Thomas Heartman
6d591fcd17
openapi: update API tokens tag (#4137)
This PR updates endpoints and schemas for the API tokens tag.

As part of that, they also handle oneOf openapi validation errors and improve the console output for the enforcer tests.
2023-07-06 07:30:31 +00:00
Mateusz Kwasniewski
79b34121a4
feat: openapi schema for user admin (#4146) 2023-07-06 08:24:46 +02:00
Tymoteusz Czech
de8e9a03ae
Inline endpoint descriptions (#4145)
Update OpenApi docs
2023-07-05 11:25:58 +02:00
andreas-unleash
64c1527213
chore: document endpoint tagged Unstable (#4118)
Adds description and summary to all endpoints with Unstable tag
2023-07-04 14:41:16 +00:00
Thomas Heartman
f799f72697
openapi: strategies tag (#4116)
Update OpenAPI schemas and operation descriptions for the strategies
tag.
2023-07-04 14:21:09 +02:00
Christopher Kolstad
0b18491237
docs: Auth tag (#4126)
## What
This adds openapi documentation for the Auth tagged operations and
connected schemas.

## Discussion points
Our user schema seems to be exposing quite a bit of internal fields, I
flagged the isApi field as deprecated, I can imagine quite a few of
these fields also being deprecated to prepare for removal in next major
version, but I was unsure which ones were safe to do so with.

## Observation
We have some technical debt around the shape of the schema we're
claiming we're returning and what we actually are returning. I believe
@gastonfournier also observed this when we turned on validation for our
endpoints.

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-07-04 08:31:54 +00:00
Mateusz Kwasniewski
b50b06c257
feat: Frontend api openapi spec (#4133) 2023-07-03 15:48:09 +02:00
David Leek
3a14b97fdd
feat/telemetry opt out (#4035)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

Adds a UI that shows current status of version and feature usage
collection configuration, and a presence in the configuration menu +
menu bar.

Configuring these features is done by setting environment variables. The
version info collection is an existing feature that we're making more
visible, the feature usage collection feature is a new feature that has
it's own environment configuration but also depends on version info
collection being active to work.

When version collection is turned off and the experimental feature flag
for feature usage collection is turned off:
<img width="1269" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/435a07da-d238-4b5b-a150-07e3bd6b816f">


When version collection is turned on and the experimental feature flag
is off:
<img width="1249" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/8d1a76c5-99c9-4551-9a4f-86d477bbbf6f">


When the experimental feature flag is enabled, and version+telemetry is
turned off:
<img width="1239" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/e0bc532b-be94-4076-bee1-faef9bc48a5b">


When version collection is turned on, the experimental feature flag is
enabled, and telemetry collection is turned off:
<img width="1234" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/1bd190c1-08fe-4402-bde3-56f863a33289">


When version collection is turned on, the experimental feature flag is
enabled, and telemetry collection is turned on:
<img width="1229" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/848912cd-30bd-43cf-9b81-c58a4cbad1e4">


When version collection is turned off, the experimental feature flag is
enabled, and telemetry collection is turned on:
<img width="1241" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/d2b981f2-033f-4fae-a115-f93e0653729b">

---------

Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-06-30 08:43:58 +02:00
Christopher Kolstad
b99eafc9cc
docs: Context api tag (#4117)
### What
Added documentation for context fields and endpoints tagged with the
"Context" tag.

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-06-29 14:04:48 +02:00
Thomas Heartman
3fb00b281c
fix: disallow empty list of envs and invalid env names in advanced playground (#4060)
This PR changes the OpenAPI schema for the advanced playground to not
accept empty lists of environments and to not accept environment names
that don't match the env name pattern we use.

The pattern is the same as the one we use for controlling environment
names on creation.

However, there is a (small) chance that these may get out of sync later,
so we could do something to only define this pattern once (and import it
in the enterprise package), but that may be more work than is necessary,
and I'd suggest we do that later.

I've also added a minLength to the string items although it isn't
strictly necessary. It's primarily to give the users better feedback if
the name is empty.
2023-06-22 09:01:10 +00:00
Thomas Heartman
24e9cf7c8f
feat: add "edit" link to playground strategies (#4027)
This change adds an "edit" link to all playground strategies when they
are returned from the API, allowing the user to jump directly to the
evaluated strategy edit screen.

This change applies to both old and new strategies, so it should even
work in the old playground.

This does not use this information in the frontend yet.

## Discussion points:

Should "links" be an object or a singular string? I know the
notifications service uses just "link", but using an object will make
it easier to potentially add more actions in the future (such as
"enable"/"disable", maybe?)

Do we need to supply basePath? I noticed that the notifications links
only ever use an empty string for base path, so it might not be
necessary and can potentially be left out.

## Changes

I've implemented the link building in a new view model file. Inspecting
the output after the result is fully ready requires some gnarly
introspection and mapping, but it's tested.

Further, I've done a little bit of work to stop the playground service
using the schema types directly as the schema types now contain extra
information.

This PR also updates the `urlFriendlyString` arbitrary to not produce
strings that contain only periods. This causes issues when parsing URLs
(and is also something we struggle with in the UI).
2023-06-22 07:19:35 +00:00
Thomas Heartman
2be143a64e
docs: mark 'yes' and no as required, add more details to variants (#3984)
This change adds a little more detail to the client metrics schema. The
description for variants felt a
little unclear.

---------

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2023-06-15 07:14:17 +00:00
Christopher Kolstad
b8da1ce2a9
docs: OpenAPI Client tag (#3979)
### What
Adds documentation for open api endpoints tagged with `Client`.

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-06-14 12:19:00 +00:00
Mateusz Kwasniewski
6ae4fe2085
test: meta schema rules should not check description on ref (#3980) 2023-06-14 12:29:09 +02:00
Mateusz Kwasniewski
8bddbd80f6
feat: advanced playground openapi (#3972) 2023-06-14 11:05:08 +02:00
Christopher Kolstad
5f3e5729b9
docs: Instance admin (#3961)
### What
Adds the documentation for the instance admin endpoints.

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-06-13 12:10:21 +00:00
Christopher Kolstad
7003351b35
docs: Health check endpoint (#3959)
### What
Adds documentation for the health check endpoint.

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-06-12 12:56:45 +00:00
Gastón Fournier
4e0678dfb1
fix: allow empty appName as it may come in the url (#3953)
## About the changes
Edit application under
https://app.unleash-hosted.com/demo/applications/test-app is currently
not working as the appName is expected to come in the request body, but
it's actually part of the url. We have two options here:
1. We change the UI to adapt to the expectations of the request by
adding appName to the request body (and eventually removing appName from
the URL, which would be a breaking change)
2. We remove the restriction of only sending the appName in the body and
take the one that comes in the URL. We have a validation that verifies
that at least one of the two sets the appName
([here](e376088668/src/lib/services/client-metrics/instance-service.ts (L208))
we validate using [this
schema](e376088668/src/lib/services/client-metrics/schema.ts (L55-L70)))

In terms of REST API, we can assume that the appName will be present in
the resource `/api/admin/metrics/applications` (an endpoint we don't
have), but when we're updating an application we should refer to that
application by its URL: `/api/admin/metrics/applications/<appName>` and
the presence of an appName in the body might indicate that we're trying
to change the name of the application (something we currently not
support)

Based on the above, I believe going with the second option is best, as
it adheres to REST principles and does not require a breaking change.
Despite that, we only support updating applications as the creation is
done from metrics ingestion

Fixes: #3580
2023-06-12 10:15:00 +02:00