PR #27 added path schema inferring from function arguments, but it doesn't implement inferring when T in Path<T> is complex struct. This should be fairly easy to implement if T implements JsonSchema - just extract its schema and check inner fields. So basically logic would be like:
- get JSON schema for
T;
- if it is primitive type (string, number, ...) - assume this is single path parameter
- if it is struct - assume each field is a separate parameter
- if it is a tuple - probably the same
When T is struct, deserializer will use field names rather than positions, so crate should also validate that names of parameters in path matches field names in struct (probably via T JSON schema as well).
For tuples probably good idea to add number of positional arguments validation against actual path as well.
PR #27 added path schema inferring from function arguments, but it doesn't implement inferring when
TinPath<T>is complex struct. This should be fairly easy to implement ifTimplementsJsonSchema- just extract its schema and check inner fields. So basically logic would be like:T;When
Tis struct, deserializer will use field names rather than positions, so crate should also validate that names of parameters in path matches field names in struct (probably viaTJSON schema as well).For tuples probably good idea to add number of positional arguments validation against actual path as well.