1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: Revert breaking change for incoming token creation reqs (#2084)

## What

This change reverts the spec change to create-api-token-schema that
was introduced in 97c2b3c089

That commit changed the endpoint from allowing any string to only
allowing strings that match the values of the ApiTokenType value.

## Why

Because we already validate this on the backend, I didn't think it
would break anything. However, because OpenAPI enums are case
sensitive (and do not currently support anything else), it _did_ break
the API. ([stack overflow post that explains how this
works](https://stackoverflow.com/questions/60772786/case-insensitive-string-parameter-in-schema-of-openapi))

## Of note

This should have been caught by the tests, but it didn't show up until
it was merged to the main branch. I think it might be worth looking
into how we do the PR testing.
This commit is contained in:
Thomas Heartman 2022-09-23 16:01:47 +02:00 committed by GitHub
parent 97c2b3c089
commit f131d5a7f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ export const createApiTokenSchema = {
},
type: {
type: 'string',
enum: Object.values(ApiTokenType),
description: `One of ${Object.values(ApiTokenType).join(', ')}`,
},
environment: {
type: 'string',