Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openapi: update API tokens tag #4137

Merged
merged 21 commits into from
Jul 6, 2023
Merged

openapi: update API tokens tag #4137

merged 21 commits into from
Jul 6, 2023

Conversation

thomasheartman
Copy link
Contributor

This PR updates endpoints and schemas for the API tokens tag.

@vercel
Copy link

vercel bot commented Jul 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Jul 6, 2023 7:21am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Jul 6, 2023 7:21am

Copy link
Contributor

@kwasniew kwasniew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one. Minor comments.

src/lib/openapi/spec/create-api-token-schema.ts Outdated Show resolved Hide resolved
src/lib/routes/admin-api/api-token.ts Outdated Show resolved Hide resolved
src/lib/openapi/spec/create-api-token-schema.ts Outdated Show resolved Hide resolved
Comment on lines +129 to +138
// it tells the user what happened
expect(result.description).toContain(
'matches more than one option',
);
// it tells the user what part of the request body this pertains to
expect(result.description).toContain(
dataPath === '.body'
? 'root object'
: `${dataPath.substring('.body.'.length)} property`,
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out that using multipling expect.stringContaining on an object property doesn't work 😬

Copy link
Contributor

@sjaanus sjaanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should enforce strictSchemaValidation on api-token e2e test.

@thomasheartman
Copy link
Contributor Author

Good catch @sjaanus 🥇

thomasheartman added a commit that referenced this pull request Jul 5, 2023
 Background (general): I don’t think it creates any value. I don’t think people check the snapshot explicitly (especially now that it’s so large that it gets hidden by default), and it only creates an extra chore that you forget to do all the time (at least I do).

Background (why now?): I’ve been fighting a weird issue with the snapshot test for the [API tokens OpenAPI PR](#4137). The tests run fine locally, but fail in CI. The tests seem to be using an old version of the snapshot for the test. However, when I check the snapshot in the files tab, it’s got the new and correct values. I’ve spent probably more than an hour trying to fix and debug this today but to no avail.
thomasheartman added a commit that referenced this pull request Jul 6, 2023
 Background (general): I don’t think it creates any value. I don’t think people check the snapshot explicitly (especially now that it’s so large that it gets hidden by default), and it only creates an extra chore that you forget to do all the time (at least I do).

Background (why now?): I’ve been fighting a weird issue with the snapshot test for the [API tokens OpenAPI PR](#4137). The tests run fine locally, but fail in CI. The tests seem to be using an old version of the snapshot for the test. However, when I check the snapshot in the files tab, it’s got the new and correct values. I’ve spent probably more than an hour trying to fix and debug this today but to no avail.
thomasheartman added a commit that referenced this pull request Jul 6, 2023
Background (general): I don’t think it creates any value. I don’t think
people check the snapshot explicitly (especially now that it’s so large
that it gets hidden by default), and it only creates an extra chore that
you forget to do all the time (at least I do).

Background (why now?): I’ve been fighting a weird issue with the
snapshot test for the [API tokens OpenAPI
PR](#4137). The tests run fine
locally, but fail in CI. The tests seem to be using an old version of
the snapshot for the test. However, when I check the snapshot in the
files tab, it’s got the new and correct values. I’ve spent probably more
than an hour trying to fix and debug this today but to no avail.
@thomasheartman thomasheartman enabled auto-merge (squash) July 6, 2023 07:25
@thomasheartman thomasheartman merged commit 6d591fc into main Jul 6, 2023
10 checks passed
@thomasheartman thomasheartman deleted the openapi/api-tokens branch July 6, 2023 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants