go-safeweb icon indicating copy to clipboard operation
go-safeweb copied to clipboard

Reserve characters for path parameters

Open empijei opened this issue 3 years ago • 1 comments

We should reserve some characters to support path parameters in the future.

I propose to reserve $ as a trigger for path parameters.

Examples:

  • /users/$id:int/page: this parses the ID parameter as int
  • /users/bar:foo: this does nothing because the path parameter doesn't start with a $
  • /users/$id/page: invalid, missing type information.

If this syntax is okay we can just forbid path segments to start with $ for now and revisit this feature in a future version.

If we do this inside the framework implementation would be quite simple and we can ensure a strict and well defined type checking. To access those path parameters we could just put them as a secure form inside the incoming request object.

empijei avatar May 28 '21 05:05 empijei

I'd rather not do that before we have a design for path parameters handling. Most importantly, I'm not sure this should belong to the core framework, or to an interceptor.

kele avatar Jun 02 '21 09:06 kele