WIP: feat: remove defaults function #1313

Closed
dpschen wants to merge 1 commits from dpschen:feature/remove-defaults-function-from-models into main
Member
No description provided.
dpschen changed title from feat: remove defaults function to WIP: feat: remove defaults function 2022-01-05 21:11:28 +00:00
Member

Hi dpschen!

Thank you for creating a PR!

I've deployed the changes of this PR on a preview environment under this URL: https://1313-featureremove-defaults-function-from-models--vikunja-frontend-preview.netlify.app

You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.

Have a nice day!

Beep boop, I'm a bot.

Hi dpschen! Thank you for creating a PR! I've deployed the changes of this PR on a preview environment under this URL: https://1313-featureremove-defaults-function-from-models--vikunja-frontend-preview.netlify.app You can use this url to view the changes live and test them out. You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/. Have a nice day! > Beep boop, I'm a bot.
konrad reviewed 2022-01-06 10:35:54 +00:00
@ -8,2 +4,2 @@
}
}
newEmail = ''
passwort = ''

Wow. I think that parameter isn't even used like that - should be password https://try.vikunja.io/api/v1/docs#tag/user/paths/~1user~1settings~1email/post

Wow. I think that parameter isn't even used like that - should be `password` https://try.vikunja.io/api/v1/docs#tag/user/paths/~1user~1settings~1email/post
Author
Member

Is fixed by #1540

Is fixed by https://kolaente.dev/vikunja/frontend/pulls/1540
dpschen marked this conversation as resolved
Author
Member

Well that failed more than I expected :D

Well that failed more than I expected :D
dpschen force-pushed feature/remove-defaults-function-from-models from 253017d0dd to 200851259a 2022-01-06 14:38:12 +00:00 Compare
Author
Member

@konrad I realized that what I want to achieve with this branch seems easier possible by annotating them with JSDOC:

class ExampleC {
  constructor(data) {
    // property types can be simply annotated, if they're set elsewhere
    /** @type {number} */
    this.size;
 
  }
}

What do you think?

@konrad I realized that what I want to achieve with this branch seems easier possible by [annotating them with JSDOC](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#classes-1): ```js class ExampleC { constructor(data) { // property types can be simply annotated, if they're set elsewhere /** @type {number} */ this.size; } } ``` What do you think?
Owner

If that works well, it could be a good way to solve it.

The long-term goal should be moving everything over to typescript though, not sure if using annotations would mean twice the effort?

If that works well, it could be a good way to solve it. The long-term goal should be moving everything over to typescript though, not sure if using annotations would mean twice the effort?
Author
Member

This seems to work.
I tried it in #1536
The cool think is that it's not as strict as ts for the input values (when you create the model). This makes it easier to transition, because else you would need to format a lot of date before creating the class.
In the longterm we should find a solution similar to that.
Even though verbose this really makes things easier.

This seems to work. I tried it in https://kolaente.dev/vikunja/frontend/pulls/1536 The cool think is that it's not as strict as ts for the input values (when you create the model). This makes it easier to transition, because else you would need to format a lot of date before creating the class. In the longterm we should find a solution similar to that. Even though verbose this really makes things easier.
Author
Member

Closing this.
My plan is now:

  • incrementally add JSDOCs annotations
  • convert to ts where possible.
  • don't introduce new defaults functions for new models

This seems to be the easiest way forward.

Closing this. My plan is now: - incrementally add JSDOCs annotations - convert to ts where possible. - don't introduce new defaults functions for new models This seems to be the easiest way forward.
dpschen closed this pull request 2022-02-14 10:10:47 +00:00
Author
Member

... not sure if using annotations would mean twice the effort?

It's easy to convert from TSDOC to ts.

> ... not sure if using annotations would mean twice the effort? It's easy to convert from TSDOC to ts.
This repo is archived. You cannot comment on pull requests.
No description provided.