activist icon indicating copy to clipboard operation
activist copied to clipboard

Allow for `URL` to be maintained as a part of backend identifiers in the frontend

Open andrewtavis opened this issue 1 year ago • 5 comments

Terms

Description

This issue is related to the work in #1004 to directly return camelCase from the backend. One downside of this is specifically URL, where the conversion of _url will go to Url. All instances of URL were thus changed to Url for simplicity of conversion, but it would be nice to include a custom parser that inherits from djangorestframework-camel-case that would allow for URL to be returned instead.

Along with this we need to discuss if we'd do the same with _id to convert it to ID instead of Id. Other identifiers should also be considered :)

Contribution

Happy to discuss and work on this once #1004 is merged in!

andrewtavis avatar Nov 08 '24 18:11 andrewtavis

One consideration for this is whether we should convert the Swagger UI back to snake case and then just do a conversion on the frontend for cases of Url.

andrewtavis avatar Nov 15 '24 16:11 andrewtavis

Hey @UnknownSean8 👋 In talking about this a bit with @to-sta, we decided a few things:

  1. Let's leave the Swagger UI as camelCase as it should match the results we're getting in the frontend
  2. Let's not worry about id
  3. In the case of URL, if the change is going to happen, then we'll need to figure out a custom parse on the backend level via djangorestframework-camel-case - potentially inheriting from its parser class for those that are _url that we want to be URL

Feel free to look into this, but let's definitely keep the current setup for now and not stress too much about this!

andrewtavis avatar Nov 16 '24 14:11 andrewtavis

Hello, I would be happy to discuss and work on this if #1004 has been merged in!

JerryW04 avatar Apr 22 '25 05:04 JerryW04

Would be great to get some assistance here as well, @JerryW04! Let us know if the documentation for djangorestframework-camel-case has anything about a custom conversion class that could be used to fix conversions for thing like _url 😊

andrewtavis avatar Apr 22 '25 22:04 andrewtavis

Happy to discuss potential solutions along the way!

andrewtavis avatar Apr 22 '25 22:04 andrewtavis

hey @andrewtavis can i pick this issue?

rohityadav2604 avatar May 02 '25 11:05 rohityadav2604

Let's stick to #1225 for now, @rohityadav2604, but maybe we can also add you here later. Would be great if you finalized the currently open PR, @JerryW04! Please let us know if you need support :)

andrewtavis avatar May 02 '25 11:05 andrewtavis

is this issue still open

tejasai2007 avatar Jul 15 '25 10:07 tejasai2007

Hey @tejasai2007 👋 Is still open, yes :) You'd be very welcome to look into this! Please let us know if you have questions or need support!

andrewtavis avatar Jul 15 '25 11:07 andrewtavis

Taking a look at this a bit, there seems to be a lot of code that would need to be written and maintained to get the _url to *URL conversion working, and it'd need to be done in both directions. There's no option to do this automatically, so it's best if we just agree that this is how it'll be in the frontend.

andrewtavis avatar Aug 11 '25 18:08 andrewtavis