Skip to content

Rename every API method!#1037

Merged
david-crespo merged 1 commit into
mainfrom
api-renames
Jul 7, 2022
Merged

Rename every API method!#1037
david-crespo merged 1 commit into
mainfrom
api-renames

Conversation

@david-crespo

@david-crespo david-crespo commented Jul 7, 2022

Copy link
Copy Markdown
Collaborator

Console integration of oxidecomputer/omicron#1329

This one was pretty fun!

2022-07-07-api-rename-console-errors

@vercel

vercel Bot commented Jul 7, 2022

Copy link
Copy Markdown

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

Name Status Preview Updated
console-ui-storybook ✅ Ready (Inspect) Visit Preview Jul 7, 2022 at 5:42AM (UTC)

Comment thread libs/api/errors.ts
if (method.endsWith('Post')) {
let resource = camelCaseToWords(method).slice(-2)[0]
resource = resource.endsWith('s') ? resource.slice(0, -1) : resource
if (method.endsWith('Create')) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Can't believe it but an e2e test caught this. This is fragile!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Uhh... hmmm... yeah, I wonder if there's a better way to do this.

const queryClient = useApiQueryClient()

const createSshKey = useApiMutation('sshkeysPost', {
const createSshKey = useApiMutation('sessionSshkeyCreate', {

@david-crespo david-crespo Jul 7, 2022

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the session prefix is weird for these operation IMO. will raise the issue on the API side

@just-be-dev

Copy link
Copy Markdown
Contributor

Nice. I love how it's also a net negative change, haha. Your trend continues!

@david-crespo david-crespo merged commit 7ba3700 into main Jul 7, 2022
@david-crespo david-crespo deleted the api-renames branch July 7, 2022 13:48
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