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

fix: api token schema #4633

Merged
merged 2 commits into from
Sep 7, 2023
Merged

fix: api token schema #4633

merged 2 commits into from
Sep 7, 2023

Conversation

gastonfournier
Copy link
Contributor

@gastonfournier gastonfournier commented Sep 7, 2023

About the changes

Create api token schema can either provide the field project or its plural: projects so the joi validation makes them optional:

project: joi.when('projects', {
not: joi.required(),
then: joi.string().optional().default(ALL),
}),
projects: joi.array().min(0).optional(),

This means that when returning the token, the response will either contain project or projects depending on what was provided as input. Therefore we need to make both fields optional in the response

@vercel
Copy link

vercel bot commented Sep 7, 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 Sep 7, 2023 9:50am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Sep 7, 2023 9:50am

@gastonfournier gastonfournier changed the title Fix api token schema fix: api token schema Sep 7, 2023
@gastonfournier gastonfournier marked this pull request as ready for review September 7, 2023 10:23
@gastonfournier gastonfournier merged commit fe51b50 into main Sep 7, 2023
7 checks passed
@gastonfournier gastonfournier deleted the fix-api-token-schema branch September 7, 2023 10:23
@gastonfournier
Copy link
Contributor Author

I made the wrong assumption. The token (response) always has the project and projects fields

gastonfournier added a commit that referenced this pull request Sep 7, 2023
gastonfournier added a commit that referenced this pull request Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants